1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

[WiP]Added some checks for RISE_DEMONS action.

This commit is contained in:
AlexVinS 2015-10-24 00:29:45 +03:00
parent fbebbf39f3
commit 6a9dc78dcd
2 changed files with 17 additions and 7 deletions

View File

@ -2163,7 +2163,14 @@ void CBattleInterface::handleHex(BattleHex myNumber, int eventType)
break;
case RISE_DEMONS:
if (shere && ourStack && !shere->alive())
legalAction = true;
{
if(!(shere->hasBonusOfType(Bonus::UNDEAD)
|| shere->hasBonusOfType(Bonus::NON_LIVING)
|| vstd::contains(shere->state, EBattleStackState::SUMMONED)
|| vstd::contains(shere->state, EBattleStackState::CLONED)
))
legalAction = true;
}
break;
}
if (legalAction)
@ -2320,7 +2327,10 @@ void CBattleInterface::handleHex(BattleHex myNumber, int eventType)
break;
case RISE_DEMONS:
cursorType = ECursor::SPELLBOOK;
realizeAction = [=]{ giveCommand(Battle::DAEMON_SUMMONING, myNumber, activeStack->ID); };
realizeAction = [=]
{
giveCommand(Battle::DAEMON_SUMMONING, myNumber, activeStack->ID);
};
break;
case CATAPULT:
cursorFrame = ECursor::COMBAT_SHOOT_CATAPULT;

View File

@ -3848,9 +3848,6 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
//TODO: From Strategija:
//Summon Demon is a level 2 spell.
{
StartAction start_action(ba);
sendAndApply(&start_action);
const CStack *summoner = gs->curB->battleGetStackByID(ba.stackNumber),
*destStack = gs->curB->battleGetStackByPos(ba.destinationTile, false);
@ -3872,6 +3869,9 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
if (bsa.amount) //there's rare possibility single creature cannot rise desired type
{
StartAction start_action(ba);
sendAndApply(&start_action);
BattleStacksRemoved bsr; //remove body
bsr.stackIDs.insert(destStack->ID);
sendAndApply(&bsr);
@ -3883,9 +3883,9 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
ssp.val = -1;
ssp.absolute = false;
sendAndApply(&ssp);
}
sendAndApply(&end_action);
sendAndApply(&end_action);
}
break;
}
case Battle::MONSTER_SPELL: