MM: MM1: Fix defeated monsters display at end of combat

This commit is contained in:
Paul Gilbert 2023-02-02 21:17:55 -08:00
parent 2c919436e2
commit 3cf7a2fe3d
2 changed files with 17 additions and 27 deletions

View File

@ -346,10 +346,7 @@ void Combat::defeatedMonsters() {
g_globals->_combatParty[i]->_exp += _totalExperience;
}
// Update the party's characters
g_globals->_party.combatDone();
combatDone();
setMode(DEFEATED_MONSTERS);
}
void Combat::setTreasure() {
@ -632,7 +629,7 @@ void Combat::monsterAction() {
bool Combat::checkMonsterSpells() {
Encounter &enc = g_globals->_encounters;
if (_remainingMonsters.empty()) {
setMode(DEFEATED_MONSTERS);
defeatedMonsters();
return true;
}
@ -1615,6 +1612,9 @@ void Combat::combatDone() {
g_globals->_activeSpells._s.shield = 0;
g_globals->_activeSpells._s.power_shield = 0;
// Update the party's characters
g_globals->_party.combatDone();
// Rearrange the party to match the combat order
g_globals->_party.rearrange(g_globals->_combatParty);
}

View File

@ -139,6 +139,11 @@ void Combat::draw() {
writeCharAttackNoEffect();
delaySeconds(3);
return;
case DEFEATED_MONSTERS:
writeDefeat();
Sound::sound2(SOUND_3);
delaySeconds(3);
return;
default:
break;
}
@ -156,12 +161,6 @@ void Combat::draw() {
writeOptions();
break;
case DEFEATED_MONSTERS:
writeDefeat();
Sound::sound2(SOUND_3);
delaySeconds(5);
break;
case SPELL_RESULT:
writeSpellResult();
if (_spellResult._delaySeconds)
@ -207,17 +206,9 @@ void Combat::timeout() {
case WAITS_FOR_OPENING:
combatLoop(true);
break;
case DEFEATED_MONSTERS: {
auto &spells = g_globals->_activeSpells;
spells._s.bless = 0;
spells._s.invisbility = 0;
spells._s.shield = 0;
spells._s.power_shield = 0;
close();
g_events->send("Game", GameMessage("UPDATE"));
case DEFEATED_MONSTERS:
combatDone();
break;
}
case SPELL_RESULT:
if (_spellResult._timeoutCallback)
_spellResult._timeoutCallback();
@ -583,13 +574,10 @@ void Combat::clearPartyArea() {
}
void Combat::writeDefeat() {
resetBottom();
writeString(10, 0, "+----------------------------+");
for (int y = 1; y < 8; ++y) {
writeChar(10, y, '!');
writeChar(37, y, '!');
}
writeString(10, 0, "+----------------------------+");
for (int y = 1; y < 8; ++y)
writeString(10, y, "! !");
writeString(10, 8, "+----------------------------+");
writeString(10, 2, STRING["dialogs.combat.defeating1"]);
writeString(10, 4, STRING["dialogs.combat.defeating2"]);
@ -872,7 +860,9 @@ void Combat::displaySpellResult(const InfoMessage &msg) {
void Combat::combatDone() {
Game::Combat::combatDone();
close();
g_events->send("Game", GameMessage("UPDATE"));
}
} // namespace Views