Code edits to the previous commit

This commit is contained in:
NovaRain
2022-05-20 15:33:47 +08:00
parent 8ce87a3088
commit c0bee95aa4
+5 -4
View File
@@ -201,15 +201,16 @@ void Stats::UpdateHPStat(fo::GameObject* critter) {
if (calcStatValue < statFormulas[fo::Stat::STAT_max_hit_points].min) calcStatValue = statFormulas[fo::Stat::STAT_max_hit_points].min; if (calcStatValue < statFormulas[fo::Stat::STAT_max_hit_points].min) calcStatValue = statFormulas[fo::Stat::STAT_max_hit_points].min;
if (proto->critter.base.health != calcStatValue) { if (proto->critter.base.health != calcStatValue) {
fo::func::debug_printf("\nWarning: critter PID: %d, ID: %d, has an incorrect base value of the max HP stat: %d (must be %d)", fo::func::debug_printf("\nWarning: %s (PID: %d, ID: %d) has an incorrect base value of the max HP stat: %d, adjusted to %d.",
critter->protoId, critter->id, proto->critter.base.health, calcStatValue); fo::func::critter_name(critter), critter->protoId, critter->id, proto->critter.base.health, calcStatValue);
proto->critter.base.health = calcStatValue; proto->critter.base.health = calcStatValue;
} }
} }
// set the current HP to match the maximum HP stat for non-party member critters // set the current HP to match the max HP stat for non-party member critters
if (!fo::util::IsPartyMember(critter)) { // prevent free healing for party members when entering random encounter maps // (prevent full healing for party members when entering random encounter maps)
if (!fo::util::IsPartyMember(critter) && critter->critter.health > 0) {
critter->critter.health = proto->critter.base.health + proto->critter.bonus.health; critter->critter.health = proto->critter.base.health + proto->critter.bonus.health;
} }
} }