Merge pull request #4981 from Souler/fix_omen
Events/Lunar Festival: Fixed behaviour of Elune's Candle, Rockets and Rocket Clusters. Implemented AI for Omen and his summoning ritual. Closes #4939
This commit is contained in:
@@ -573,9 +573,151 @@ public:
|
||||
};
|
||||
|
||||
/*####
|
||||
#
|
||||
# npc_omen
|
||||
####*/
|
||||
|
||||
enum Omen
|
||||
{
|
||||
NPC_OMEN = 15467,
|
||||
|
||||
SPELL_OMEN_CLEAVE = 15284,
|
||||
SPELL_OMEN_STARFALL = 26540,
|
||||
SPELL_OMEN_SUMMON_SPOTLIGHT = 26392,
|
||||
SPELL_ELUNE_CANDLE = 26374,
|
||||
|
||||
GO_ELUNE_TRAP_1 = 180876,
|
||||
GO_ELUNE_TRAP_2 = 180877,
|
||||
|
||||
EVENT_CAST_CLEAVE = 1,
|
||||
EVENT_CAST_STARFALL = 2,
|
||||
EVENT_DESPAWN = 3,
|
||||
};
|
||||
|
||||
class npc_omen : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_omen() : CreatureScript("npc_omen") { }
|
||||
|
||||
struct npc_omenAI : public ScriptedAI
|
||||
{
|
||||
npc_omenAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
||||
me->GetMotionMaster()->MovePoint(1, 7549.977f, -2855.137f, 456.9678f);
|
||||
}
|
||||
|
||||
EventMap events;
|
||||
|
||||
void MovementInform(uint32 type, uint32 pointId)
|
||||
{
|
||||
if (type != POINT_MOTION_TYPE)
|
||||
return;
|
||||
|
||||
if (pointId == 1)
|
||||
{
|
||||
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
||||
if (Player* player = me->SelectNearestPlayer(40.0f))
|
||||
AttackStart(player);
|
||||
}
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*attacker*/)
|
||||
{
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_CAST_CLEAVE, urand(3000, 5000));
|
||||
events.ScheduleEvent(EVENT_CAST_STARFALL, urand(8000, 10000));
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/)
|
||||
{
|
||||
DoCast(SPELL_OMEN_SUMMON_SPOTLIGHT);
|
||||
}
|
||||
|
||||
void SpellHit(Unit* /*caster*/, const SpellInfo* spell)
|
||||
{
|
||||
if (spell->Id == SPELL_ELUNE_CANDLE)
|
||||
{
|
||||
if (me->HasAura(SPELL_OMEN_STARFALL))
|
||||
me->RemoveAurasDueToSpell(SPELL_OMEN_STARFALL);
|
||||
|
||||
events.RescheduleEvent(EVENT_CAST_STARFALL, urand(14000, 16000));
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
switch (events.ExecuteEvent())
|
||||
{
|
||||
case EVENT_CAST_CLEAVE:
|
||||
DoCastVictim(SPELL_OMEN_CLEAVE);
|
||||
events.ScheduleEvent(EVENT_CAST_CLEAVE, urand(8000, 10000));
|
||||
break;
|
||||
case EVENT_CAST_STARFALL:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||
DoCast(target, SPELL_OMEN_STARFALL);
|
||||
events.ScheduleEvent(EVENT_CAST_STARFALL, urand(14000, 16000));
|
||||
break;
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_omenAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_giant_spotlight : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_giant_spotlight() : CreatureScript("npc_giant_spotlight") { }
|
||||
|
||||
struct npc_giant_spotlightAI : public ScriptedAI
|
||||
{
|
||||
npc_giant_spotlightAI(Creature* creature) : ScriptedAI(creature) {}
|
||||
|
||||
EventMap events;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_DESPAWN, 5*MINUTE*IN_MILLISECONDS);
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
events.Update(diff);
|
||||
|
||||
if (events.ExecuteEvent() == EVENT_DESPAWN)
|
||||
{
|
||||
if (GameObject* trap = me->FindNearestGameObject(GO_ELUNE_TRAP_1, 5.0f))
|
||||
trap->RemoveFromWorld();
|
||||
|
||||
if (GameObject* trap = me->FindNearestGameObject(GO_ELUNE_TRAP_2, 5.0f))
|
||||
trap->RemoveFromWorld();
|
||||
|
||||
if (Creature* omen = me->FindNearestCreature(NPC_OMEN, 5.0f, false))
|
||||
omen->DespawnOrUnsummon();
|
||||
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_giant_spotlightAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_moonglade()
|
||||
{
|
||||
new npc_bunthen_plainswind();
|
||||
@@ -583,4 +725,6 @@ void AddSC_moonglade()
|
||||
new npc_silva_filnaveth();
|
||||
new npc_clintar_dreamwalker();
|
||||
new npc_clintar_spirit();
|
||||
new npc_omen();
|
||||
new npc_giant_spotlight();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user