Fix radiation bugs

This commit is contained in:
Alexander Batalov 2022-08-14 17:30:45 +03:00
parent cac96bfc13
commit 330edde003
1 changed files with 19 additions and 9 deletions

View File

@ -568,6 +568,13 @@ void _process_rads(Object* obj, int radiationLevel, bool isHealing)
if (obj == gDude) { if (obj == gDude) {
// Radiation level message, higher is worse. // Radiation level message, higher is worse.
messageListItem.num = 1000 + radiationLevelIndex; messageListItem.num = 1000 + radiationLevelIndex;
// SFALL: Fix radiation message when removing radiation effects.
if (isHealing) {
// You feel better.
messageListItem.num = 3003;
}
if (messageListGetItem(&gMiscMessageList, &messageListItem)) { if (messageListGetItem(&gMiscMessageList, &messageListItem)) {
displayMonitorAddMessage(messageListItem.text); displayMonitorAddMessage(messageListItem.text);
} }
@ -579,15 +586,18 @@ void _process_rads(Object* obj, int radiationLevel, bool isHealing)
critterSetBonusStat(obj, gRadiationEffectStats[effect], value); critterSetBonusStat(obj, gRadiationEffectStats[effect], value);
} }
if ((obj->data.critter.combat.results & DAM_DEAD) == 0) { // SFALL: Prevent death when removing radiation effects.
// Loop thru effects affecting primary stats. If any of the primary stat if (!isHealing) {
// dropped below minimal value, kill it. if ((obj->data.critter.combat.results & DAM_DEAD) == 0) {
for (int effect = 0; effect < RADIATION_EFFECT_PRIMARY_STAT_COUNT; effect++) { // Loop thru effects affecting primary stats. If any of the primary stat
int base = critterGetBaseStatWithTraitModifier(obj, gRadiationEffectStats[effect]); // dropped below minimal value, kill it.
int bonus = critterGetBonusStat(obj, gRadiationEffectStats[effect]); for (int effect = 0; effect < RADIATION_EFFECT_PRIMARY_STAT_COUNT; effect++) {
if (base + bonus < PRIMARY_STAT_MIN) { int base = critterGetBaseStatWithTraitModifier(obj, gRadiationEffectStats[effect]);
critterKill(obj, -1, 1); int bonus = critterGetBonusStat(obj, gRadiationEffectStats[effect]);
break; if (base + bonus < PRIMARY_STAT_MIN) {
critterKill(obj, -1, 1);
break;
}
} }
} }
} }