1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Handle HYPNOTIZE effect in case of mana drain

This commit is contained in:
AlexVinS
2016-09-29 21:47:41 +03:00
parent 688dc4c189
commit 83b3c700dd
5 changed files with 25 additions and 14 deletions

View File

@ -875,8 +875,7 @@ void CGameHandler::applyBattleEffects(BattleAttack &bat, const CStack *att, cons
bsa.flags |= BattleStackAttacked::SECONDARY; //all other targets do not suffer from spells & spell-like abilities
bsa.attackerID = att->ID;
bsa.stackAttacked = def->ID;
bsa.damageAmount = gs->curB->calculateDmg(att, def, gs->curB->battleGetOwner(att), gs->curB->battleGetOwner(def),
bat.shot(), distance, bat.lucky(), bat.unlucky(), bat.deathBlow(), bat.ballistaDoubleDmg(), getRandomGenerator());
bsa.damageAmount = gs->curB->calculateDmg(att, def, bat.shot(), distance, bat.lucky(), bat.unlucky(), bat.deathBlow(), bat.ballistaDoubleDmg(), getRandomGenerator());
def->prepareAttacked(bsa, getRandomGenerator()); //calculate casualties
//life drain handling
@ -4537,7 +4536,7 @@ void CGameHandler::stackTurnTrigger(const CStack * st)
}
if (st->hasBonusOfType(Bonus::MANA_DRAIN) && !vstd::contains(st->state, EBattleStackState::DRAINED_MANA))
{
const PlayerColor opponent = gs->curB->theOtherPlayer(st->owner);
const PlayerColor opponent = gs->curB->theOtherPlayer(gs->curB->battleGetOwner(st));
const CGHeroInstance * opponentHero = gs->curB->getHero(opponent);
if (opponentHero)
{
@ -5727,7 +5726,7 @@ void CGameHandler::runBattle()
continue;
}
const CGHeroInstance * curOwner = gs->curB->battleGetOwner(next);
const CGHeroInstance * curOwner = gs->curB->battleGetOwnerHero(next);
if( (next->position < 0 || next->getCreature()->idNumber == CreatureID::BALLISTA) //arrow turret or ballista
&& (!curOwner || curOwner->getSecSkillLevel(SecondarySkill::ARTILLERY) == 0)) //hero has no artillery