|
@@ -1623,26 +1623,9 @@ ESpellCastProblem::ESpellCastProblem CBattleInfoCallback::battleCanCastThisSpell
|
|
|
return ESpellCastProblem::NO_APPROPRIATE_TARGET;
|
|
return ESpellCastProblem::NO_APPROPRIATE_TARGET;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
if(battleMaxSpellLevel() < spell->level) //effect like Recanter's Cloak or Orb of Inhibition
|
|
if(battleMaxSpellLevel() < spell->level) //effect like Recanter's Cloak or Orb of Inhibition
|
|
|
return ESpellCastProblem::SPELL_LEVEL_LIMIT_EXCEEDED;
|
|
return ESpellCastProblem::SPELL_LEVEL_LIMIT_EXCEEDED;
|
|
|
|
|
|
|
|
- //IDs of summon elemental spells (fire, earth, water, air)
|
|
|
|
|
- int spellIDs[] = { SpellID::SUMMON_FIRE_ELEMENTAL, SpellID::SUMMON_EARTH_ELEMENTAL,
|
|
|
|
|
- SpellID::SUMMON_WATER_ELEMENTAL, SpellID::SUMMON_AIR_ELEMENTAL };
|
|
|
|
|
- //(fire, earth, water, air) elementals
|
|
|
|
|
- int creIDs[] = {CreatureID::FIRE_ELEMENTAL, CreatureID::EARTH_ELEMENTAL,
|
|
|
|
|
- CreatureID::WATER_ELEMENTAL, CreatureID::AIR_ELEMENTAL};
|
|
|
|
|
-
|
|
|
|
|
- int arpos = vstd::find_pos(spellIDs, spell->id);
|
|
|
|
|
- if(arpos < ARRAY_COUNT(spellIDs))
|
|
|
|
|
- {
|
|
|
|
|
- //check if there are summoned elementals of other type
|
|
|
|
|
- for(const CStack * st : battleAliveStacks(side))
|
|
|
|
|
- if(vstd::contains(st->state, EBattleStackState::SUMMONED) && st->getCreature()->idNumber != creIDs[arpos])
|
|
|
|
|
- return ESpellCastProblem::ANOTHER_ELEMENTAL_SUMMONED;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
//checking if there exists an appropriate target
|
|
//checking if there exists an appropriate target
|
|
|
switch(spell->getTargetType())
|
|
switch(spell->getTargetType())
|
|
|
{
|
|
{
|