mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-19 08:30:34 +01:00
Scripts/HoO: scripted all trash groups in Tomb of the Earthrager
This commit is contained in:
@@ -117,6 +117,70 @@ private:
|
||||
bool _dispersed;
|
||||
};
|
||||
|
||||
enum AggroStalker
|
||||
{
|
||||
// Spells
|
||||
SPELL_SUBMERGE = 76084,
|
||||
SPELL_EMERGE = 75764
|
||||
};
|
||||
|
||||
struct npc_hoo_aggro_stalker_base : public ScriptedAI
|
||||
{
|
||||
npc_hoo_aggro_stalker_base(Creature* creature, uint8 summonGroupId) : ScriptedAI(creature), _summonGroupId(summonGroupId) { }
|
||||
|
||||
void InitializeAI() override
|
||||
{
|
||||
// Trigger creatures are passive by default but we need an aggressive one here.
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
}
|
||||
|
||||
void JustAppeared() override
|
||||
{
|
||||
me->SummonCreatureGroup(_summonGroupId);
|
||||
}
|
||||
|
||||
void AttackStart(Unit* /*who*/) override { }
|
||||
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
for (ObjectGuid const& guid : _summonGUIDs)
|
||||
{
|
||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, guid))
|
||||
{
|
||||
summon->EngageWithTarget(who);
|
||||
if (summon->HasAura(SPELL_SUBMERGE))
|
||||
{
|
||||
summon->RemoveAurasDueToSpell(SPELL_SUBMERGE);
|
||||
summon->CastSpell(summon, SPELL_EMERGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* summon) override
|
||||
{
|
||||
_summonGUIDs.insert(summon->GetGUID());
|
||||
summon->CastSpell(summon, SPELL_SUBMERGE, true); // The spell has a cast time but we need them submerged immediately
|
||||
}
|
||||
|
||||
void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
|
||||
{
|
||||
_summonGUIDs.erase(summon->GetGUID());
|
||||
|
||||
// Group has been defeated, despawn aggro stalker.
|
||||
if (_summonGUIDs.empty())
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
private:
|
||||
uint8 _summonGroupId;
|
||||
GuidSet _summonGUIDs;
|
||||
};
|
||||
|
||||
struct npc_hoo_aggro_stalker_1 : public npc_hoo_aggro_stalker_base { npc_hoo_aggro_stalker_1(Creature* creature) : npc_hoo_aggro_stalker_base(creature, 0) { } };
|
||||
struct npc_hoo_aggro_stalker_2 : public npc_hoo_aggro_stalker_base { npc_hoo_aggro_stalker_2(Creature* creature) : npc_hoo_aggro_stalker_base(creature, 1) { } };
|
||||
struct npc_hoo_aggro_stalker_3 : public npc_hoo_aggro_stalker_base { npc_hoo_aggro_stalker_3(Creature* creature) : npc_hoo_aggro_stalker_base(creature, 2) { } };
|
||||
|
||||
// The Maker's Lift
|
||||
enum ElevatorMisc
|
||||
{
|
||||
@@ -230,10 +294,39 @@ class spell_hoo_disperse : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
class spell_hoo_submerge : public AuraScript
|
||||
{
|
||||
void HandleFlagsAfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
if (target->IsCreature())
|
||||
target->ToCreature()->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
void HandleFlagsAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
if (target->IsCreature())
|
||||
target->ToCreature()->SetReactState(REACT_AGGRESSIVE);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterEffectApply.Register(&spell_hoo_submerge::HandleFlagsAfterApply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectRemove.Register(&spell_hoo_submerge::HandleFlagsAfterRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_halls_of_origination()
|
||||
{
|
||||
RegisterHallsOfOriginationCreatureAI(npc_sun_touched_servant);
|
||||
RegisterHallsOfOriginationCreatureAI(npc_hoo_aggro_stalker_1);
|
||||
RegisterHallsOfOriginationCreatureAI(npc_hoo_aggro_stalker_2);
|
||||
RegisterHallsOfOriginationCreatureAI(npc_hoo_aggro_stalker_3);
|
||||
RegisterGameObjectAI(go_hoo_the_makers_lift_controller);
|
||||
RegisterSpellScript(spell_hoo_flame_ring_visual);
|
||||
RegisterSpellScript(spell_hoo_disperse);
|
||||
RegisterSpellScript(spell_hoo_submerge);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user