|
@@ -114,17 +114,16 @@ ESpellCastProblem CBattleInfoCallback::battleCanCastSpell(const spells::Caster *
|
|
|
{
|
|
|
case spells::Mode::HERO:
|
|
|
{
|
|
|
- if(battleCastSpells(side) > 0)
|
|
|
- return ESpellCastProblem::CASTS_PER_TURN_LIMIT;
|
|
|
-
|
|
|
- const auto * hero = dynamic_cast<const CGHeroInstance *>(caster);
|
|
|
+ const auto * hero = caster->getHeroCaster();
|
|
|
|
|
|
if(!hero)
|
|
|
return ESpellCastProblem::NO_HERO_TO_CAST_SPELL;
|
|
|
- if(hero->hasBonusOfType(BonusType::BLOCK_ALL_MAGIC))
|
|
|
- return ESpellCastProblem::MAGIC_IS_BLOCKED;
|
|
|
if(!hero->hasSpellbook())
|
|
|
return ESpellCastProblem::NO_SPELLBOOK;
|
|
|
+ if(hero->hasBonusOfType(BonusType::BLOCK_ALL_MAGIC))
|
|
|
+ return ESpellCastProblem::MAGIC_IS_BLOCKED;
|
|
|
+ if(battleCastSpells(side) >= hero->valOfBonuses(BonusType::HERO_SPELL_CASTS_PER_COMBAT_TURN))
|
|
|
+ return ESpellCastProblem::CASTS_PER_TURN_LIMIT;
|
|
|
}
|
|
|
break;
|
|
|
default:
|