Formatting: NPC::ModifyStatsOnCharm

This commit is contained in:
Akkadius 2019-09-01 16:07:48 -05:00
parent 5c14bc92bd
commit 5381dcead1
2 changed files with 44 additions and 26 deletions

View File

@ -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();

View File

@ -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; }