1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Fix lack of unit action with morale+wait

This commit is contained in:
Dydzio 2019-03-23 23:51:50 +01:00
parent 8b6316c8ee
commit 9e4619c08d
4 changed files with 9 additions and 2 deletions

View File

@ -1908,7 +1908,7 @@ void CBattleInterface::blockUI(bool on)
canCastSpells = spellcastingProblem == ESpellCastProblem::OK || spellcastingProblem == ESpellCastProblem::MAGIC_IS_BLOCKED;
}
bool canWait = activeStack ? !activeStack->waited() : false;
bool canWait = activeStack ? !activeStack->waitedThisTurn : false;
bOptions->block(on);
bFlee->block(on || !curInt->cb->battleCanFlee());

View File

@ -1422,6 +1422,7 @@ DLL_LINKAGE void StartAction::applyGs(CGameState *gs)
case EActionType::WAIT:
st->defendingAnim = false;
st->waiting = true;
st->waitedThisTurn = true;
break;
case EActionType::HERO_SPELL: //no change in current stack state
break;

View File

@ -476,6 +476,7 @@ CUnitState::CUnitState()
movedThisRound(false),
summoned(false),
waiting(false),
waitedThisTurn(false),
casts(this),
counterAttacks(this),
health(this),
@ -508,6 +509,7 @@ CUnitState & CUnitState::operator=(const CUnitState & other)
movedThisRound = other.movedThisRound;
summoned = other.summoned;
waiting = other.waiting;
waitedThisTurn = other.waitedThisTurn;
casts = other.casts;
counterAttacks = other.counterAttacks;
health = other.health;
@ -727,7 +729,7 @@ bool CUnitState::defended(int turn) const
bool CUnitState::moved(int turn) const
{
if(!turn)
if(!turn && !waiting)
return movedThisRound;
else
return false;
@ -843,6 +845,7 @@ void CUnitState::serializeJson(JsonSerializeFormat & handler)
handler.serializeBool("moved", movedThisRound);
handler.serializeBool("summoned", summoned);
handler.serializeBool("waiting", waiting);
handler.serializeBool("waitedThisTurn", waitedThisTurn);
handler.serializeStruct("casts", casts);
handler.serializeStruct("counterAttacks", counterAttacks);
@ -876,6 +879,7 @@ void CUnitState::reset()
movedThisRound = false;
summoned = false;
waiting = false;
waitedThisTurn = false;
casts.reset();
counterAttacks.reset();
@ -946,6 +950,7 @@ void CUnitState::afterNewRound()
{
defending = false;
waiting = false;
waitedThisTurn = false;
movedThisRound = false;
hadMorale = false;
fear = false;

View File

@ -181,6 +181,7 @@ public:
bool movedThisRound;
bool summoned;
bool waiting;
bool waitedThisTurn; //"waited()" that stays true for full turn after wait - needed as UI button hackfix
CCasts casts;
CRetaliations counterAttacks;