1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00
+ added new flag for special spells. Special spells can be obtained only with BONUS::SPELL.
* made Titans` thunder special.
This commit is contained in:
alexvins
2014-03-07 16:10:20 +00:00
parent 33935ceb67
commit afcb7072eb
5 changed files with 42 additions and 12 deletions

View File

@ -1375,17 +1375,32 @@ bool CGHeroInstance::canCastThisSpell(const CSpell * spell) const
if(!getArt(ArtifactPosition::SPELLBOOK)) //if hero has no spellbook
return false;
if(vstd::contains(spells, spell->id) //hero has this spell in spellbook
|| (spell->air && hasBonusOfType(Bonus::AIR_SPELLS)) // this is air spell and hero can cast all air spells
|| (spell->fire && hasBonusOfType(Bonus::FIRE_SPELLS)) // this is fire spell and hero can cast all fire spells
|| (spell->water && hasBonusOfType(Bonus::WATER_SPELLS)) // this is water spell and hero can cast all water spells
|| (spell->earth && hasBonusOfType(Bonus::EARTH_SPELLS)) // this is earth spell and hero can cast all earth spells
|| hasBonusOfType(Bonus::SPELL, spell->id)
|| hasBonusOfType(Bonus::SPELLS_OF_LEVEL, spell->level)
)
return true;
if (spell->isSpecialSpell())
{
if (vstd::contains(spells, spell->id))
{//hero has this spell in spellbook
logGlobal->errorStream() << "Special spell in spellbook "<<spell->name;
}
return false;
if (hasBonusOfType(Bonus::SPELL, spell->id))
return true;
return false;
}
else
{
if(vstd::contains(spells, spell->id) //hero has this spell in spellbook
|| (spell->air && hasBonusOfType(Bonus::AIR_SPELLS)) // this is air spell and hero can cast all air spells
|| (spell->fire && hasBonusOfType(Bonus::FIRE_SPELLS)) // this is fire spell and hero can cast all fire spells
|| (spell->water && hasBonusOfType(Bonus::WATER_SPELLS)) // this is water spell and hero can cast all water spells
|| (spell->earth && hasBonusOfType(Bonus::EARTH_SPELLS)) // this is earth spell and hero can cast all earth spells
|| hasBonusOfType(Bonus::SPELL, spell->id)
|| hasBonusOfType(Bonus::SPELLS_OF_LEVEL, spell->level)
)
return true;
return false;
}
}
/**