1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

get rid of CBattleInfoCallback::battleCanCastThisSpellHere

This commit is contained in:
AlexVinS
2017-06-05 23:25:48 +03:00
parent 2cfb2e6ae0
commit 6c308956f9
5 changed files with 9 additions and 23 deletions

View File

@@ -4458,7 +4458,7 @@ bool CGameHandler::makeCustomAction(BattleAction &ba)
if (ba.selectedStack >= 0)
parameters.aimToStack(gs->curB->battleGetStackByID(ba.selectedStack, false));
ESpellCastProblem::ESpellCastProblem escp = gs->curB->battleCanCastThisSpell(h, s, ECastingMode::HERO_CASTING);//todo: should we check aimed cast(battleCanCastThisSpellHere)?
ESpellCastProblem::ESpellCastProblem escp = gs->curB->battleCanCastThisSpell(h, s, ECastingMode::HERO_CASTING);//todo: should we check aimed cast?
if (escp != ESpellCastProblem::OK)
{
logGlobal->warn("Spell cannot be cast! Problem: %d", escp);
@@ -5300,7 +5300,7 @@ void CGameHandler::attackCasting(const BattleAttack & bat, Bonus::BonusType atta
vstd::amin(chance, 100);
const CSpell * spell = SpellID(spellID).toSpell();
if (gs->curB->battleCanCastThisSpellHere(attacker, spell, ECastingMode::AFTER_ATTACK_CASTING, oneOfAttacked->position) != ESpellCastProblem::OK)
if(spell->canBeCastAt(gs->curB, attacker, ECastingMode::AFTER_ATTACK_CASTING, oneOfAttacked->position) != ESpellCastProblem::OK)
continue;
//check if spell should be cast (probability handling)