Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2023-07-14 13:16:02 +08:00
32 changed files with 480 additions and 204 deletions

View File

@@ -87,11 +87,11 @@ struct boss_gruul : public BossAI
_caveInTimer = _caveInTimer - 1500ms;
}
context.Repeat(_caveInTimer);
}).Schedule(20s, [this](TaskContext context)
}).Schedule(39900ms, 55700ms, [this](TaskContext context)
{
DoCastSelf(SPELL_REVERBERATION);
context.Repeat(22s);
}).Schedule(10s, [this](TaskContext context)
context.Repeat(39900ms, 55700ms);
}).Schedule(5600ms, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 1, 5.0f))
{
@@ -101,7 +101,7 @@ struct boss_gruul : public BossAI
{
DoCastVictim(SPELL_HURTFUL_STRIKE);
}
context.Repeat(15s);
context.Repeat(8400ms);
}).Schedule(35s, [this](TaskContext context)
{
Talk(SAY_SLAM);

View File

@@ -85,7 +85,7 @@ struct boss_high_king_maulgar : public BossAI
context.Repeat(35s);
}).Schedule(0ms, [this](TaskContext context)
{
DoCastSelf(SPELL_ROAR);
DoCastVictim(SPELL_ROAR);
context.Repeat(20600ms, 29100ms);
});
});

View File

