1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Passive cast can be blocked by spell level limit.

This commit is contained in:
AlexVinS 2016-09-18 17:21:56 +03:00
parent 374e30c972
commit ef34d21941
2 changed files with 8 additions and 2 deletions

View File

@ -1666,7 +1666,9 @@ ESpellCastProblem::ESpellCastProblem CBattleInfoCallback::battleCanCastThisSpell
if(specificProblem != ESpellCastProblem::OK)
return specificProblem;
if(battleMaxSpellLevel(side) < spell->level) //effect like Recanter's Cloak or Orb of Inhibition
//effect like Recanter's Cloak. Blocks also passive casting.
//TODO: check creature abilities to block
if(battleMaxSpellLevel(side) < spell->level)
return ESpellCastProblem::SPELL_LEVEL_LIMIT_EXCEEDED;
return ESpellCastProblem::OK;

View File

@ -5578,13 +5578,17 @@ void CGameHandler::runBattle()
for(int i = 0; i < 2; ++i)
{
auto h = gs->curB->battleGetFightingHero(i);
if(h && h->hasBonusOfType(Bonus::OPENING_BATTLE_SPELL))
if(h)
{
TBonusListPtr bl = h->getBonuses(Selector::type(Bonus::OPENING_BATTLE_SPELL));
for (Bonus *b : *bl)
{
const CSpell * spell = SpellID(b->subtype).toSpell();
if(ESpellCastProblem::OK != gs->curB->battleCanCastThisSpell(h, spell, ECastingMode::PASSIVE_CASTING))
continue;
BattleSpellCastParameters parameters(gs->curB, h, spell);
parameters.spellLvl = 3;
parameters.effectLevel = 3;