diff --git a/zone/npc.cpp b/zone/npc.cpp index f67dc5581..759d6ffe0 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -2839,43 +2839,61 @@ void NPC::DepopSwarmPets() } } -void NPC::ModifyStatsOnCharm(bool bRemoved) +void NPC::ModifyStatsOnCharm(bool is_charm_removed) { - if (bRemoved) { - if (charm_ac) + if (is_charm_removed) { + if (charm_ac) { AC = default_ac; - if (charm_attack_delay) + } + if (charm_attack_delay) { attack_delay = default_attack_delay; - if (charm_accuracy_rating) + } + if (charm_accuracy_rating) { accuracy_rating = default_accuracy_rating; - if (charm_avoidance_rating) + } + if (charm_avoidance_rating) { avoidance_rating = default_avoidance_rating; - if (charm_atk) + } + if (charm_atk) { ATK = default_atk; + } if (charm_min_dmg || charm_max_dmg) { base_damage = round((default_max_dmg - default_min_dmg) / 1.9); - min_damage = default_min_dmg - round(base_damage / 10.0); + min_damage = default_min_dmg - round(base_damage / 10.0); } - if (RuleB(Spells, CharmDisablesSpecialAbilities)) + if (RuleB(Spells, CharmDisablesSpecialAbilities)) { ProcessSpecialAbilities(default_special_abilities); - } else { - if (charm_ac) - AC = charm_ac; - if (charm_attack_delay) - attack_delay = charm_attack_delay; - if (charm_accuracy_rating) - accuracy_rating = charm_accuracy_rating; - if (charm_avoidance_rating) - avoidance_rating = charm_avoidance_rating; - if (charm_atk) - ATK = charm_atk; - if (charm_min_dmg || charm_max_dmg) { - base_damage = round((charm_max_dmg - charm_min_dmg) / 1.9); - min_damage = charm_min_dmg - round(base_damage / 10.0); } - if (RuleB(Spells, CharmDisablesSpecialAbilities)) - ClearSpecialAbilities(); + + SetAttackTimer(); + CalcAC(); + + return; } + + if (charm_ac) { + AC = charm_ac; + } + if (charm_attack_delay) { + attack_delay = charm_attack_delay; + } + if (charm_accuracy_rating) { + accuracy_rating = charm_accuracy_rating; + } + if (charm_avoidance_rating) { + avoidance_rating = charm_avoidance_rating; + } + if (charm_atk) { + ATK = charm_atk; + } + if (charm_min_dmg || charm_max_dmg) { + base_damage = round((charm_max_dmg - charm_min_dmg) / 1.9); + min_damage = charm_min_dmg - round(base_damage / 10.0); + } + if (RuleB(Spells, CharmDisablesSpecialAbilities)) { + ClearSpecialAbilities(); + } + // the rest of the stats aren't cached, so lets just do these two instead of full CalcBonuses() SetAttackTimer(); CalcAC(); diff --git a/zone/npc.h b/zone/npc.h index af9855103..5d7a7bd73 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -294,7 +294,7 @@ public: int32 GetNPCHPRegen() const { return hp_regen + itembonuses.HPRegen + spellbonuses.HPRegen; } inline const char* GetAmmoIDfile() const { return ammo_idfile; } - void ModifyStatsOnCharm(bool bRemoved); + void ModifyStatsOnCharm(bool is_charm_removed); //waypoint crap int GetMaxWp() const { return max_wp; }