From 837c02ffd6ec5d0b5776910a4535ac1ad1c49c2f Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 24 Feb 2014 00:37:38 -0500 Subject: [PATCH] Mobs cast root on random person on hatelist --- zone/MobAI.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/zone/MobAI.cpp b/zone/MobAI.cpp index c6584db5e..b14276313 100644 --- a/zone/MobAI.cpp +++ b/zone/MobAI.cpp @@ -125,20 +125,19 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { break; } case SpellType_Root: { - if ( - !tar->IsRooted() - && MakeRandomInt(0, 99) < 50 - && tar->DontRootMeBefore() < Timer::GetCurrentTime() - && tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0 + Mob *rootee = GetHateRandom(); + if (rootee && !rootee->IsRooted() && MakeRandomInt(0, 99) < 50 + && rootee->DontRootMeBefore() < Timer::GetCurrentTime() + && rootee->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0 ) { if(!checked_los) { - if(!CheckLosFN(tar)) + if(!CheckLosFN(rootee)) return(false); //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call checked_los = true; } uint32 tempTime = 0; - AIDoSpellCast(i, tar, mana_cost, &tempTime); - tar->SetDontRootMeBefore(tempTime); + AIDoSpellCast(i, rootee, mana_cost, &tempTime); + rootee->SetDontRootMeBefore(tempTime); return true; } break;