1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +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; break;
case RISE_DEMONS: case RISE_DEMONS:
if (shere && ourStack && !shere->alive()) 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; break;
} }
if (legalAction) if (legalAction)
@ -2320,7 +2327,10 @@ void CBattleInterface::handleHex(BattleHex myNumber, int eventType)
break; break;
case RISE_DEMONS: case RISE_DEMONS:
cursorType = ECursor::SPELLBOOK; cursorType = ECursor::SPELLBOOK;
realizeAction = [=]{ giveCommand(Battle::DAEMON_SUMMONING, myNumber, activeStack->ID); }; realizeAction = [=]
{
giveCommand(Battle::DAEMON_SUMMONING, myNumber, activeStack->ID);
};
break; break;
case CATAPULT: case CATAPULT:
cursorFrame = ECursor::COMBAT_SHOOT_CATAPULT; cursorFrame = ECursor::COMBAT_SHOOT_CATAPULT;

View File

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