1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Use ESpellCastProblem inside SpellHandler

This commit is contained in:
AlexVinS
2014-11-12 05:50:51 +03:00
parent 24efb9b413
commit a49da360d2
6 changed files with 37 additions and 22 deletions

View File

@ -1621,12 +1621,12 @@ ESpellCastProblem::ESpellCastProblem CBattleInfoCallback::battleIsImmune(const C
ESpellCastProblem::ESpellCastProblem CBattleInfoCallback::battleStackIsImmune(const CGHeroInstance * caster, const CSpell * spell, ECastingMode::ECastingMode mode, const CStack * subject) const
{
if (spell->isPositive() && subject->hasBonusOfType(Bonus::RECEPTIVE)) //accept all positive spells
return ESpellCastProblem::OK;
if (spell->isImmuneBy(subject)) //TODO: move all logic to spellhandler
return ESpellCastProblem::STACK_IMMUNE_TO_SPELL;
const auto immuneResult = spell->isImmuneBy(subject);
if (ESpellCastProblem::NOT_DECIDED != immuneResult)
return immuneResult;
//TODO: move all logic to spellhandler
switch (spell->id) //TODO: more general logic for new spells?
{
case SpellID::CLONE: