1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

* support for new creature abilities: hate, spell cost decreasing, spell vulnerability

* fixed crash when vcmiistari is applied on hero without spell book
This commit is contained in:
mateuszb
2009-08-23 13:41:57 +00:00
parent 56fe3b0547
commit fe2085fe42
8 changed files with 79 additions and 19 deletions

View File

@ -736,7 +736,16 @@ DLL_EXPORT void SpellCast::applyGs( CGameState *gs )
CGHeroInstance *h = (side) ? gs->getHero(gs->curB->hero2) : gs->getHero(gs->curB->hero1);
if(h)
{
h->mana -= VLC->spellh->spells[id].costs[skill];
int spellCost = 0;
if(gs->curB)
{
spellCost = gs->curB->getSpellCost(&VLC->spellh->spells[id], h);
}
else
{
spellCost = VLC->spellh->spells[id].costs[skill];
}
h->mana -= spellCost;
if(h->mana < 0) h->mana = 0;
}
if(side >= 0 && side < 2)