mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 08:17:56 +00:00
fix(Scripts/BRD): movement of Burning Spirits during Ambassador Flamelash encounter (#7810)
- Closes #6964
This commit is contained in:
@@ -172,7 +172,7 @@ public:
|
|||||||
|
|
||||||
virtual bool CanAIAttack(Unit const* /*target*/) const { return true; }
|
virtual bool CanAIAttack(Unit const* /*target*/) const { return true; }
|
||||||
virtual void AttackStart(Unit* /*target*/);
|
virtual void AttackStart(Unit* /*target*/);
|
||||||
virtual void UpdateAI(uint32 diff) = 0;
|
virtual void UpdateAI(uint32 /*diff*/) = 0;
|
||||||
|
|
||||||
virtual void InitializeAI() { if (!me->isDead()) Reset(); }
|
virtual void InitializeAI() { if (!me->isDead()) Reset(); }
|
||||||
|
|
||||||
|
|||||||
@@ -834,7 +834,7 @@ void MotionMaster::DirectDelete(_Ty curr)
|
|||||||
|
|
||||||
void MotionMaster::DelayedDelete(_Ty curr)
|
void MotionMaster::DelayedDelete(_Ty curr)
|
||||||
{
|
{
|
||||||
LOG_FATAL("movement.motionmaster", "Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType());
|
LOG_DEBUG("movement.motionmaster", "Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType());
|
||||||
if (isStatic(curr))
|
if (isStatic(curr))
|
||||||
return;
|
return;
|
||||||
if (!_expList)
|
if (!_expList)
|
||||||
|
|||||||
@@ -21,12 +21,10 @@ enum AmbassadorEvents
|
|||||||
AGGRO_TEXT = 0,
|
AGGRO_TEXT = 0,
|
||||||
EVENT_SPELL_FIREBLAST = 1,
|
EVENT_SPELL_FIREBLAST = 1,
|
||||||
EVENT_SUMMON_SPIRITS = 2,
|
EVENT_SUMMON_SPIRITS = 2,
|
||||||
EVENT_CHASE_AMBASSADOR = 3,
|
EVENT_KILL_SPIRIT = 3
|
||||||
EVENT_KILL_SPIRIT = 4,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint32 NPC_FIRE_SPIRIT = 9178;
|
const uint32 NPC_FIRE_SPIRIT = 9178;
|
||||||
const uint32 NPC_AMBASSADOR_FLAMELASHER = 9156;
|
|
||||||
|
|
||||||
const Position SummonPositions[7] =
|
const Position SummonPositions[7] =
|
||||||
{
|
{
|
||||||
@@ -173,8 +171,7 @@ public:
|
|||||||
void SummonSpirits()
|
void SummonSpirits()
|
||||||
{
|
{
|
||||||
// Make the Spirits chase Ambassador Flamelash
|
// Make the Spirits chase Ambassador Flamelash
|
||||||
if (Creature* Spirit = me->SummonCreature(NPC_FIRE_SPIRIT, SummonPositions[getValidRandomPosition()], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000))
|
me->SummonCreature(NPC_FIRE_SPIRIT, SummonPositions[getValidRandomPosition()], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60 * IN_MILLISECONDS);
|
||||||
Spirit->AI()->DoAction(EVENT_CHASE_AMBASSADOR);
|
|
||||||
_events.ScheduleEvent(EVENT_SUMMON_SPIRITS, urand(12, 14) * IN_MILLISECONDS);
|
_events.ScheduleEvent(EVENT_SUMMON_SPIRITS, urand(12, 14) * IN_MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,67 +204,45 @@ class npc_burning_spirit : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
npc_burning_spirit() : CreatureScript("npc_burning_spirit") { }
|
npc_burning_spirit() : CreatureScript("npc_burning_spirit") { }
|
||||||
|
|
||||||
|
struct npc_burning_spiritAI : public ScriptedAI
|
||||||
|
{
|
||||||
|
npc_burning_spiritAI(Creature* creature) : ScriptedAI(creature) {}
|
||||||
|
|
||||||
|
void IsSummonedBy(Unit* summoner) override
|
||||||
|
{
|
||||||
|
_flamelasherGUID = summoner->GetGUID();
|
||||||
|
me->GetMotionMaster()->MoveFollow(summoner, 0.f, 0.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnterEvadeMode() override
|
||||||
|
{
|
||||||
|
if (Creature* flamelasher = ObjectAccessor::GetCreature(*me, _flamelasherGUID))
|
||||||
|
{
|
||||||
|
me->GetMotionMaster()->MoveFollow(flamelasher, 5.f, 0.f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MovementInform(uint32 type, uint32 /*id*/) override
|
||||||
|
{
|
||||||
|
if (type != FOLLOW_MOTION_TYPE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Creature* flamelasher = ObjectAccessor::GetCreature(*me, _flamelasherGUID))
|
||||||
|
{
|
||||||
|
flamelasher->CastSpell(flamelasher, SPELL_BURNING_SPIRIT);
|
||||||
|
Unit::Kill(flamelasher, me);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
EventMap _events;
|
||||||
|
ObjectGuid _flamelasherGUID;
|
||||||
|
};
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
CreatureAI* GetAI(Creature* creature) const override
|
||||||
{
|
{
|
||||||
return GetBlackrockDepthsAI<npc_burning_spiritAI>(creature);
|
return GetBlackrockDepthsAI<npc_burning_spiritAI>(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct npc_burning_spiritAI : public CreatureAI
|
|
||||||
{
|
|
||||||
npc_burning_spiritAI(Creature* creature) : CreatureAI(creature) { }
|
|
||||||
|
|
||||||
EventMap _events;
|
|
||||||
|
|
||||||
void Reset() override
|
|
||||||
{
|
|
||||||
// TODO: Swap this with an execute event
|
|
||||||
_events.ScheduleEvent(EVENT_CHASE_AMBASSADOR, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DoAction(int32 param) override
|
|
||||||
{
|
|
||||||
switch (param)
|
|
||||||
{
|
|
||||||
case EVENT_CHASE_AMBASSADOR:
|
|
||||||
// TODO: Swap this with an execute event
|
|
||||||
_events.ScheduleEvent(EVENT_CHASE_AMBASSADOR, 0.1f * IN_MILLISECONDS);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
|
||||||
{
|
|
||||||
_events.Update(diff);
|
|
||||||
|
|
||||||
switch(_events.ExecuteEvent())
|
|
||||||
{
|
|
||||||
// Don't need to repeat this events because, once new spirits are summoned
|
|
||||||
// those new spirits will summon new spirits. If we repeated we would have
|
|
||||||
// an inmense number of spirits summoned if they were not all killed
|
|
||||||
case EVENT_CHASE_AMBASSADOR:
|
|
||||||
if (!UpdateVictim())
|
|
||||||
{
|
|
||||||
if (Creature* boss = me->FindNearestCreature(NPC_AMBASSADOR_FLAMELASHER, 5000.0f, true))
|
|
||||||
{
|
|
||||||
if (me->GetDistance(boss->GetPosition()) <= 5.0f)
|
|
||||||
{
|
|
||||||
boss->CastSpell(boss, SPELL_BURNING_SPIRIT);
|
|
||||||
boss->Kill(boss, me);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (me->IsAlive())
|
|
||||||
me->GetMotionMaster()->MoveChase(boss);
|
|
||||||
_events.ScheduleEvent(EVENT_CHASE_AMBASSADOR, 0.5f * IN_MILLISECONDS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_events.ScheduleEvent(EVENT_CHASE_AMBASSADOR, 0.5f * IN_MILLISECONDS);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
DoMeleeAttackIfReady();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_ambassador_flamelash()
|
void AddSC_boss_ambassador_flamelash()
|
||||||
|
|||||||
Reference in New Issue
Block a user