mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-31 22:05:10 +02:00
Block self-casting, e.g. Archangels can't resurrect themselves
This commit is contained in:
parent
6e5da6c158
commit
c839b397e8
@ -213,6 +213,20 @@ bool BattleSpellMechanics::canBeCastAt(const Target & target, Problem & problem)
|
|||||||
|
|
||||||
Target spellTarget = transformSpellTarget(target);
|
Target spellTarget = transformSpellTarget(target);
|
||||||
|
|
||||||
|
const battle::Unit * mainTarget = nullptr;
|
||||||
|
|
||||||
|
if(spellTarget.front().unitValue)
|
||||||
|
{
|
||||||
|
mainTarget = target.front().unitValue;
|
||||||
|
}
|
||||||
|
else if(spellTarget.front().hexValue.isValid())
|
||||||
|
{
|
||||||
|
mainTarget = battle()->battleGetUnitByPos(target.front().hexValue, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainTarget && mainTarget == caster)
|
||||||
|
return false; // can't cast on self
|
||||||
|
|
||||||
return effects->applicable(problem, this, target, spellTarget);
|
return effects->applicable(problem, this, target, spellTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user