fix(Scripts/IcecrownCitadel): Rewrite the Spire Frostwyrms (#15490)
This commit is contained in:
@@ -3051,37 +3051,68 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class npc_icc_spire_frostwyrm : public CreatureScript
|
enum SpireFrostwyrm
|
||||||
{
|
{
|
||||||
public:
|
SPELL_BLIZZARD = 70362,
|
||||||
npc_icc_spire_frostwyrm() : CreatureScript("npc_icc_spire_frostwyrm") { }
|
SPELL_CLEAVE = 70361,
|
||||||
|
SPELL_FROSTBREATH = 70116,
|
||||||
|
|
||||||
struct npc_icc_spire_frostwyrmAI : public ScriptedAI
|
HORDE_AREATRIGGER = 5630
|
||||||
|
};
|
||||||
|
|
||||||
|
struct npc_icc_spire_frostwyrm : public ScriptedAI
|
||||||
{
|
{
|
||||||
npc_icc_spire_frostwyrmAI(Creature* creature) : ScriptedAI(creature)
|
npc_icc_spire_frostwyrm(Creature* creature) : ScriptedAI(creature)
|
||||||
{
|
{
|
||||||
me->SetCanFly(true);
|
_scheduler.SetValidator([this]
|
||||||
me->SetDisableGravity(true);
|
{
|
||||||
|
return !me->HasUnitState(UNIT_STATE_CASTING);
|
||||||
|
});
|
||||||
|
|
||||||
|
_canResetFlyingEffects = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventMap events;
|
|
||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
events.Reset();
|
if (!_canResetFlyingEffects)
|
||||||
events.ScheduleEvent(1, 15s, 25s); // blizzard
|
{
|
||||||
events.ScheduleEvent(2, 5s); // cleave
|
me->SetCanFly(false);
|
||||||
events.ScheduleEvent(3, 10s, 15s); // frost breath
|
me->SetDisableGravity(false);
|
||||||
|
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
|
||||||
|
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoAction(int32 a) override
|
void JustEngagedWith(Unit* /*victim*/) override
|
||||||
{
|
{
|
||||||
if (a != -1)
|
_scheduler.Schedule(15s, 25s, [this](TaskContext context)
|
||||||
return;
|
{
|
||||||
if (me->GetHomePosition().GetPositionZ() < 225.0f)
|
DoCastRandomTarget(SPELL_BLIZZARD);
|
||||||
return;
|
context.Repeat(25s, 35s);
|
||||||
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), 191.26f, me->GetOrientation());
|
}).Schedule(5s, [this](TaskContext context)
|
||||||
me->GetMotionMaster()->MoveLand(1, me->GetPositionX(), me->GetPositionY(), 191.26f, 2.5f * 7.0f);
|
{
|
||||||
|
DoCastVictim(SPELL_CLEAVE);
|
||||||
|
context.Repeat();
|
||||||
|
}).Schedule(10s, 15s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
DoCastVictim(SPELL_FROSTBREATH);
|
||||||
|
context.Repeat();
|
||||||
|
});
|
||||||
|
|
||||||
|
_canResetFlyingEffects = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoAction(int32 action) override
|
||||||
|
{
|
||||||
|
const Position posHordeMove = { -433.667084f, 2080.347412f, 191.253860f, 3.825093f };
|
||||||
|
const Position posAllianceMove = { -433.589508f, 2344.564697f, 191.253616f, 2.543328f };
|
||||||
|
|
||||||
|
bool hordeSide = action == HORDE_AREATRIGGER || action == HORDE_AREATRIGGER + 1;
|
||||||
|
Position landingPosition = hordeSide ? posHordeMove : posAllianceMove;
|
||||||
|
|
||||||
|
me->GetMotionMaster()->MovePoint(1, landingPosition);
|
||||||
|
me->SetHomePosition(landingPosition);
|
||||||
|
|
||||||
Talk(0);
|
Talk(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3091,13 +3122,20 @@ public:
|
|||||||
{
|
{
|
||||||
me->SetCanFly(false);
|
me->SetCanFly(false);
|
||||||
me->SetDisableGravity(false);
|
me->SetDisableGravity(false);
|
||||||
|
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
|
||||||
if (Player* p = SelectTargetFromPlayerList(100.0f))
|
_canResetFlyingEffects = false;
|
||||||
{
|
|
||||||
Talk(p->GetTeamId() == TEAM_HORDE ? 1 : 2);
|
|
||||||
AttackStart(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JustReachedHome() override
|
||||||
|
{
|
||||||
|
ScriptedAI::JustReachedHome();
|
||||||
|
if (!_canResetFlyingEffects)
|
||||||
|
{
|
||||||
|
me->SetCanFly(false);
|
||||||
|
me->SetDisableGravity(false);
|
||||||
|
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanAIAttack(Unit const* target) const override
|
bool CanAIAttack(Unit const* target) const override
|
||||||
@@ -3110,36 +3148,13 @@ public:
|
|||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
events.Update(diff);
|
_scheduler.Update(diff,
|
||||||
|
std::bind(&ScriptedAI::DoMeleeAttackIfReady, this));
|
||||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (events.ExecuteEvent())
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
|
|
||||||
me->CastSpell(target, 70362, false);
|
|
||||||
events.Repeat(25s, 35s);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
me->CastSpell(me->GetVictim(), 70361, false);
|
|
||||||
events.Repeat(5s);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
me->CastSpell(me->GetVictim(), 70116, false);
|
|
||||||
events.Repeat(10s, 15s);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DoMeleeAttackIfReady();
|
private:
|
||||||
}
|
TaskScheduler _scheduler;
|
||||||
};
|
bool _canResetFlyingEffects;
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
|
||||||
{
|
|
||||||
return GetIcecrownCitadelAI<npc_icc_spire_frostwyrmAI>(creature);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define VENGEFUL_WP_COUNT 6
|
#define VENGEFUL_WP_COUNT 6
|
||||||
@@ -3746,16 +3761,27 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class at_icc_spire_frostwyrm : public AreaTriggerScript
|
class at_icc_spire_frostwyrm : public OnlyOnceAreaTriggerScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
at_icc_spire_frostwyrm() : AreaTriggerScript("at_icc_spire_frostwyrm") { }
|
at_icc_spire_frostwyrm() : OnlyOnceAreaTriggerScript("at_icc_spire_frostwyrm") { }
|
||||||
|
|
||||||
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/) override
|
bool _OnTrigger(Player* player, AreaTrigger const* areaTrigger) override
|
||||||
{
|
{
|
||||||
if (Creature* frostwyrm = player->FindNearestCreature(NPC_SPIRE_FROSTWYRM, 150.0f, true))
|
if (player->GetInstanceScript()->GetPersistentData(DATA_SPIRE_FROSTWYRM) != DONE)
|
||||||
if (frostwyrm->GetPositionZ() > 250.0f && frostwyrm->AI())
|
{
|
||||||
frostwyrm->AI()->DoAction(-1);
|
player->GetInstanceScript()->StorePersistentData(DATA_SPIRE_FROSTWYRM, DONE);
|
||||||
|
const Position posHordeWyrm = { -375.538879f, 2120.774658f, 242.256775f, 3.714352f };
|
||||||
|
const Position posAllianceWyrm = { -361.154358f, 2305.821289f, 244.771713f, 2.704335f };
|
||||||
|
|
||||||
|
bool hordeSide = areaTrigger->entry == HORDE_AREATRIGGER || areaTrigger->entry == HORDE_AREATRIGGER + 1;
|
||||||
|
|
||||||
|
if (Creature* frostwyrm = player->SummonCreature(NPC_SPIRE_FROSTWYRM, hordeSide ? posHordeWyrm : posAllianceWyrm))
|
||||||
|
{
|
||||||
|
frostwyrm->AI()->DoAction(areaTrigger->entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -3803,7 +3829,7 @@ void AddSC_icecrown_citadel()
|
|||||||
new npc_icc_skybreaker_luminary();
|
new npc_icc_skybreaker_luminary();
|
||||||
new npc_icc_valkyr_herald();
|
new npc_icc_valkyr_herald();
|
||||||
new npc_icc_severed_essence();
|
new npc_icc_severed_essence();
|
||||||
new npc_icc_spire_frostwyrm();
|
RegisterIcecrownCitadelCreatureAI(npc_icc_spire_frostwyrm);
|
||||||
new npc_icc_vengeful_fleshreaper();
|
new npc_icc_vengeful_fleshreaper();
|
||||||
new npc_icc_buff_switcher();
|
new npc_icc_buff_switcher();
|
||||||
new npc_icc_nerubar_broodkeeper();
|
new npc_icc_nerubar_broodkeeper();
|
||||||
|
|||||||
@@ -148,6 +148,12 @@ enum DataTypes
|
|||||||
DATA_BPC_TRASH_DIED = 300,
|
DATA_BPC_TRASH_DIED = 300,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum PersistentData
|
||||||
|
{
|
||||||
|
DATA_SPIRE_FROSTWYRM = 0,
|
||||||
|
MAX_DATA_INDEXES
|
||||||
|
};
|
||||||
|
|
||||||
enum CreaturesIds
|
enum CreaturesIds
|
||||||
{
|
{
|
||||||
// At Light's Hammer
|
// At Light's Hammer
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ public:
|
|||||||
|
|
||||||
SetHeaders(DataHeader);
|
SetHeaders(DataHeader);
|
||||||
SetBossNumber(MAX_ENCOUNTERS);
|
SetBossNumber(MAX_ENCOUNTERS);
|
||||||
|
SetPersistentDataCount(MAX_DATA_INDEXES);
|
||||||
LoadBossBoundaries(boundaries);
|
LoadBossBoundaries(boundaries);
|
||||||
LoadDoorData(doorData);
|
LoadDoorData(doorData);
|
||||||
TeamIdInInstance = TEAM_NEUTRAL;
|
TeamIdInInstance = TEAM_NEUTRAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user