mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-30 17:58:16 +00:00
[Cleanup] Cleanup Special Ability Code (#4365)
* [Cleanup] Cleanup Special Ability-based Code * Update emu_constants.cpp * Update emu_constants.cpp * Update emu_constants.cpp * Update special_ability.cpp * Cleanup * Update emu_constants.cpp
This commit is contained in:
+43
-43
@@ -570,7 +570,7 @@ void Mob::AI_ShutDown() {
|
||||
viral_timer.Disable();
|
||||
flee_timer.Disable();
|
||||
|
||||
for (int sat = 0; sat < MAX_SPECIAL_ATTACK; ++sat) {
|
||||
for (int sat = 0; sat < SpecialAbility::Max; ++sat) {
|
||||
if (SpecialAbilities[sat].timer)
|
||||
SpecialAbilities[sat].timer->Disable();
|
||||
}
|
||||
@@ -1062,7 +1062,7 @@ void Mob::AI_Process() {
|
||||
}
|
||||
// we are prevented from getting here if we are blind and don't have a target in range
|
||||
// from above, so no extra blind checks needed
|
||||
if ((IsRooted() && !GetSpecialAbility(IGNORE_ROOT_AGGRO_RULES)) || IsBlind())
|
||||
if ((IsRooted() && !GetSpecialAbility(SpecialAbility::IgnoreRootAggroRules)) || IsBlind())
|
||||
SetTarget(hate_list.GetClosestEntOnHateList(this));
|
||||
else {
|
||||
if (AI_target_check_timer->Check()) {
|
||||
@@ -1125,16 +1125,16 @@ void Mob::AI_Process() {
|
||||
}
|
||||
|
||||
auto npcSpawnPoint = CastToNPC()->GetSpawnPoint();
|
||||
if (GetSpecialAbility(TETHER)) {
|
||||
float tether_range = static_cast<float>(GetSpecialAbilityParam(TETHER, 0));
|
||||
if (GetSpecialAbility(SpecialAbility::Tether)) {
|
||||
float tether_range = static_cast<float>(GetSpecialAbilityParam(SpecialAbility::Tether, 0));
|
||||
tether_range = tether_range > 0.0f ? tether_range * tether_range : pAggroRange * pAggroRange;
|
||||
|
||||
if (DistanceSquaredNoZ(m_Position, npcSpawnPoint) > tether_range) {
|
||||
GMMove(npcSpawnPoint.x, npcSpawnPoint.y, npcSpawnPoint.z, npcSpawnPoint.w);
|
||||
}
|
||||
}
|
||||
else if (GetSpecialAbility(LEASH)) {
|
||||
float leash_range = static_cast<float>(GetSpecialAbilityParam(LEASH, 0));
|
||||
else if (GetSpecialAbility(SpecialAbility::Leash)) {
|
||||
float leash_range = static_cast<float>(GetSpecialAbilityParam(SpecialAbility::Leash, 0));
|
||||
leash_range = leash_range > 0.0f ? leash_range * leash_range : pAggroRange * pAggroRange;
|
||||
|
||||
if (DistanceSquaredNoZ(m_Position, npcSpawnPoint) > leash_range) {
|
||||
@@ -1169,33 +1169,33 @@ void Mob::AI_Process() {
|
||||
TriggerDefensiveProcs(target, EQ::invslot::slotPrimary, false);
|
||||
|
||||
bool specialed = false; // NPCs can only do one of these a round
|
||||
if (GetSpecialAbility(SPECATK_FLURRY)) {
|
||||
int flurry_chance = GetSpecialAbilityParam(SPECATK_FLURRY, 0);
|
||||
if (GetSpecialAbility(SpecialAbility::Flurry)) {
|
||||
int flurry_chance = GetSpecialAbilityParam(SpecialAbility::Flurry, 0);
|
||||
flurry_chance = flurry_chance > 0 ? flurry_chance : RuleI(Combat, NPCFlurryChance);
|
||||
|
||||
if (zone->random.Roll(flurry_chance)) {
|
||||
ExtraAttackOptions opts;
|
||||
int cur = GetSpecialAbilityParam(SPECATK_FLURRY, 2);
|
||||
int cur = GetSpecialAbilityParam(SpecialAbility::Flurry, 2);
|
||||
if (cur > 0)
|
||||
opts.damage_percent = cur / 100.0f;
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_FLURRY, 3);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::Flurry, 3);
|
||||
if (cur > 0)
|
||||
opts.damage_flat = cur;
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_FLURRY, 4);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::Flurry, 4);
|
||||
if (cur > 0)
|
||||
opts.armor_pen_percent = cur / 100.0f;
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_FLURRY, 5);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::Flurry, 5);
|
||||
if (cur > 0)
|
||||
opts.armor_pen_flat = cur;
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_FLURRY, 6);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::Flurry, 6);
|
||||
if (cur > 0)
|
||||
opts.crit_percent = cur / 100.0f;
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_FLURRY, 7);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::Flurry, 7);
|
||||
if (cur > 0)
|
||||
opts.crit_flat = cur;
|
||||
|
||||
@@ -1227,32 +1227,32 @@ void Mob::AI_Process() {
|
||||
}
|
||||
|
||||
|
||||
if (GetSpecialAbility(SPECATK_RAMPAGE) && !specialed) {
|
||||
int rampage_chance = GetSpecialAbilityParam(SPECATK_RAMPAGE, 0);
|
||||
if (GetSpecialAbility(SpecialAbility::Rampage) && !specialed) {
|
||||
int rampage_chance = GetSpecialAbilityParam(SpecialAbility::Rampage, 0);
|
||||
rampage_chance = rampage_chance > 0 ? rampage_chance : 20;
|
||||
if (zone->random.Roll(rampage_chance)) {
|
||||
ExtraAttackOptions opts;
|
||||
int cur = GetSpecialAbilityParam(SPECATK_RAMPAGE, 3);
|
||||
int cur = GetSpecialAbilityParam(SpecialAbility::Rampage, 3);
|
||||
if (cur > 0) {
|
||||
opts.damage_flat = cur;
|
||||
}
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_RAMPAGE, 4);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::Rampage, 4);
|
||||
if (cur > 0) {
|
||||
opts.armor_pen_percent = cur / 100.0f;
|
||||
}
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_RAMPAGE, 5);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::Rampage, 5);
|
||||
if (cur > 0) {
|
||||
opts.armor_pen_flat = cur;
|
||||
}
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_RAMPAGE, 6);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::Rampage, 6);
|
||||
if (cur > 0) {
|
||||
opts.crit_percent = cur / 100.0f;
|
||||
}
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_RAMPAGE, 7);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::Rampage, 7);
|
||||
if (cur > 0) {
|
||||
opts.crit_flat = cur;
|
||||
}
|
||||
@@ -1269,37 +1269,37 @@ void Mob::AI_Process() {
|
||||
}
|
||||
}
|
||||
|
||||
if (GetSpecialAbility(SPECATK_AREA_RAMPAGE) && !specialed) {
|
||||
int rampage_chance = GetSpecialAbilityParam(SPECATK_AREA_RAMPAGE, 0);
|
||||
if (GetSpecialAbility(SpecialAbility::AreaRampage) && !specialed) {
|
||||
int rampage_chance = GetSpecialAbilityParam(SpecialAbility::AreaRampage, 0);
|
||||
rampage_chance = rampage_chance > 0 ? rampage_chance : 20;
|
||||
if (zone->random.Roll(rampage_chance)) {
|
||||
ExtraAttackOptions opts;
|
||||
int cur = GetSpecialAbilityParam(SPECATK_AREA_RAMPAGE, 3);
|
||||
int cur = GetSpecialAbilityParam(SpecialAbility::AreaRampage, 3);
|
||||
if (cur > 0) {
|
||||
opts.damage_flat = cur;
|
||||
}
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_AREA_RAMPAGE, 4);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::AreaRampage, 4);
|
||||
if (cur > 0) {
|
||||
opts.armor_pen_percent = cur / 100.0f;
|
||||
}
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_AREA_RAMPAGE, 5);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::AreaRampage, 5);
|
||||
if (cur > 0) {
|
||||
opts.armor_pen_flat = cur;
|
||||
}
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_AREA_RAMPAGE, 6);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::AreaRampage, 6);
|
||||
if (cur > 0) {
|
||||
opts.crit_percent = cur / 100.0f;
|
||||
}
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_AREA_RAMPAGE, 7);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::AreaRampage, 7);
|
||||
if (cur > 0) {
|
||||
opts.crit_flat = cur;
|
||||
}
|
||||
|
||||
cur = GetSpecialAbilityParam(SPECATK_AREA_RAMPAGE, 8);
|
||||
cur = GetSpecialAbilityParam(SpecialAbility::AreaRampage, 8);
|
||||
if (cur > 0) {
|
||||
opts.range_percent = cur;
|
||||
}
|
||||
@@ -1328,7 +1328,7 @@ void Mob::AI_Process() {
|
||||
if (!HateSummon()) {
|
||||
|
||||
//could not summon them, check ranged...
|
||||
if (GetSpecialAbility(SPECATK_RANGED_ATK) || HasBowAndArrowEquipped()) {
|
||||
if (GetSpecialAbility(SpecialAbility::RangedAttack) || HasBowAndArrowEquipped()) {
|
||||
doranged = true;
|
||||
}
|
||||
|
||||
@@ -1961,10 +1961,10 @@ void Mob::StartEnrage()
|
||||
if (bEnraged)
|
||||
return;
|
||||
|
||||
if(!GetSpecialAbility(SPECATK_ENRAGE))
|
||||
if(!GetSpecialAbility(SpecialAbility::Enrage))
|
||||
return;
|
||||
|
||||
int hp_ratio = GetSpecialAbilityParam(SPECATK_ENRAGE, 0);
|
||||
int hp_ratio = GetSpecialAbilityParam(SpecialAbility::Enrage, 0);
|
||||
hp_ratio = hp_ratio > 0 ? hp_ratio : RuleI(NPC, StartEnrageValue);
|
||||
if(GetHPRatio() > static_cast<float>(hp_ratio)) {
|
||||
return;
|
||||
@@ -1975,13 +1975,13 @@ void Mob::StartEnrage()
|
||||
return;
|
||||
}
|
||||
|
||||
Timer *timer = GetSpecialAbilityTimer(SPECATK_ENRAGE);
|
||||
Timer *timer = GetSpecialAbilityTimer(SpecialAbility::Enrage);
|
||||
if (timer && !timer->Check())
|
||||
return;
|
||||
|
||||
int enraged_duration = GetSpecialAbilityParam(SPECATK_ENRAGE, 1);
|
||||
int enraged_duration = GetSpecialAbilityParam(SpecialAbility::Enrage, 1);
|
||||
enraged_duration = enraged_duration > 0 ? enraged_duration : EnragedDurationTimer;
|
||||
StartSpecialAbilityTimer(SPECATK_ENRAGE, enraged_duration);
|
||||
StartSpecialAbilityTimer(SpecialAbility::Enrage, enraged_duration);
|
||||
|
||||
// start the timer. need to call IsEnraged frequently since we dont have callback timers :-/
|
||||
bEnraged = true;
|
||||
@@ -1990,13 +1990,13 @@ void Mob::StartEnrage()
|
||||
|
||||
void Mob::ProcessEnrage(){
|
||||
if(IsEnraged()){
|
||||
Timer *timer = GetSpecialAbilityTimer(SPECATK_ENRAGE);
|
||||
Timer *timer = GetSpecialAbilityTimer(SpecialAbility::Enrage);
|
||||
if(timer && timer->Check()){
|
||||
entity_list.MessageCloseString(this, true, 200, Chat::NPCEnrage, NPC_ENRAGE_END, GetCleanName());
|
||||
|
||||
int enraged_cooldown = GetSpecialAbilityParam(SPECATK_ENRAGE, 2);
|
||||
int enraged_cooldown = GetSpecialAbilityParam(SpecialAbility::Enrage, 2);
|
||||
enraged_cooldown = enraged_cooldown > 0 ? enraged_cooldown : EnragedTimer;
|
||||
StartSpecialAbilityTimer(SPECATK_ENRAGE, enraged_cooldown);
|
||||
StartSpecialAbilityTimer(SpecialAbility::Enrage, enraged_cooldown);
|
||||
bEnraged = false;
|
||||
}
|
||||
}
|
||||
@@ -2032,7 +2032,7 @@ bool Mob::Flurry(ExtraAttackOptions *opts)
|
||||
target->GetCleanName());
|
||||
}
|
||||
|
||||
int num_attacks = GetSpecialAbilityParam(SPECATK_FLURRY, 1);
|
||||
int num_attacks = GetSpecialAbilityParam(SpecialAbility::Flurry, 1);
|
||||
num_attacks = num_attacks > 0 ? num_attacks : RuleI(Combat, MaxFlurryHits);
|
||||
for (int i = 0; i < num_attacks; i++)
|
||||
Attack(target, EQ::invslot::slotPrimary, false, false, false, opts);
|
||||
@@ -2046,7 +2046,7 @@ bool Mob::AddRampage(Mob *mob)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GetSpecialAbility(SPECATK_RAMPAGE)) {
|
||||
if (!GetSpecialAbility(SpecialAbility::Rampage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2073,7 +2073,7 @@ void Mob::RemoveFromRampageList(Mob* mob, bool remove_feigned)
|
||||
|
||||
if (
|
||||
IsNPC() &&
|
||||
GetSpecialAbility(SPECATK_RAMPAGE) &&
|
||||
GetSpecialAbility(SpecialAbility::Rampage) &&
|
||||
(
|
||||
remove_feigned ||
|
||||
mob->IsNPC() ||
|
||||
@@ -2100,7 +2100,7 @@ bool Mob::Rampage(ExtraAttackOptions *opts)
|
||||
entity_list.MessageCloseString(this, true, 200, Chat::NPCRampage, NPC_RAMPAGE, GetCleanName());
|
||||
}
|
||||
|
||||
int rampage_targets = GetSpecialAbilityParam(SPECATK_RAMPAGE, 1);
|
||||
int rampage_targets = GetSpecialAbilityParam(SpecialAbility::Rampage, 1);
|
||||
|
||||
if (rampage_targets == 0) { // if set to 0 or not set in the DB
|
||||
rampage_targets = RuleI(Combat, DefaultRampageTargets);
|
||||
@@ -2173,7 +2173,7 @@ void Mob::AreaRampage(ExtraAttackOptions *opts)
|
||||
entity_list.MessageCloseString(this, true, 200, Chat::NPCRampage, AE_RAMPAGE, GetCleanName());
|
||||
}
|
||||
|
||||
int rampage_targets = GetSpecialAbilityParam(SPECATK_AREA_RAMPAGE, 1);
|
||||
int rampage_targets = GetSpecialAbilityParam(SpecialAbility::AreaRampage, 1);
|
||||
rampage_targets = rampage_targets > 0 ? rampage_targets : -1;
|
||||
m_specialattacks = eSpecialAttacks::AERampage;
|
||||
index_hit = hate_list.AreaRampage(this, GetTarget(), rampage_targets, opts);
|
||||
|
||||
Reference in New Issue
Block a user