1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

fix sphereOfPermanence

This commit is contained in:
AlexVinS 2015-09-18 08:04:13 +03:00
parent 3d7435c520
commit 5f41ec912f

View File

@ -191,7 +191,20 @@ void DispellMechanics::applyBattle(BattleInfo * battle, const BattleSpellCast *
ESpellCastProblem::ESpellCastProblem DispellMechanics::isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const ESpellCastProblem::ESpellCastProblem DispellMechanics::isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const
{ {
//DISPELL ignores all immunities, so do not call default {
//just in case
if(!obj->alive())
return ESpellCastProblem::WRONG_SPELL_TARGET;
}
//DISPELL ignores all immunities, except specific absolute immunity
{
//SPELL_IMMUNITY absolute case
std::stringstream cachingStr;
cachingStr << "type_" << Bonus::SPELL_IMMUNITY << "subtype_" << owner->id.toEnum() << "addInfo_1";
if(obj->hasBonus(Selector::typeSubtypeInfo(Bonus::SPELL_IMMUNITY, owner->id.toEnum(), 1), cachingStr.str()))
return ESpellCastProblem::STACK_IMMUNE_TO_SPELL;
}
{
std::stringstream cachingStr; std::stringstream cachingStr;
cachingStr << "source_" << Bonus::SPELL_EFFECT; cachingStr << "source_" << Bonus::SPELL_EFFECT;
@ -199,8 +212,9 @@ ESpellCastProblem::ESpellCastProblem DispellMechanics::isImmuneByStack(const CGH
{ {
return ESpellCastProblem::OK; return ESpellCastProblem::OK;
} }
}
return ESpellCastProblem::WRONG_SPELL_TARGET; return ESpellCastProblem::WRONG_SPELL_TARGET;
//any other immunities are ignored - do not execute default algorithm
} }
void DispellMechanics::applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const void DispellMechanics::applyBattleEffects(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters, SpellCastContext & ctx) const