mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Fix Sacrifice spell
This commit is contained in:
@@ -59,9 +59,10 @@ bool Sacrifice::applicable(Problem & problem, const Mechanics * m) const
|
||||
bool targetExists = false;
|
||||
bool targetToSacrificeExists = false;
|
||||
|
||||
for(auto & target : targets)
|
||||
for(const battle::Unit * target : targets)
|
||||
{
|
||||
if(target->alive())
|
||||
auto unit = target->acquire();
|
||||
if(target->alive() && unit->isLiving() && !unit->hasBonusOfType(BonusType::MECHANICAL))
|
||||
targetToSacrificeExists = true;
|
||||
else if(target->isDead())
|
||||
targetExists = true;
|
||||
@@ -89,12 +90,15 @@ bool Sacrifice::applicable(Problem & problem, const Mechanics * m, const EffectT
|
||||
if(!Heal::applicable(problem, m, healTarget))
|
||||
return false;
|
||||
|
||||
if(healTarget.front().unitValue->alive())
|
||||
return false;
|
||||
|
||||
if(target.size() == 2)
|
||||
{
|
||||
const auto *victim = target.at(1).unitValue;
|
||||
if(!victim)
|
||||
return false;
|
||||
|
||||
|
||||
return victim->alive() && getStackFilter(m, false, victim) && isReceptive(m, victim);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user