From 40ebee9ff4482c5572f176857b216fc03583d940 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 13 Jan 2018 22:14:21 -0600 Subject: [PATCH] Noudess: This makes newly spawned NPCs have a chance to cast --- zone/mob_ai.cpp | 6 ++++++ zone/npc.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index d331ee7a0..a05aa1343 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1762,6 +1762,12 @@ void Mob::AI_Event_Engaged(Mob* attacker, bool iYellForHelp) { SetAppearance(eaStanding); + /* + Kick off auto cast timer + */ + if (this->IsNPC()) + this->CastToNPC()->AIautocastspell_timer->Start(300, false); + if (iYellForHelp) { if(IsPet()) { GetOwner()->AI_Event_Engaged(attacker, iYellForHelp); diff --git a/zone/npc.h b/zone/npc.h index c973eb79d..4c67dd1d2 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -420,6 +420,8 @@ public: bool IgnoreDespawn() { return ignore_despawn; } + std::unique_ptr AIautocastspell_timer; + protected: const NPCType* NPCTypedata; @@ -453,7 +455,7 @@ protected: uint32 npc_spells_id; uint8 casting_spell_AIindex; - std::unique_ptr AIautocastspell_timer; + uint32* pDontCastBefore_casting_spell; std::vector AIspells; bool HasAISpell;