mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
@@ -19,7 +19,7 @@
|
|||||||
#include "ScriptedCreature.h"
|
#include "ScriptedCreature.h"
|
||||||
#include "karazhan.h"
|
#include "karazhan.h"
|
||||||
|
|
||||||
enum ServantQuartersSpells
|
enum Spells
|
||||||
{
|
{
|
||||||
SPELL_SNEAK = 22766,
|
SPELL_SNEAK = 22766,
|
||||||
SPELL_ACIDIC_FANG = 29901,
|
SPELL_ACIDIC_FANG = 29901,
|
||||||
@@ -33,41 +33,37 @@ enum ServantQuartersSpells
|
|||||||
SPELL_RAVAGE = 29906
|
SPELL_RAVAGE = 29906
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ServantQuertersMisc
|
|
||||||
{
|
|
||||||
EVENT_SPELL_ACIDIC_FANG = 1,
|
|
||||||
EVENT_SPELL_HYAKISS_WEB = 2,
|
|
||||||
|
|
||||||
EVENT_SPELL_DIVE = 10,
|
|
||||||
EVENT_SPELL_SONIC_BURST = 11,
|
|
||||||
EVENT_SPELL_WING_BUFFET = 12,
|
|
||||||
EVENT_SPELL_FEAR = 13,
|
|
||||||
|
|
||||||
EVENT_SPELL_RAVAGE = 20,
|
|
||||||
|
|
||||||
EVENT_CHECK_VISIBILITY = 30
|
|
||||||
};
|
|
||||||
|
|
||||||
struct boss_servant_quarters : public BossAI
|
struct boss_servant_quarters : public BossAI
|
||||||
{
|
{
|
||||||
boss_servant_quarters(Creature* creature) : BossAI(creature, DATA_SERVANT_QUARTERS) { }
|
boss_servant_quarters(Creature* creature) : BossAI(creature, DATA_SERVANT_QUARTERS) { }
|
||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
events.Reset();
|
_scheduler.CancelAll();
|
||||||
me->SetVisible(false);
|
me->SetVisible(false);
|
||||||
me->SetReactState(REACT_PASSIVE);
|
me->SetReactState(REACT_PASSIVE);
|
||||||
me->SetFaction(FACTION_FRIENDLY);
|
me->SetFaction(FACTION_FRIENDLY);
|
||||||
_events2.Reset();
|
_scheduler.Schedule(5s, [this](TaskContext context)
|
||||||
_events2.ScheduleEvent(EVENT_CHECK_VISIBILITY, 5s);
|
{
|
||||||
|
if (instance->GetBossState(DATA_SERVANT_QUARTERS) == DONE)
|
||||||
|
{
|
||||||
|
me->SetVisible(true);
|
||||||
|
me->SetReactState(REACT_AGGRESSIVE);
|
||||||
|
me->RestoreFaction();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
context.Repeat(5s);
|
||||||
|
}
|
||||||
|
});
|
||||||
if (me->GetEntry() == NPC_HYAKISS_THE_LURKER)
|
if (me->GetEntry() == NPC_HYAKISS_THE_LURKER)
|
||||||
{
|
{
|
||||||
DoCastSelf(SPELL_SNEAK, true);
|
DoCastSelf(SPELL_SNEAK, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instance->GetData(DATA_SELECTED_RARE) != me->GetEntry())
|
if (instance->GetData(DATA_SELECTED_RARE) != me->GetEntry())
|
||||||
|
{
|
||||||
me->DespawnOrUnsummon(1);
|
me->DespawnOrUnsummon(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
@@ -75,18 +71,42 @@ struct boss_servant_quarters : public BossAI
|
|||||||
me->setActive(true);
|
me->setActive(true);
|
||||||
if (me->GetEntry() == NPC_HYAKISS_THE_LURKER)
|
if (me->GetEntry() == NPC_HYAKISS_THE_LURKER)
|
||||||
{
|
{
|
||||||
events.ScheduleEvent(EVENT_SPELL_ACIDIC_FANG, 5s);
|
_scheduler.Schedule(5s, [this](TaskContext context)
|
||||||
events.ScheduleEvent(EVENT_SPELL_HYAKISS_WEB, 9s);
|
{
|
||||||
|
DoCastVictim(SPELL_ACIDIC_FANG);
|
||||||
|
context.Repeat(12s, 18s);
|
||||||
|
}).Schedule(9s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
DoCastRandomTarget(SPELL_HYAKISS_WEB, 0, 30.0f);
|
||||||
|
context.Repeat(15s);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if (me->GetEntry() == NPC_SHADIKITH_THE_GLIDER)
|
else if (me->GetEntry() == NPC_SHADIKITH_THE_GLIDER)
|
||||||
{
|
{
|
||||||
events.ScheduleEvent(EVENT_SPELL_SONIC_BURST, 4s);
|
_scheduler.Schedule(4s, [this](TaskContext context)
|
||||||
events.ScheduleEvent(EVENT_SPELL_WING_BUFFET, 7s);
|
{
|
||||||
events.ScheduleEvent(EVENT_SPELL_DIVE, 10s);
|
DoCastSelf(SPELL_SONIC_BURST);
|
||||||
|
context.Repeat(12s, 18s);
|
||||||
|
}).Schedule(7s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
DoCastSelf(SPELL_WING_BUFFET);
|
||||||
|
context.Repeat(12s, 18s);
|
||||||
|
}).Schedule(10s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
if (Unit* target = SelectTarget(SelectTargetMethod::MinDistance, 0, FarthestTargetSelector(me, 40.0f, false, true)))
|
||||||
|
{
|
||||||
|
me->CastSpell(target, SPELL_DIVE);
|
||||||
|
}
|
||||||
|
context.Repeat(20s);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else // if (me->GetEntry() == NPC_ROKAD_THE_RAVAGER)
|
else // if (me->GetEntry() == NPC_ROKAD_THE_RAVAGER)
|
||||||
{
|
{
|
||||||
events.ScheduleEvent(EVENT_SPELL_RAVAGE, 3s);
|
_scheduler.Schedule(3s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
DoCastVictim(SPELL_RAVAGE);
|
||||||
|
context.Repeat(10500ms);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,70 +117,28 @@ struct boss_servant_quarters : public BossAI
|
|||||||
void MovementInform(uint32 type, uint32 point) override
|
void MovementInform(uint32 type, uint32 point) override
|
||||||
{
|
{
|
||||||
if (type == POINT_MOTION_TYPE && point == EVENT_CHARGE)
|
if (type == POINT_MOTION_TYPE && point == EVENT_CHARGE)
|
||||||
events.ScheduleEvent(EVENT_SPELL_FEAR, 0);
|
{
|
||||||
|
_scheduler.Schedule(1ms, [this](TaskContext /*context*/)
|
||||||
|
{
|
||||||
|
DoCastVictim(SPELL_FEAR);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
_events2.Update(diff);
|
|
||||||
switch (_events2.ExecuteEvent())
|
|
||||||
{
|
|
||||||
case EVENT_CHECK_VISIBILITY:
|
|
||||||
if (instance->GetBossState(DATA_SERVANT_QUARTERS) == DONE)
|
|
||||||
{
|
|
||||||
me->SetVisible(true);
|
|
||||||
me->SetReactState(REACT_AGGRESSIVE);
|
|
||||||
me->RestoreFaction();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_events2.ScheduleEvent(EVENT_CHECK_VISIBILITY, 5s);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
events.Update(diff);
|
_scheduler.Update(diff);
|
||||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (events.ExecuteEvent())
|
|
||||||
{
|
|
||||||
case EVENT_SPELL_ACIDIC_FANG:
|
|
||||||
me->CastSpell(me->GetVictim(), SPELL_ACIDIC_FANG, false);
|
|
||||||
events.Repeat(12s, 18s);
|
|
||||||
break;
|
|
||||||
case EVENT_SPELL_HYAKISS_WEB:
|
|
||||||
DoCastRandomTarget(SPELL_HYAKISS_WEB, 0, 30.0f);
|
|
||||||
events.Repeat(15s);
|
|
||||||
break;
|
|
||||||
case EVENT_SPELL_SONIC_BURST:
|
|
||||||
DoCastSelf(SPELL_SONIC_BURST);
|
|
||||||
events.Repeat(12s, 18s);
|
|
||||||
break;
|
|
||||||
case EVENT_SPELL_WING_BUFFET:
|
|
||||||
DoCastSelf(SPELL_WING_BUFFET);
|
|
||||||
events.Repeat(12s, 18s);
|
|
||||||
break;
|
|
||||||
case EVENT_SPELL_DIVE:
|
|
||||||
if (Unit* target = SelectTarget(SelectTargetMethod::MinDistance, 0, FarthestTargetSelector(me, 40.0f, false, true)))
|
|
||||||
me->CastSpell(target, SPELL_DIVE, false);
|
|
||||||
events.Repeat(20s);
|
|
||||||
break;
|
|
||||||
case EVENT_SPELL_FEAR:
|
|
||||||
DoCastVictim(SPELL_FEAR);
|
|
||||||
break;
|
|
||||||
case EVENT_SPELL_RAVAGE:
|
|
||||||
me->CastSpell(me->GetVictim(), SPELL_RAVAGE, false);
|
|
||||||
events.ScheduleEvent(EVENT_SPELL_RAVAGE, 10500);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EventMap _events2;
|
TaskScheduler _scheduler;
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_servant_quarters()
|
void AddSC_boss_servant_quarters()
|
||||||
|
|||||||
Reference in New Issue
Block a user