More scanning changes around AE cast

This commit is contained in:
Akkadius 2019-12-28 23:58:18 -06:00
parent b11528fbcc
commit 9481e9eb2d
7 changed files with 91 additions and 41 deletions

View File

@ -110,6 +110,7 @@ namespace Logs {
AIScanClose, AIScanClose,
AIYellForHelp, AIYellForHelp,
AICastBeneficialClose, AICastBeneficialClose,
AoeCast,
MaxCategoryID /* Don't Remove this */ MaxCategoryID /* Don't Remove this */
}; };
@ -179,6 +180,7 @@ namespace Logs {
"AI Scan Close", "AI Scan Close",
"AI Yell For Help", "AI Yell For Help",
"AI Cast Beneficial Close", "AI Cast Beneficial Close",
"AOE Cast",
}; };
} }

View File

@ -521,6 +521,16 @@
OutF(LogSys, Logs::Detail, Logs::AICastBeneficialClose, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\ OutF(LogSys, Logs::Detail, Logs::AICastBeneficialClose, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0) } while (0)
#define LogAoeCast(message, ...) do {\
if (LogSys.log_settings[Logs::AoeCast].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::AoeCast, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogAoeCastDetail(message, ...) do {\
if (LogSys.log_settings[Logs::AoeCast].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::AoeCast, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\ #define Log(debug_level, log_category, message, ...) do {\
if (LogSys.log_settings[log_category].is_category_enabled == 1)\ if (LogSys.log_settings[log_category].is_category_enabled == 1)\
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\ LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\

View File

@ -568,7 +568,7 @@ RULE_INT(Range, ClientPositionUpdates, 300, "")
RULE_INT(Range, ClientForceSpawnUpdateRange, 1000, "") RULE_INT(Range, ClientForceSpawnUpdateRange, 1000, "")
RULE_INT(Range, CriticalDamage, 80, "") RULE_INT(Range, CriticalDamage, 80, "")
RULE_INT(Range, ClientNPCScan, 300, "") RULE_INT(Range, ClientNPCScan, 300, "")
RULE_INT(Range, MobCloseScanDistance, 300, "") RULE_INT(Range, MobCloseScanDistance, 600, "")
RULE_CATEGORY_END() RULE_CATEGORY_END()

View File

@ -850,11 +850,12 @@ int Mob::ACSum()
auto over_cap = ac - softcap; auto over_cap = ac - softcap;
ac = softcap + (over_cap * returns); ac = softcap + (over_cap * returns);
} }
LogCombat("ACSum ac [{}] softcap [{}] returns [{}]", ac, softcap, returns); LogCombatDetail("ACSum ac [{}] softcap [{}] returns [{}]", ac, softcap, returns);
} }
else { else {
LogCombat("ACSum ac [{}]", ac); LogCombatDetail("ACSum ac [{}]", ac);
} }
return ac; return ac;
} }
@ -2153,8 +2154,6 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQEmu::skills::Skil
LogCombat("Fatal blow dealt by [{}] with [{}] damage, spell [{}], skill [{}]", LogCombat("Fatal blow dealt by [{}] with [{}] damage, spell [{}], skill [{}]",
((killer_mob) ? (killer_mob->GetName()) : ("[nullptr]")), damage, spell, attack_skill); ((killer_mob) ? (killer_mob->GetName()) : ("[nullptr]")), damage, spell, attack_skill);
entity_list.RemoveMobFromCloseLists(CastToMob());
Mob *oos = nullptr; Mob *oos = nullptr;
if (killer_mob) { if (killer_mob) {
oos = killer_mob->GetOwnerOrSelf(); oos = killer_mob->GetOwnerOrSelf();

View File

@ -748,6 +748,17 @@ void EntityList::AESpell(
int target_hit_counter = 0; int target_hit_counter = 0;
float distance_to_target = 0; float distance_to_target = 0;
float distance = caster_mob->GetAOERange(spell_id);
LogAoeCast(
"Close scan distance [{}] cast distance [{}]",
RuleI(Range, MobCloseScanDistance),
distance
);
if (distance <= RuleI(Range, MobCloseScanDistance)) {
LogAoeCast("Using close scan mob list");
for (auto &it : caster_mob->close_mobs) { for (auto &it : caster_mob->close_mobs) {
current_mob = it.first; current_mob = it.first;
@ -756,7 +767,7 @@ void EntityList::AESpell(
continue; continue;
} }
LogDebug("iterating [{}]", current_mob->GetCleanName()); LogAoeCast("Checking against close scan mob [{}]", current_mob->GetCleanName());
if (!AESpellFilterCriteria( if (!AESpellFilterCriteria(
current_mob, current_mob,
@ -777,8 +788,37 @@ void EntityList::AESpell(
current_mob->CalcSpellPowerDistanceMod(spell_id, distance_to_target); current_mob->CalcSpellPowerDistanceMod(spell_id, distance_to_target);
caster_mob->SpellOnTarget(spell_id, current_mob, false, true, resist_adjust); caster_mob->SpellOnTarget(spell_id, current_mob, false, true, resist_adjust);
} }
} else {
LogDebug("Done iterating [{}]", caster_mob->GetCleanName()); LogAoeCast("Using full entity mob list");
for (auto &it : mob_list) {
current_mob = it.second;
LogAoeCast("Checking against full zone scan mob [{}]", current_mob->GetCleanName());
if (!AESpellFilterCriteria(
current_mob,
caster_mob,
center_mob,
spell_id,
max_targets,
max_targets_allowed,
target_hit_counter,
distance_to_target,
cast_target_position,
affect_caster,
resist_adjust
)) {
continue;
}
current_mob->CalcSpellPowerDistanceMod(spell_id, distance_to_target);
caster_mob->SpellOnTarget(spell_id, current_mob, false, true, resist_adjust);
}
}
LogAoeCast("Done iterating [{}]", caster_mob->GetCleanName());
if (max_targets && max_targets_allowed) { if (max_targets && max_targets_allowed) {
*max_targets = *max_targets - target_hit_counter; *max_targets = *max_targets - target_hit_counter;

View File

@ -2498,9 +2498,6 @@ bool EntityList::RemoveMob(uint16 delete_id)
auto it = mob_list.find(delete_id); auto it = mob_list.find(delete_id);
if (it != mob_list.end()) { if (it != mob_list.end()) {
RemoveMobFromCloseLists(it->second);
if (npc_list.count(delete_id)) { if (npc_list.count(delete_id)) {
entity_list.RemoveNPC(delete_id); entity_list.RemoveNPC(delete_id);
} }
@ -2530,8 +2527,6 @@ bool EntityList::RemoveMob(Mob *delete_mob)
auto it = mob_list.begin(); auto it = mob_list.begin();
while (it != mob_list.end()) { while (it != mob_list.end()) {
if (it->second == delete_mob) { if (it->second == delete_mob) {
RemoveMobFromCloseLists(it->second);
safe_delete(it->second); safe_delete(it->second);
if (!corpse_list.count(it->first)) { if (!corpse_list.count(it->first)) {
free_ids.push(it->first); free_ids.push(it->first);
@ -2554,7 +2549,6 @@ bool EntityList::RemoveNPC(uint16 delete_id)
if (it != npc_list.end()) { if (it != npc_list.end()) {
NPC *npc = it->second; NPC *npc = it->second;
RemoveProximity(delete_id); RemoveProximity(delete_id);
RemoveMobFromCloseLists(npc->CastToMob());
npc_list.erase(it); npc_list.erase(it);
if (npc_limit_list.count(delete_id)) { if (npc_limit_list.count(delete_id)) {

View File

@ -467,17 +467,20 @@ Mob::~Mob()
AI_Stop(); AI_Stop();
if (GetPet()) { if (GetPet()) {
if (GetPet()->Charmed()) if (GetPet()->Charmed()) {
GetPet()->BuffFadeByEffect(SE_Charm); GetPet()->BuffFadeByEffect(SE_Charm);
else }
else {
SetPet(0); SetPet(0);
} }
}
EQApplicationPacket app; EQApplicationPacket app;
CreateDespawnPacket(&app, !IsCorpse()); CreateDespawnPacket(&app, !IsCorpse());
Corpse *corpse = entity_list.GetCorpseByID(GetID()); Corpse *corpse = entity_list.GetCorpseByID(GetID());
if(!corpse || (corpse && !corpse->IsPlayerCorpse())) if (!corpse || (corpse && !corpse->IsPlayerCorpse())) {
entity_list.QueueClients(this, &app, true); entity_list.QueueClients(this, &app, true);
}
entity_list.RemoveFromTargets(this, true); entity_list.RemoveFromTargets(this, true);
@ -496,6 +499,8 @@ Mob::~Mob()
entity_list.UnMarkNPC(GetID()); entity_list.UnMarkNPC(GetID());
UninitializeBuffSlots(); UninitializeBuffSlots();
entity_list.RemoveMobFromCloseLists(this);
#ifdef BOTS #ifdef BOTS
LeaveHealRotationTargetPool(); LeaveHealRotationTargetPool();
#endif #endif