From 263ed3913b94aebfc9ac6ce959e43c469bf3b959 Mon Sep 17 00:00:00 2001 From: = <=isaacseniorx@gmail.com> Date: Wed, 6 May 2020 02:44:17 +0000 Subject: [PATCH] Don't scale 0 values --- zone/npc.cpp | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index 39b1b046b..edc9f88c3 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -2443,18 +2443,27 @@ void NPC::LevelScale() { if (RuleB(NPC, NewLevelScaling)) { if (scalerate == 0 || maxlevel <= 25) { - // pre-pop seems to scale by 20 HP increments while newer by 100 - // We also don't want 100 increments on newer noobie zones, check level - if (zone->GetZoneID() < 200 || level < 48) { - max_hp += (random_level - level) * 20; - base_hp += (random_level - level) * 20; - } else { - max_hp += (random_level - level) * 100; - base_hp += (random_level - level) * 100; + // Don't add HP to dynamically scaled NPCs since this will be calculated later + if (max_hp > 0 || skip_auto_scale) + { + // pre-pop seems to scale by 20 HP increments while newer by 100 + // We also don't want 100 increments on newer noobie zones, check level + if (zone->GetZoneID() < 200 || level < 48) { + max_hp += (random_level - level) * 20; + base_hp += (random_level - level) * 20; + } else { + max_hp += (random_level - level) * 100; + base_hp += (random_level - level) * 100; + } + + current_hp = max_hp; + } + + // Don't add max_dmg to dynamically scaled NPCs since this will be calculated later + if (max_dmg > 0 || skip_auto_scale) + { + max_dmg += (random_level - level) * 2; } - - current_hp = max_hp; - max_dmg += (random_level - level) * 2; } else { uint8 scale_adjust = 1;