mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Merge pull request #2717 from rilian-la-te/fix-unit-effect-immune
Teleport: check immunities in applicable()
This commit is contained in:
commit
9d4d2e0bae
@ -607,10 +607,10 @@ bool BattleActionsController::actionIsLegal(PossiblePlayerBattleAction action, B
|
||||
return false;
|
||||
|
||||
case PossiblePlayerBattleAction::ANY_LOCATION:
|
||||
return isCastingPossibleHere(action.spell().toSpell(), targetStack, targetHex);
|
||||
return isCastingPossibleHere(action.spell().toSpell(), nullptr, targetHex);
|
||||
|
||||
case PossiblePlayerBattleAction::AIMED_SPELL_CREATURE:
|
||||
return !selectedStack && targetStack && isCastingPossibleHere(action.spell().toSpell(), targetStack, targetHex);
|
||||
return !selectedStack && targetStack && isCastingPossibleHere(action.spell().toSpell(), nullptr, targetHex);
|
||||
|
||||
case PossiblePlayerBattleAction::RANDOM_GENIE_SPELL:
|
||||
if(targetStack && targetStackOwned && targetStack != owner.stacksController->getActiveStack() && targetStack->alive()) //only positive spells for other allied creatures
|
||||
@ -628,7 +628,7 @@ bool BattleActionsController::actionIsLegal(PossiblePlayerBattleAction action, B
|
||||
|
||||
case PossiblePlayerBattleAction::OBSTACLE:
|
||||
case PossiblePlayerBattleAction::FREE_LOCATION:
|
||||
return isCastingPossibleHere(action.spell().toSpell(), targetStack, targetHex);
|
||||
return isCastingPossibleHere(action.spell().toSpell(), nullptr, targetHex);
|
||||
|
||||
case PossiblePlayerBattleAction::CATAPULT:
|
||||
return owner.siegeController && owner.siegeController->isAttackableByCatapult(targetHex);
|
||||
|
@ -49,7 +49,7 @@ void Teleport::adjustTargetTypes(std::vector<TargetType> & types) const
|
||||
bool Teleport::applicable(Problem & problem, const Mechanics * m, const EffectTarget & target) const
|
||||
{
|
||||
if(target.size() == 1) //Assume, this is check only for selecting a unit
|
||||
return UnitEffect::applicable(problem, m);
|
||||
return UnitEffect::applicable(problem, m, target);
|
||||
|
||||
if(target.size() != 2)
|
||||
return m->adaptProblem(ESpellCastProblem::WRONG_SPELL_TARGET, problem);
|
||||
|
Loading…
Reference in New Issue
Block a user