From 330edde0036bca0e0dc19956e727e2f66688a036 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sun, 14 Aug 2022 17:30:45 +0300 Subject: [PATCH] Fix radiation bugs --- src/critter.cc | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/critter.cc b/src/critter.cc index abdbb25..9cb9c1b 100644 --- a/src/critter.cc +++ b/src/critter.cc @@ -568,6 +568,13 @@ void _process_rads(Object* obj, int radiationLevel, bool isHealing) if (obj == gDude) { // Radiation level message, higher is worse. messageListItem.num = 1000 + radiationLevelIndex; + + // SFALL: Fix radiation message when removing radiation effects. + if (isHealing) { + // You feel better. + messageListItem.num = 3003; + } + if (messageListGetItem(&gMiscMessageList, &messageListItem)) { displayMonitorAddMessage(messageListItem.text); } @@ -579,15 +586,18 @@ void _process_rads(Object* obj, int radiationLevel, bool isHealing) critterSetBonusStat(obj, gRadiationEffectStats[effect], value); } - if ((obj->data.critter.combat.results & DAM_DEAD) == 0) { - // Loop thru effects affecting primary stats. If any of the primary stat - // dropped below minimal value, kill it. - for (int effect = 0; effect < RADIATION_EFFECT_PRIMARY_STAT_COUNT; effect++) { - int base = critterGetBaseStatWithTraitModifier(obj, gRadiationEffectStats[effect]); - int bonus = critterGetBonusStat(obj, gRadiationEffectStats[effect]); - if (base + bonus < PRIMARY_STAT_MIN) { - critterKill(obj, -1, 1); - break; + // SFALL: Prevent death when removing radiation effects. + if (!isHealing) { + if ((obj->data.critter.combat.results & DAM_DEAD) == 0) { + // Loop thru effects affecting primary stats. If any of the primary stat + // dropped below minimal value, kill it. + for (int effect = 0; effect < RADIATION_EFFECT_PRIMARY_STAT_COUNT; effect++) { + int base = critterGetBaseStatWithTraitModifier(obj, gRadiationEffectStats[effect]); + int bonus = critterGetBonusStat(obj, gRadiationEffectStats[effect]); + if (base + bonus < PRIMARY_STAT_MIN) { + critterKill(obj, -1, 1); + break; + } } } }