mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 11:25:42 +00:00
fix(Scripts/SerpentshrineCavern): Randomize the Lurker spout direction (#17980)
This commit is contained in:
@@ -38,6 +38,8 @@ enum Misc
|
||||
{
|
||||
EMOTE_TAKE_BREATH = 0,
|
||||
ACTION_START_EVENT = 1,
|
||||
ACTION_ROTATE = 2,
|
||||
ACTION_SHUFFLE_ROTATION = 3,
|
||||
MAX_SUMMONS = 9,
|
||||
|
||||
NPC_COILFANG_GUARDIAN = 21873,
|
||||
@@ -65,7 +67,7 @@ const Position positions[MAX_SUMMONS] =
|
||||
|
||||
struct boss_the_lurker_below : public BossAI
|
||||
{
|
||||
boss_the_lurker_below(Creature* creature) : BossAI(creature, DATA_THE_LURKER_BELOW) { }
|
||||
boss_the_lurker_below(Creature* creature) : BossAI(creature, DATA_THE_LURKER_BELOW), _clockWise(false) { }
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
@@ -73,6 +75,7 @@ struct boss_the_lurker_below : public BossAI
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
me->SetStandState(UNIT_STAND_STATE_SUBMERGED);
|
||||
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||
_clockWise = RAND(false, true);
|
||||
}
|
||||
|
||||
void EnterEvadeMode(EvadeReason why) override
|
||||
@@ -91,6 +94,15 @@ struct boss_the_lurker_below : public BossAI
|
||||
me->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
me->SetInCombatWithZone();
|
||||
}
|
||||
else if (action == ACTION_ROTATE)
|
||||
{
|
||||
float orientation = _clockWise ? Position::NormalizeOrientation(me->GetOrientation() + 0.1f) : Position::NormalizeOrientation(me->GetOrientation() - 0.1f);
|
||||
me->SetFacingTo(orientation);
|
||||
}
|
||||
else if (action == ACTION_SHUFFLE_ROTATION)
|
||||
{
|
||||
_clockWise = RAND(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
void AttackStart(Unit* who) override
|
||||
@@ -203,6 +215,9 @@ struct boss_the_lurker_below : public BossAI
|
||||
}
|
||||
me->resetAttackTimer();
|
||||
}
|
||||
|
||||
private:
|
||||
bool _clockWise;
|
||||
};
|
||||
|
||||
class go_strange_pool : public GameObjectScript
|
||||
@@ -229,9 +244,14 @@ class spell_lurker_below_spout : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_lurker_below_spout);
|
||||
|
||||
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& /*isPeriodic*/, int32& amplitude)
|
||||
{
|
||||
amplitude = 1000;
|
||||
}
|
||||
|
||||
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
SetDuration(13000);
|
||||
SetDuration(16000);
|
||||
}
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
@@ -242,45 +262,56 @@ class spell_lurker_below_spout : public AuraScript
|
||||
creature->SetReactState(REACT_AGGRESSIVE);
|
||||
if (Unit* target = creature->GetVictim())
|
||||
creature->SetTarget(target->GetGUID());
|
||||
|
||||
if (GetUnitOwner()->GetAI())
|
||||
{
|
||||
GetUnitOwner()->GetAI()->DoAction(ACTION_SHUFFLE_ROTATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetUnitOwner()->SetFacingTo(Position::NormalizeOrientation(GetUnitOwner()->GetOrientation() + 0.1f));
|
||||
if (GetUnitOwner()->GetAI())
|
||||
{
|
||||
GetUnitOwner()->GetAI()->DoAction(ACTION_ROTATE);
|
||||
}
|
||||
GetUnitOwner()->CastSpell(GetUnitOwner(), aurEff->GetAmount(), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_lurker_below_spout::CalcPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||
OnEffectApply += AuraEffectApplyFn(spell_lurker_below_spout::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_lurker_below_spout::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_lurker_below_spout::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||
}
|
||||
};
|
||||
|
||||
class HasInLineCheck
|
||||
{
|
||||
public:
|
||||
HasInLineCheck(Unit* caster) : _caster(caster) { }
|
||||
|
||||
bool operator()(WorldObject* unit)
|
||||
{
|
||||
return !_caster->HasInLine(unit, 5.0f) || (unit->GetTypeId() == TYPEID_UNIT && unit->ToUnit()->IsUnderWater());
|
||||
}
|
||||
|
||||
private:
|
||||
Unit* _caster;
|
||||
};
|
||||
|
||||
class spell_lurker_below_spout_cone : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_lurker_below_spout_cone);
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.remove_if(HasInLineCheck(GetCaster()));
|
||||
Unit* caster = GetCaster();
|
||||
targets.remove_if([caster](WorldObject const* target) -> bool
|
||||
{
|
||||
if (!caster->HasInLine(target, 5.0f) || !target->IsPlayer())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
LiquidData const& liquidData = target->GetLiquidData();
|
||||
|
||||
if (liquidData.Status == LIQUID_MAP_UNDER_WATER)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
Reference in New Issue
Block a user