@@ -66,7 +66,7 @@ struct boss_vazruden_the_herald : public BossAI
void Reset() override
{
BossAI::Reset();
_Reset();
me->SetVisible(true);
me->SetReactState(REACT_PASSIVE);
me->SummonCreature(NPC_HELLFIRE_SENTRY, -1372.56f, 1724.31f, 82.967f, 5.3058f);
@@ -253,6 +253,7 @@ struct boss_vazruden : public ScriptedAI
void Reset() override
{
_scheduler.CancelAll();
_nazanCalled = false;
}

View File

@@ -18,6 +18,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellInfo.h"
#include "TaskScheduler.h"
#include "magtheridons_lair.h"
enum Yells
@@ -49,6 +50,7 @@ enum Spells
SPELL_SHADOW_GRASP_VISUAL = 30166,
SPELL_MIND_EXHAUSTION = 44032,
SPELL_QUAKE = 30657,
SPELL_QUAKE_KNOCKBACK = 30571,
SPELL_COLLAPSE_DAMAGE = 36449,
SPELL_CAMERA_SHAKE = 36455,
SPELL_DEBRIS_VISUAL = 30632,
@@ -77,232 +79,221 @@ private:
ObjectGuid _targetGUID;
};
class boss_magtheridon : public CreatureScript
struct boss_magtheridon : public BossAI
{
public:
boss_magtheridon() : CreatureScript("boss_magtheridon") { }
struct boss_magtheridonAI : public BossAI
boss_magtheridon(Creature* creature) : BossAI(creature, TYPE_MAGTHERIDON)
{
boss_magtheridonAI(Creature* creature) : BossAI(creature, TYPE_MAGTHERIDON)
scheduler.SetValidator([this]
{
scheduler.SetValidator([this]
return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
void Reset() override
{
BossAI::Reset();
_currentPhase = 0;
_recentlySpoken = false;
_interruptScheduler.CancelAll();
scheduler.Schedule(90s, [this](TaskContext context)
{
Talk(SAY_TAUNT);
context.Repeat(90s);
});
DoCastSelf(SPELL_SHADOW_CAGE, true);
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToPC(true);
ScheduleHealthCheckEvent(30, [&]
{
_currentPhase = 1;
Talk(SAY_PHASE3);
me->GetMotionMaster()->Clear();
scheduler.DelayAll(18s);
scheduler.Schedule(8s, [this](TaskContext /*context*/)
{
return !me->HasUnitState(UNIT_STATE_CASTING);
DoCastSelf(SPELL_CAMERA_SHAKE, true);
instance->SetData(DATA_COLLAPSE, GO_STATE_ACTIVE);
}).Schedule(15s, [this](TaskContext /*context*/)
{
DoCastSelf(SPELL_COLLAPSE_DAMAGE, true);
me->resetAttackTimer();
me->GetMotionMaster()->MoveChase(me->GetVictim());
_currentPhase = 0;
scheduler.Schedule(20s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random))
{
target->CastSpell(target, SPELL_DEBRIS_VISUAL, true, nullptr, nullptr, me->GetGUID());
me->m_Events.AddEvent(new DealDebrisDamage(*me, target->GetGUID()), me->m_Events.CalculateTime(5000));
}
context.Repeat(20s);
});
});
});
}
void KilledUnit(Unit* /*victim*/) override
{
if (!_recentlySpoken)
{
Talk(SAY_SLAY);
_recentlySpoken = true;
}
void Reset() override
scheduler.Schedule(5s, [this](TaskContext /*context*/)
{
_Reset();
_currentPhase = 0;
_recentlySpoken = false;
scheduler.Schedule(90s, [this](TaskContext context)
{
Talk(SAY_TAUNT);
context.Repeat(90s);
});
me->CastSpell(me, SPELL_SHADOW_CAGE, true);
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToPC(true);
});
}
ScheduleHealthCheckEvent(30, [&] {
_currentPhase = 1;
Talk(SAY_PHASE3);
me->GetMotionMaster()->Clear();
scheduler.DelayAll(18s);
scheduler.Schedule(8s, [this](TaskContext /*context*/)
void JustDied(Unit* killer) override
{
Talk(SAY_DEATH);
BossAI::JustDied(killer);
}
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
Talk(SAY_EMOTE_BEGIN);
scheduler.Schedule(60s, [this](TaskContext /*context*/)
{
Talk(SAY_EMOTE_NEARLY);
}).Schedule(120s, [this](TaskContext /*context*/)
{
Talk(SAY_EMOTE_FREE);
}).Schedule(123s, [this](TaskContext /*context*/)
{
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToPC(false);
me->SetReactState(REACT_AGGRESSIVE);
instance->SetData(DATA_ACTIVATE_CUBES, 1);
me->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE);
scheduler.Schedule(9s, [this](TaskContext context)
{
DoCastVictim(SPELL_CLEAVE);
context.Repeat(1200ms, 16300ms);
}).Schedule(20s, [this](TaskContext context)
{
me->CastCustomSpell(SPELL_BLAZE, SPELLVALUE_MAX_TARGETS, 1);
context.Repeat(11s, 39s);
}).Schedule(40s, [this](TaskContext context)
{
DoCastSelf(SPELL_QUAKE); //needs fixes with custom spell
scheduler.Schedule(7s, [this](TaskContext /*context*/)
{
DoCastSelf(SPELL_CAMERA_SHAKE, true);
instance->SetData(DATA_COLLAPSE, GO_STATE_ACTIVE);
}).Schedule(15s, [this](TaskContext /*context*/)
{
DoCastSelf(SPELL_COLLAPSE_DAMAGE, true);
me->resetAttackTimer();
me->GetMotionMaster()->MoveChase(me->GetVictim());
_currentPhase = 0;
scheduler.Schedule(20s, [this](TaskContext context)
DoCastSelf(SPELL_BLAST_NOVA);
_interruptScheduler.Schedule(50ms, GROUP_INTERRUPT_CHECK, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random))
{
target->CastSpell(target, SPELL_DEBRIS_VISUAL, true, nullptr, nullptr, me->GetGUID());
me->m_Events.AddEvent(new DealDebrisDamage(*me, target->GetGUID()), me->m_Events.CalculateTime(5000));
}
context.Repeat(20s);
});
});
});
}
void KilledUnit(Unit* /*victim*/) override
{
if(!_recentlySpoken)
{
Talk(SAY_SLAY);
_recentlySpoken = true;
}
scheduler.Schedule(5s, [this](TaskContext /*context*/)
{
_recentlySpoken = false;
});
}
void JustDied(Unit* /*killer*/) override
{
_JustDied();
Talk(SAY_DEATH);
}
void JustEngagedWith(Unit* /*who*/) override
{
_JustEngagedWith();
Talk(SAY_EMOTE_BEGIN);
scheduler.Schedule(60s, [this](TaskContext /*context*/)
{
Talk(SAY_EMOTE_NEARLY);
}).Schedule(120s, [this](TaskContext /*context*/)
{
Talk(SAY_EMOTE_FREE);
}).Schedule(123s, [this](TaskContext /*context*/)
{
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToPC(false);
me->SetReactState(REACT_AGGRESSIVE);
instance->SetData(DATA_ACTIVATE_CUBES, 1);
me->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE);
scheduler.Schedule(9s, [this](TaskContext context)
{
DoCastVictim(SPELL_CLEAVE);
context.Repeat(10s);
}).Schedule(10s, [this](TaskContext context)
{
me->CastCustomSpell(SPELL_BLAZE, SPELLVALUE_MAX_TARGETS, 1);
context.Repeat(30s);
}).Schedule(40s, [this](TaskContext context)
{
me->CastSpell(me, SPELL_QUAKE); //needs fixes with custom spell
scheduler.Schedule(7s, [this](TaskContext /*context*/)
{
DoCastSelf(SPELL_BLAST_NOVA);
scheduler.Schedule(50ms, GROUP_INTERRUPT_CHECK, [this](TaskContext context)
{
if (me->GetAuraCount(SPELL_SHADOW_GRASP_VISUAL) == 5)
{
Talk(SAY_BANISH);
me->InterruptNonMeleeSpells(true);
scheduler.CancelGroup(GROUP_INTERRUPT_CHECK);
}
context.Repeat(50ms);
}).Schedule(12s, GROUP_INTERRUPT_CHECK, [this](TaskContext /*context*/)
if (me->GetAuraCount(SPELL_SHADOW_GRASP_VISUAL) == 5)
{
Talk(SAY_BANISH);
me->InterruptNonMeleeSpells(true);
scheduler.CancelGroup(GROUP_INTERRUPT_CHECK);
});
}
else
context.Repeat(50ms);
}).Schedule(12s, GROUP_INTERRUPT_CHECK, [this](TaskContext /*context*/)
{
_interruptScheduler.CancelGroup(GROUP_INTERRUPT_CHECK);
});
context.Repeat(50s);
}).Schedule(1320s, [this](TaskContext /*context*/)
{
DoCastSelf(SPELL_BERSERK, true);
});
});
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
scheduler.Update(diff);
if (_currentPhase != 1)
context.Repeat(53s, 56s);
}).Schedule(1320s, [this](TaskContext /*context*/)
{
DoMeleeAttackIfReady();
}
}
private:
bool _recentlySpoken;
uint8 _currentPhase;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetMagtheridonsLairAI<boss_magtheridonAI>(creature);
DoCastSelf(SPELL_BERSERK, true);
});
});
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
scheduler.Update(diff);
_interruptScheduler.Update(diff);
if (_currentPhase != 1)
{
DoMeleeAttackIfReady();
}
}
private:
bool _recentlySpoken;
uint8 _currentPhase;
TaskScheduler _interruptScheduler;
};
class spell_magtheridon_blaze : public SpellScriptLoader
class spell_magtheridon_blaze : public SpellScript
{
public:
spell_magtheridon_blaze() : SpellScriptLoader("spell_magtheridon_blaze") { }
PrepareSpellScript(spell_magtheridon_blaze);
class spell_magtheridon_blaze_SpellScript : public SpellScript
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_magtheridon_blaze_SpellScript);
if (Unit* target = GetHitUnit())
target->CastSpell(target, SPELL_BLAZE_SUMMON, true);
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
target->CastSpell(target, SPELL_BLAZE_SUMMON, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_magtheridon_blaze_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_magtheridon_blaze_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_magtheridon_blaze::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_magtheridon_shadow_grasp : public SpellScriptLoader
class spell_magtheridon_shadow_grasp : public AuraScript
{
public:
spell_magtheridon_shadow_grasp() : SpellScriptLoader("spell_magtheridon_shadow_grasp") { }
PrepareAuraScript(spell_magtheridon_shadow_grasp);
class spell_magtheridon_shadow_grasp_AuraScript : public AuraScript
void HandleDummyApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_magtheridon_shadow_grasp_AuraScript)
GetUnitOwner()->CastSpell((Unit*)nullptr, SPELL_SHADOW_GRASP_VISUAL, false);
}
void HandleDummyApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->CastSpell((Unit*)nullptr, SPELL_SHADOW_GRASP_VISUAL, false);
}
void HandleDummyRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->InterruptNonMeleeSpells(true);
}
void HandlePeriodicRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_MIND_EXHAUSTION, true);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_magtheridon_shadow_grasp_AuraScript::HandleDummyApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_magtheridon_shadow_grasp_AuraScript::HandleDummyRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_magtheridon_shadow_grasp_AuraScript::HandlePeriodicRemove, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void HandleDummyRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_magtheridon_shadow_grasp_AuraScript();
GetUnitOwner()->InterruptNonMeleeSpells(true);
}
void HandlePeriodicRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_MIND_EXHAUSTION, true);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_magtheridon_shadow_grasp::HandleDummyApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_magtheridon_shadow_grasp::HandleDummyRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_magtheridon_shadow_grasp::HandlePeriodicRemove, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_magtheridon_quake : public SpellScript
{
PrepareSpellScript(spell_magtheridon_quake);
void HandleHit()
{
if (urand(0, 3) == 0)
GetCaster()->CastSpell(GetCaster(), SPELL_QUAKE_KNOCKBACK, true);
}
void Register() override
{
OnHit += SpellHitFn(spell_magtheridon_quake::HandleHit);
}
};
void AddSC_boss_magtheridon()
{
new boss_magtheridon();
new spell_magtheridon_blaze();
new spell_magtheridon_shadow_grasp();
RegisterMagtheridonsLairCreatureAI(boss_magtheridon);
RegisterSpellScript(spell_magtheridon_blaze);
RegisterSpellScript(spell_magtheridon_shadow_grasp);
RegisterSpellScript(spell_magtheridon_quake);
}

