From 03dbe47546c0ddfbaf7b04c3f5e281386d899f3d Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 30 Jan 2018 13:16:25 -0500 Subject: [PATCH] Skip distance check in mob spell AI for some target types This should be good enough for now, some of the hatelist spells use 0 ranges for some reason :P The client checks only a few target types for distance, we should probably just match that eventually --- zone/mob_ai.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 8bbfce4e9..bda34da46 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -98,13 +98,17 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates mana_cost = spells[AIspells[i].spellid].mana; else if (mana_cost == -2) mana_cost = 0; + // this is ugly -- ignore distance for hatelist spells, looks like the client is only checking distance for some targettypes in CastSpell, + // should probably match that eventually. This should be good enough for now I guess .... if ( - (( - (spells[AIspells[i].spellid].targettype==ST_AECaster || spells[AIspells[i].spellid].targettype==ST_AEBard) - && dist2 <= spells[AIspells[i].spellid].aoerange*spells[AIspells[i].spellid].aoerange - ) || - dist2 <= spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range - ) + ( + (spells[AIspells[i].spellid].targettype == ST_HateList || spells[AIspells[i].spellid].targettype == ST_AETargetHateList) || + ( + (spells[AIspells[i].spellid].targettype==ST_AECaster || spells[AIspells[i].spellid].targettype==ST_AEBard) + && dist2 <= spells[AIspells[i].spellid].aoerange*spells[AIspells[i].spellid].aoerange + ) || + dist2 <= spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range + ) && (mana_cost <= GetMana() || GetMana() == GetMaxMana()) && (AIspells[i].time_cancast + (zone->random.Int(0, 4) * 500)) <= Timer::GetCurrentTime() //break up the spelling casting over a period of time. ) {