mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 13:28:25 +00:00
Implement NPC Charm Stats
These combat stats an NPC will change to while charmed
This commit is contained in:
@@ -208,6 +208,24 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, const glm::vec4& position, int if
|
||||
avoidance_rating = d->avoidance_rating;
|
||||
ATK = d->ATK;
|
||||
|
||||
// used for when switch back to charm
|
||||
default_ac = d->AC;
|
||||
default_min_dmg = min_dmg;
|
||||
default_max_dmg = max_dmg;
|
||||
default_attack_delay = d->attack_delay;
|
||||
default_accuracy_rating = d->accuracy_rating;
|
||||
default_avoidance_rating = d->avoidance_rating;
|
||||
default_atk = d->ATK;
|
||||
|
||||
// used for when getting charmed, if 0, doesn't swap
|
||||
charm_ac = d->charm_ac;
|
||||
charm_min_dmg = d->charm_min_dmg;
|
||||
charm_max_dmg = d->charm_max_dmg;
|
||||
charm_attack_delay = d->charm_attack_delay;
|
||||
charm_accuracy_rating = d->charm_accuracy_rating;
|
||||
charm_avoidance_rating = d->charm_avoidance_rating;
|
||||
charm_atk = d->charm_atk;
|
||||
|
||||
CalcMaxMana();
|
||||
SetMana(GetMaxMana());
|
||||
|
||||
@@ -2636,3 +2654,42 @@ void NPC::DepopSwarmPets()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NPC::ModifyStatsOnCharm(bool bRemoved)
|
||||
{
|
||||
if (bRemoved) {
|
||||
if (charm_ac)
|
||||
AC = default_ac;
|
||||
if (charm_attack_delay)
|
||||
attack_delay = default_attack_delay;
|
||||
if (charm_accuracy_rating)
|
||||
accuracy_rating = default_accuracy_rating;
|
||||
if (charm_avoidance_rating)
|
||||
avoidance_rating = default_avoidance_rating;
|
||||
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);
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
// the rest of the stats aren't cached, so lets just do these two instead of full CalcBonuses()
|
||||
SetAttackTimer();
|
||||
CalcAC();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user