mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
Fixed #1330.
This commit is contained in:
@@ -744,21 +744,6 @@ std::vector<ui32> BattleInfo::calculateResistedStacks(const CSpell * sp, const C
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sp->id == SpellID::HYPNOTIZE) //hypnotize
|
|
||||||
{
|
|
||||||
for(auto & affectedCreature : affectedCreatures)
|
|
||||||
{
|
|
||||||
if( (affectedCreature)->hasBonusOfType(Bonus::SPELL_IMMUNITY, sp->id) //100% sure spell immunity
|
|
||||||
|| ( (affectedCreature)->count - 1 ) * (affectedCreature)->MaxHealth() + (affectedCreature)->firstHPleft
|
|
||||||
>
|
|
||||||
calculateSpellBonus (usedSpellPower * 25 + sp->powers[spellLevel], sp, caster, affectedCreature) //apply 'damage' bonus for hypnotize, including hero specialty
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ret.push_back((affectedCreature)->ID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1569,7 +1569,16 @@ ESpellCastProblem::ESpellCastProblem CBattleInfoCallback::battleIsImmune(const C
|
|||||||
return ESpellCastProblem::STACK_IMMUNE_TO_SPELL;
|
return ESpellCastProblem::STACK_IMMUNE_TO_SPELL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(spell->id == SpellID::HYPNOTIZE && caster) //do not resist hypnotize casted after attack, for example
|
||||||
|
{
|
||||||
|
//TODO: what with other creatures casting hypnotize, Faerie Dragons style?
|
||||||
|
ui64 subjectHealth = (subject->count - 1) * subject->MaxHealth() + subject->firstHPleft;
|
||||||
|
//apply 'damage' bonus for hypnotize, including hero specialty
|
||||||
|
ui64 maxHealth = calculateSpellBonus (caster->getPrimSkillLevel(PrimarySkill::SPELL_POWER)
|
||||||
|
* spell->power + spell->powers[caster->getSpellSchoolLevel(spell)], spell, caster, subject);
|
||||||
|
if (subjectHealth > maxHealth)
|
||||||
|
return ESpellCastProblem::STACK_IMMUNE_TO_SPELL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else //no target stack on this tile
|
else //no target stack on this tile
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user