View File

@@ -62,4 +62,6 @@ inline AI* GetMagtheridonsLairAI(T* obj)
return GetInstanceAI<AI>(obj, MagtheridonsLairScriptName);
}
#define RegisterMagtheridonsLairCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetMagtheridonsLairAI)
#endif

View File

@@ -50,6 +50,7 @@ public:
void Reset() override
{
_inEnrage = false;
_scheduler.CancelAll();
}
void KilledUnit(Unit* victim) override

View File

@@ -234,7 +234,8 @@ enum WoundedBloodElf
SAY_ELF_AGGRO = 5,
QUEST_ROAD_TO_FALCON_WATCH = 9375,
NPC_HAALESHI_WINDWALKER = 16966,
NPC_HAALESHI_TALONGUARD = 16967
NPC_HAALESHI_TALONGUARD = 16967,
ARAKKOA_CAGE = 181664
};
class npc_wounded_blood_elf : public CreatureScript
@@ -246,7 +247,11 @@ public:
{
npc_wounded_blood_elfAI(Creature* creature) : npc_escortAI(creature) { }
void Reset() override { }
void Reset() override
{
me->SetReactState(REACT_PASSIVE);
me->FindNearestGameObject(ARAKKOA_CAGE, 10.0f)->SetGoState(GO_STATE_READY);
}
void JustEngagedWith(Unit* /*who*/) override
{
@@ -263,6 +268,7 @@ public:
{
if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH)
{
me->SetReactState(REACT_AGGRESSIVE);
me->SetFaction(FACTION_ESCORTEE_H_PASSIVE);
npc_escortAI::Start(true, false, player->GetGUID());
}
@@ -278,6 +284,7 @@ public:
{
case 0:
Talk(SAY_ELF_START, player);
me->FindNearestGameObject(ARAKKOA_CAGE, 10.0f)->SetGoState(GO_STATE_ACTIVE);
break;
case 9:
Talk(SAY_ELF_SUMMON1, player);

View File

@@ -4814,6 +4814,7 @@ class spell_freezing_circle : public SpellScript
}
};
// 35385 - Threshalisk Charge
enum Threshalisk
{
SPELL_THRESHALISK_CHARGE = 35385,
@@ -4849,6 +4850,40 @@ class spell_gen_threshalisk_charge : public SpellScript
}
};
// 37589 - Shriveling Gaze
enum ShrivelingGaze
{
SPELL_SHRIVELING_GAZE = 37589,
SPELL_SHRIVELING_GAZE_REMOVAL = 30023, // Serverside - Gushing Wound Removal
};
class spell_gen_shriveling_gaze : public AuraScript
{
PrepareAuraScript(spell_gen_shriveling_gaze);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SHRIVELING_GAZE });
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
ModStackAmount(20);
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
ModStackAmount(-1);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_gen_shriveling_gaze::HandleApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_shriveling_gaze::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
void AddSC_generic_spell_scripts()
{
RegisterSpellScript(spell_silithyst);
@@ -4993,4 +5028,5 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_basic_campfire);
RegisterSpellScript(spell_freezing_circle);
RegisterSpellScript(spell_gen_threshalisk_charge);
RegisterSpellScript(spell_gen_shriveling_gaze);
}