1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00
This commit is contained in:
DjWarmonger 2013-08-02 08:33:56 +00:00
parent 58ccaa2e93
commit e2de926aec
2 changed files with 10 additions and 16 deletions

View File

@ -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;
}

View File

@ -1569,7 +1569,16 @@ ESpellCastProblem::ESpellCastProblem CBattleInfoCallback::battleIsImmune(const C
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
{