Mobs cast root on random person on hatelist

This commit is contained in:
Michael Cook (mackal) 2014-02-24 00:37:38 -05:00
parent 6b94e08404
commit 837c02ffd6

View File

@ -125,20 +125,19 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
break; break;
} }
case SpellType_Root: { case SpellType_Root: {
if ( Mob *rootee = GetHateRandom();
!tar->IsRooted() if (rootee && !rootee->IsRooted() && MakeRandomInt(0, 99) < 50
&& MakeRandomInt(0, 99) < 50 && rootee->DontRootMeBefore() < Timer::GetCurrentTime()
&& tar->DontRootMeBefore() < Timer::GetCurrentTime() && rootee->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0
&& tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0
) { ) {
if(!checked_los) { 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 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; checked_los = true;
} }
uint32 tempTime = 0; uint32 tempTime = 0;
AIDoSpellCast(i, tar, mana_cost, &tempTime); AIDoSpellCast(i, rootee, mana_cost, &tempTime);
tar->SetDontRootMeBefore(tempTime); rootee->SetDontRootMeBefore(tempTime);
return true; return true;
} }
break; break;