Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-10-02 10:46:28 -06:00
committed by GitHub
41 changed files with 592 additions and 454 deletions

View File

@@ -50,6 +50,7 @@ enum Spells
enum Misc
{
ACTION_CONSUME = 0,
ACTION_EXPLODE = 1,
EMOTE_DEVOURED = 0,
@@ -78,20 +79,20 @@ public:
void EnterCombatWithTrio(Unit* who)
{
if (Creature* vem = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VEM)))
if (Creature* vem = instance->GetCreature(DATA_VEM))
if (vem->GetGUID() != me->GetGUID())
vem->GetAI()->AttackStart(who);
if (Creature* kri = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KRI)))
if (Creature* kri = instance->GetCreature(DATA_KRI))
if (kri->GetGUID() != me->GetGUID())
kri->GetAI()->AttackStart(who);
if (Creature* yauj = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_YAUJ)))
if (Creature* yauj = instance->GetCreature(DATA_YAUJ))
if (yauj->GetGUID() != me->GetGUID())
yauj->GetAI()->AttackStart(who);
}
void EvadeAllBosses(EvadeReason why)
{
if (Creature* vem = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VEM)))
if (Creature* vem = instance->GetCreature(DATA_VEM))
{
if (vem->GetGUID() != me->GetGUID())
{
@@ -102,7 +103,7 @@ public:
}
}
if (Creature* kri = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KRI)))
if (Creature* kri = instance->GetCreature(DATA_KRI))
{
if (kri->GetGUID() != me->GetGUID())
{
@@ -113,7 +114,7 @@ public:
}
}
if (Creature* yauj = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_YAUJ)))
if (Creature* yauj = instance->GetCreature(DATA_YAUJ))
{
if (yauj->GetGUID() != me->GetGUID())
{
@@ -127,14 +128,19 @@ public:
void DoAction(int32 action) override
{
if (action != ACTION_CONSUME || dying)
if (action == ACTION_CONSUME && !_dying)
{
return;
_isEating = true;
me->SetSpeed(MOVE_RUN, 45.f / 7.f); // From sniffs
me->SetReactState(REACT_PASSIVE);
_scheduler.DelayAll(6s);
}
isEating = true;
me->SetSpeed(MOVE_RUN, 45.f/7.f); // From sniffs
me->SetReactState(REACT_PASSIVE);
if (action == ACTION_EXPLODE && _dying)
{
DoCastSelf(SPELL_BLOODY_DEATH);
_dying = false;
}
}
void MovementInform(uint32 type, uint32 id) override
@@ -145,12 +151,18 @@ public:
me->GetMotionMaster()->MoveIdle();
me->SetSpeed(MOVE_RUN, 15.f/7.f); // From sniffs
DoCastSelf(SPELL_FULL_HEAL, true);
DoResetThreat();
isEating = false;
if (me->GetThreatMgr().GetThreatListSize())
DoResetThreat();
if (Creature* dying = instance->GetCreature(_creatureDying))
{
dying->AI()->DoAction(ACTION_EXPLODE);
me->SetTarget(dying->GetGUID());
}
_scheduler.Schedule(4s, [this](TaskContext /*context*/)
_scheduler.Schedule(2s, [this](TaskContext /*context*/)
{
me->SetReactState(REACT_AGGRESSIVE);
_isEating = false;
if (Unit* target = me->GetVictim())
{
me->GetMotionMaster()->Clear();
@@ -170,12 +182,11 @@ public:
{
BossAI::Reset();
_scheduler.CancelAll();
dying = false;
isEating = false;
_dying = false;
_isEating = false;
_creatureDying = 0;
instance->SetData(DATA_BUG_TRIO_DEATH, 0);
me->SetSpeed(MOVE_RUN, 15.f / 7.f); // From sniffs
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetControlled(false, UNIT_STATE_ROOT);
if (me->GetEntry() == NPC_VEM)
{
@@ -185,66 +196,71 @@ public:
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim() || isEating || !CheckInRoom())
if (!UpdateVictim() || !CheckInRoom())
return;
_scheduler.Update(diff, [this]
{
DoMeleeAttackIfReady();
if (!_dying && !_isEating)
DoMeleeAttackIfReady();
});
}
void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) override
{
if (me->HealthBelowPctDamaged(1, damage) && instance->GetData(DATA_BUG_TRIO_DEATH) < 2 && who->GetGUID() != me->GetGUID() && !dying)
if (_dying && who->GetGUID() != me->GetGUID())
damage = 0;
if (me->HealthBelowPctDamaged(0, damage) && instance->GetData(DATA_BUG_TRIO_DEATH) < 2 && !_dying)
{
damage = 0;
if (isEating)
if (_isEating)
return;
_scheduler.CancelAll();
me->SetStandState(UNIT_STAND_STATE_DEAD);
me->SetReactState(REACT_PASSIVE);
me->SetControlled(true, UNIT_STATE_ROOT);
dying = true;
DoFinalSpell();
_dying = true;
float x, y, z;
// Move the other bugs to this bug position
if (Creature* vem = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VEM)))
if (Creature* vem = instance->GetCreature(DATA_VEM))
{
if (vem->GetGUID() != me->GetGUID())
{
vem->AI()->DoAction(ACTION_CONSUME);
vem->GetMotionMaster()->MovePoint(POINT_CONSUME, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
if (vem->IsAlive())
{
vem->AI()->DoAction(ACTION_CONSUME);
me->GetRandomContactPoint(vem, x, y, z);
vem->GetMotionMaster()->MovePoint(POINT_CONSUME, x, y, z);
}
}
else _creatureDying = DATA_VEM;
}
if (Creature* kri = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_KRI)))
if (Creature* kri = instance->GetCreature(DATA_KRI))
{
if (kri->GetGUID() != me->GetGUID())
{
kri->AI()->DoAction(ACTION_CONSUME);
kri->GetMotionMaster()->MovePoint(POINT_CONSUME, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
if (kri->IsAlive())
{
kri->AI()->DoAction(ACTION_CONSUME);
me->GetRandomContactPoint(kri, x, y, z);
kri->GetMotionMaster()->MovePoint(POINT_CONSUME, x, y, z);
}
}
else _creatureDying = DATA_KRI;
}
if (Creature* yauj = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_YAUJ)))
if (Creature* yauj = instance->GetCreature(DATA_YAUJ))
{
if (yauj->GetGUID() != me->GetGUID())
{
yauj->AI()->DoAction(ACTION_CONSUME);
yauj->GetMotionMaster()->MovePoint(POINT_CONSUME, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
if (yauj->IsAlive())
{
yauj->AI()->DoAction(ACTION_CONSUME);
me->GetRandomContactPoint(yauj, x, y, z);
yauj->GetMotionMaster()->MovePoint(POINT_CONSUME, x, y, z);
}
}
else _creatureDying = DATA_YAUJ;
}
_scheduler.Schedule(4s, [this](TaskContext /*context*/)
{
if (!me->IsInEvadeMode() && instance->GetData(DATA_BUG_TRIO_DEATH) < 2)
{
DoCastSelf(SPELL_BLOODY_DEATH, true);
Talk(EMOTE_DEVOURED);
me->DespawnOrUnsummon(1000);
}
});
}
}
@@ -274,10 +290,13 @@ public:
void JustDied(Unit* killer) override
{
if (killer->GetGUID() == me->GetGUID())
instance->SetData(DATA_BUG_TRIO_DEATH, 1);
if (instance->GetData(DATA_BUG_TRIO_DEATH) < 3)
{
instance->SetData(DATA_BUG_TRIO_DEATH, 1);
me->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE);
DoFinalSpell();
Talk(EMOTE_DEVOURED);
me->DespawnOrUnsummon(3000);
return;
}
@@ -285,10 +304,13 @@ public:
}
TaskScheduler _scheduler;
bool dying;
bool isEating;
bool _dying;
bool _isEating;
static uint32 _creatureDying;
};
uint32 boss_bug_trio::_creatureDying = 0;
struct boss_kri : public boss_bug_trio
{
boss_kri(Creature* creature) : boss_bug_trio(creature)
@@ -299,20 +321,20 @@ struct boss_kri : public boss_bug_trio
{
EnterCombatWithTrio(who);
_scheduler.Schedule(4s, 8s, [this](TaskContext context)
_scheduler.Schedule(7s, 18s, [this](TaskContext context)
{
DoCastVictim(SPELL_CLEAVE);
context.Repeat(5s, 12s);
context.Repeat();
})
.Schedule(6s, 30s, [this](TaskContext context)
.Schedule(8s, 17s, [this](TaskContext context)
{
DoCastVictim(SPELL_TOXIC_VOLLEY);
context.Repeat(10s, 25s);
context.Repeat();
})
.Schedule(6s, [this](TaskContext context)
.Schedule(7s, 16s, [this](TaskContext context)
{
DoCastVictim(SPELL_THRASH);
context.Repeat(2s, 6s);
context.Repeat();
});
}
};
@@ -343,25 +365,17 @@ struct boss_vem : public boss_bug_trio
{
DoCast(target, SPELL_CHARGE);
}
context.Repeat(8s, 16s);
context.Repeat();
})
.Schedule(10s, 20s, [this](TaskContext context)
.Schedule(10s, 24s, [this](TaskContext context)
{
DoCastVictim(SPELL_KNOCKBACK);
context.Repeat(10s, 20s);
context.Repeat();
})
.Schedule(5s, 8s, [this](TaskContext context)
.Schedule(10s, 23s, [this](TaskContext context)
{
DoCastVictim(SPELL_KNOCKDOWN);
context.Repeat(15s, 20s);
})
.Schedule(1s, [this](TaskContext context)
{
if (instance->GetData(DATA_BUG_TRIO_DEATH) == 2 && !me->HasAura(SPELL_VENGEANCE)) // Vem is the only one left.
{
DoCastSelf(SPELL_VENGEANCE, true);
}
context.Repeat(1s);
context.Repeat();
});
}
};
@@ -376,7 +390,7 @@ struct boss_yauj : public boss_bug_trio
{
EnterCombatWithTrio(who);
_scheduler.Schedule(20s, 30s, [this](TaskContext context)
_scheduler.Schedule(12100ms, [this](TaskContext context)
{
if (me->GetHealthPct() <= 93.f)
{
@@ -386,18 +400,20 @@ struct boss_yauj : public boss_bug_trio
{
DoCast(friendly, SPELL_HEAL);
}
context.Repeat(10s, 30s);
})
.Schedule(12s, 24s, [this](TaskContext context)
{
DoCastAOE(SPELL_FEAR);
DoResetThreat();
context.Repeat(20s);
context.Repeat();
})
.Schedule(12s, [this](TaskContext context)
{
DoCastVictim(SPELL_RAVAGE);
context.Repeat(10s, 15s);
DoCastAOE(SPELL_FEAR);
DoResetThreat();
context.Repeat(20600ms);
})
.Schedule(11s, 14500ms, [this](TaskContext context)
{
if (DoCastVictim(SPELL_RAVAGE) == SPELL_CAST_OK)
context.Repeat(10s, 15s);
else
context.Repeat(1200ms);
})
.Schedule(10s, 30s, [this](TaskContext context)
{

View File

@@ -24,6 +24,9 @@
ObjectData const creatureData[] =
{
{ NPC_VEM, DATA_VEM },
{ NPC_KRI, DATA_KRI },
{ NPC_YAUJ, DATA_YAUJ },
{ NPC_SARTURA, DATA_SARTURA },
{ NPC_CTHUN, DATA_CTHUN },
{ NPC_EYE_OF_CTHUN, DATA_EYE_OF_CTHUN },
@@ -62,9 +65,6 @@ public:
}
ObjectGuid SkeramGUID;
ObjectGuid VemGUID;
ObjectGuid KriGUID;
ObjectGuid YaujGUID;
ObjectGuid CThunGUID;
GuidVector CThunGraspGUIDs;
@@ -86,15 +86,6 @@ public:
case NPC_SKERAM:
SkeramGUID = creature->GetGUID();
break;
case NPC_VEM:
VemGUID = creature->GetGUID();
break;
case NPC_KRI:
KriGUID = creature->GetGUID();
break;
case NPC_YAUJ:
YaujGUID = creature->GetGUID();
break;
case NPC_OURO_SPAWNER:
if (GetBossState(DATA_OURO) != DONE)
creature->Respawn();
@@ -194,12 +185,6 @@ public:
{
case DATA_SKERAM:
return SkeramGUID;
case DATA_VEM:
return VemGUID;
case DATA_KRI:
return KriGUID;
case DATA_YAUJ:
return YaujGUID;
}
return ObjectGuid::Empty;
}

View File

@@ -241,94 +241,61 @@ class boss_anub_arak : public CreatureScript
}
};
class spell_azjol_nerub_carrion_beetels : public SpellScriptLoader
class spell_azjol_nerub_carrion_beetels : public AuraScript
{
public:
spell_azjol_nerub_carrion_beetels() : SpellScriptLoader("spell_azjol_nerub_carrion_beetels") { }
PrepareAuraScript(spell_azjol_nerub_carrion_beetels)
class spell_azjol_nerub_carrion_beetelsAuraScript : public AuraScript
{
PrepareAuraScript(spell_azjol_nerub_carrion_beetelsAuraScript)
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
// Xinef: 2 each second
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_CARRION_BEETLES, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_CARRION_BEETLES, true);
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
// Xinef: 2 each second
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_CARRION_BEETLES, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_CARRION_BEETLES, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_azjol_nerub_carrion_beetelsAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript *GetAuraScript() const override
{
return new spell_azjol_nerub_carrion_beetelsAuraScript();
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_azjol_nerub_carrion_beetels::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
class spell_azjol_nerub_pound : public SpellScriptLoader
class spell_azjol_nerub_pound : public SpellScript
{
public:
spell_azjol_nerub_pound() : SpellScriptLoader("spell_azjol_nerub_pound") { }
PrepareSpellScript(spell_azjol_nerub_pound);
class spell_azjol_nerub_pound_SpellScript : public SpellScript
{
PrepareSpellScript(spell_azjol_nerub_pound_SpellScript);
void HandleApplyAura(SpellEffIndex /*effIndex*/)
{
if (Unit* unitTarget = GetHitUnit())
GetCaster()->CastSpell(unitTarget, SPELL_POUND_DAMAGE, true);
}
void HandleApplyAura(SpellEffIndex /*effIndex*/)
{
if (Unit* unitTarget = GetHitUnit())
GetCaster()->CastSpell(unitTarget, SPELL_POUND_DAMAGE, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_azjol_nerub_pound_SpellScript::HandleApplyAura, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_azjol_nerub_pound_SpellScript();
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_azjol_nerub_pound::HandleApplyAura, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
class spell_azjol_nerub_impale_summon : public SpellScriptLoader
class spell_azjol_nerub_impale_summon : public SpellScript
{
public:
spell_azjol_nerub_impale_summon() : SpellScriptLoader("spell_azjol_nerub_impale_summon") { }
PrepareSpellScript(spell_azjol_nerub_impale_summon);
class spell_azjol_nerub_impale_summon_SpellScript : public SpellScript
{
PrepareSpellScript(spell_azjol_nerub_impale_summon_SpellScript);
void SetDest(SpellDestination& dest)
{
// Adjust effect summon position
float floorZ = GetCaster()->GetMapHeight(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ(), true);
if (floorZ > INVALID_HEIGHT)
dest._position.m_positionZ = floorZ;
}
void SetDest(SpellDestination& dest)
{
// Adjust effect summon position
float floorZ = GetCaster()->GetMapHeight(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ(), true);
if (floorZ > INVALID_HEIGHT)
dest._position.m_positionZ = floorZ;
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_azjol_nerub_impale_summon_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_azjol_nerub_impale_summon_SpellScript();
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_azjol_nerub_impale_summon::SetDest, EFFECT_0, TARGET_DEST_CASTER);
}
};
void AddSC_boss_anub_arak()
{
new boss_anub_arak();
new spell_azjol_nerub_carrion_beetels();
new spell_azjol_nerub_pound();
new spell_azjol_nerub_impale_summon();
RegisterSpellScript(spell_azjol_nerub_carrion_beetels);
RegisterSpellScript(spell_azjol_nerub_pound);
RegisterSpellScript(spell_azjol_nerub_impale_summon);
}

View File

@@ -31,6 +31,11 @@
#include "SpellScript.h"
#include "WorldSession.h"
enum MassiveSeaforiumCharge
{
ITEM_MASSIVE_SEAFORIUM_CHARGE = 39213,
};
class spell_item_massive_seaforium_charge : public SpellScript
{
PrepareSpellScript(spell_item_massive_seaforium_charge);
@@ -41,7 +46,7 @@ class spell_item_massive_seaforium_charge : public SpellScript
return;
Player* target = GetHitUnit()->ToPlayer();
target->DestroyItemCount(39213, 1, true);
target->DestroyItemCount(ITEM_MASSIVE_SEAFORIUM_CHARGE, 1, true);
}
void Register() override
@@ -136,6 +141,11 @@ class spell_item_mind_amplify_dish : public SpellScript
}
};
enum RunescrollOfFortitude
{
SPELL_FORTITUDE = 72590,
};
class spell_item_runescroll_of_fortitude : public SpellScript
{
PrepareSpellScript(spell_item_runescroll_of_fortitude)
@@ -149,7 +159,7 @@ class spell_item_runescroll_of_fortitude : public SpellScript
if (target->getLevel() < 70)
return;
target->CastSpell(target, 72590, true); // Stamina spell (Fortitude)
target->CastSpell(target, SPELL_FORTITUDE, true);
}
}
@@ -159,6 +169,12 @@ class spell_item_runescroll_of_fortitude : public SpellScript
}
};
enum BrannsCommunicator
{
NPC_BRANN_BRONZEBEARD = 29579,
SPELL_CONTACT_BRANN = 55038,
};
class spell_item_branns_communicator : public SpellScript
{
PrepareSpellScript(spell_item_branns_communicator)
@@ -169,8 +185,8 @@ class spell_item_branns_communicator : public SpellScript
if (Player* target = GetHitPlayer())
{
target->KilledMonsterCredit(29579); // Brann's entry
target->CastSpell(target, 55038, true); // Brann summoning spell
target->KilledMonsterCredit(NPC_BRANN_BRONZEBEARD); // Brann's entry
target->CastSpell(target, SPELL_CONTACT_BRANN, true); // Brann summoning spell
}
}
@@ -2301,6 +2317,7 @@ enum Shadowmourne
SPELL_SHADOWMOURNE_VISUAL_LOW = 72521,
SPELL_SHADOWMOURNE_VISUAL_HIGH = 72523,
SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF = 73422,
SPELL_BLOOD_PLAGUE = 55078,
};
// 71903 - Item - Shadowmourne Legendary
@@ -2336,7 +2353,7 @@ class spell_item_shadowmourne : public AuraScript
}
else if (procSpell->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
{
if (procSpell->Id != 55078 /*Blood Plague*/)
if (procSpell->Id != SPELL_BLOOD_PLAGUE)
return false;
}
}