fix(Scripts/SunwellPlateau): Move Dark Fiend from SmartAI to ScriptedAI with corrected despawn behavior (#21910)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
-- Remove SmartAI from dark fiend to ScriptedAI (c++)
|
||||||
|
UPDATE `creature_template` SET
|
||||||
|
`AIName` = '',
|
||||||
|
`ScriptName` = 'npc_dark_fiend'
|
||||||
|
WHERE `entry` = 25744;
|
||||||
@@ -51,7 +51,14 @@ enum Spells
|
|||||||
SPELL_BLACK_HOLE_SUMMON_VISUAL2 = 46247,
|
SPELL_BLACK_HOLE_SUMMON_VISUAL2 = 46247,
|
||||||
SPELL_BLACK_HOLE_VISUAL2 = 46235,
|
SPELL_BLACK_HOLE_VISUAL2 = 46235,
|
||||||
SPELL_BLACK_HOLE_PASSIVE = 46228,
|
SPELL_BLACK_HOLE_PASSIVE = 46228,
|
||||||
SPELL_BLACK_HOLE_EFFECT = 46230
|
SPELL_BLACK_HOLE_EFFECT = 46230,
|
||||||
|
|
||||||
|
// Dark Fiend Spells
|
||||||
|
SPELL_DARK_FIEND_APPEARANCE = 45934,
|
||||||
|
SPELL_DARK_FIEND_SECONDARY = 45936,
|
||||||
|
SPELL_DARK_FIEND_TRIGGER = 45944
|
||||||
|
// It is currently unkown why Dark Fiend Casts this or what it should do
|
||||||
|
//SPELL_DARK_FIEND_TRIGGER_SINGLE = 45943
|
||||||
};
|
};
|
||||||
|
|
||||||
struct boss_muru : public BossAI
|
struct boss_muru : public BossAI
|
||||||
@@ -67,6 +74,17 @@ struct boss_muru : public BossAI
|
|||||||
me->m_Events.KillAllEvents(false);
|
me->m_Events.KillAllEvents(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MoveInLineOfSight(Unit* who) override
|
||||||
|
{
|
||||||
|
// Radius of room is ~38.5f this might need adjusting a bit
|
||||||
|
// Radius ~36.0 is right inside
|
||||||
|
// Radius 20.0 is outer circle
|
||||||
|
if (!me->IsInCombat() && who->IsPlayer() && me->IsWithinDistInMap(who, 25.0f))
|
||||||
|
{
|
||||||
|
me->SetInCombatWithZone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void JustEngagedWith(Unit* who) override
|
void JustEngagedWith(Unit* who) override
|
||||||
{
|
{
|
||||||
BossAI::JustEngagedWith(who);
|
BossAI::JustEngagedWith(who);
|
||||||
@@ -174,6 +192,76 @@ struct boss_entropius : public ScriptedAI
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct npc_dark_fiend : public ScriptedAI
|
||||||
|
{
|
||||||
|
npc_dark_fiend(Creature* creature) : ScriptedAI(creature) { }
|
||||||
|
|
||||||
|
void Reset() override
|
||||||
|
{
|
||||||
|
_lastVictimGUID.Clear();
|
||||||
|
_spellCast = false;
|
||||||
|
|
||||||
|
me->SetReactState(REACT_PASSIVE);
|
||||||
|
DoCast(me, SPELL_DARK_FIEND_APPEARANCE);
|
||||||
|
DoCast(me, SPELL_DARK_FIEND_SECONDARY);
|
||||||
|
|
||||||
|
me->m_Events.AddEventAtOffset([this]() {
|
||||||
|
me->SetReactState(REACT_AGGRESSIVE);
|
||||||
|
if (Unit* target = SelectTargetFromPlayerList(200.0f, 0, true))
|
||||||
|
{
|
||||||
|
AttackStart(target);
|
||||||
|
me->AddThreat(target, 100000.0f);
|
||||||
|
}
|
||||||
|
}, 1s, 2s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damagetype*/, SpellSchoolMask /*schoolMask*/) override
|
||||||
|
{
|
||||||
|
if (damage >= me->GetHealth())
|
||||||
|
damage = me->GetHealth() - me->GetMaxHealth() * 0.01f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateAI(uint32 /*diff*/) override
|
||||||
|
{
|
||||||
|
if (!me->HasAura(SPELL_DARK_FIEND_APPEARANCE))
|
||||||
|
{
|
||||||
|
me->DespawnOrUnsummon();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if victim has changed or disappeared
|
||||||
|
Unit* currentVictim = me->GetVictim();
|
||||||
|
ObjectGuid currentVictimGUID = currentVictim ? currentVictim->GetGUID() : ObjectGuid::Empty;
|
||||||
|
|
||||||
|
if (_lastVictimGUID != currentVictimGUID)
|
||||||
|
{
|
||||||
|
// If had a victim before but now it's gone
|
||||||
|
if (!_lastVictimGUID.IsEmpty() && currentVictimGUID.IsEmpty())
|
||||||
|
me->DespawnOrUnsummon();
|
||||||
|
|
||||||
|
_lastVictimGUID = currentVictimGUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!UpdateVictim())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!_spellCast && currentVictim && me->IsWithinMeleeRange(currentVictim, 2.0f))
|
||||||
|
{
|
||||||
|
DoCast(me, SPELL_DARK_FIEND_TRIGGER);
|
||||||
|
_spellCast = true;
|
||||||
|
me->m_Events.AddEventAtOffset([this]() {
|
||||||
|
me->DespawnOrUnsummon();
|
||||||
|
}, 1s);
|
||||||
|
}
|
||||||
|
|
||||||
|
DoMeleeAttackIfReady();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
ObjectGuid _lastVictimGUID;
|
||||||
|
bool _spellCast;
|
||||||
|
};
|
||||||
|
|
||||||
struct npc_singularity : public NullCreatureAI
|
struct npc_singularity : public NullCreatureAI
|
||||||
{
|
{
|
||||||
npc_singularity(Creature* creature) : NullCreatureAI(creature) { }
|
npc_singularity(Creature* creature) : NullCreatureAI(creature) { }
|
||||||
@@ -270,7 +358,7 @@ class spell_muru_darkness_aura : public AuraScript
|
|||||||
|
|
||||||
void OnPeriodic(AuraEffect const* aurEff)
|
void OnPeriodic(AuraEffect const* aurEff)
|
||||||
{
|
{
|
||||||
if (aurEff->GetTickNumber() == 3)
|
if (aurEff->GetTickNumber() == 2)
|
||||||
for (uint8 i = 0; i < 8; ++i)
|
for (uint8 i = 0; i < 8; ++i)
|
||||||
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_DARK_FIEND + i, true);
|
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_DARK_FIEND + i, true);
|
||||||
}
|
}
|
||||||
@@ -390,6 +478,7 @@ void AddSC_boss_muru()
|
|||||||
RegisterSunwellPlateauCreatureAI(boss_muru);
|
RegisterSunwellPlateauCreatureAI(boss_muru);
|
||||||
RegisterSunwellPlateauCreatureAI(boss_entropius);
|
RegisterSunwellPlateauCreatureAI(boss_entropius);
|
||||||
RegisterSunwellPlateauCreatureAI(npc_singularity);
|
RegisterSunwellPlateauCreatureAI(npc_singularity);
|
||||||
|
RegisterSunwellPlateauCreatureAI(npc_dark_fiend);
|
||||||
|
|
||||||
RegisterSpellScript(spell_muru_summon_blood_elves_periodic_aura);
|
RegisterSpellScript(spell_muru_summon_blood_elves_periodic_aura);
|
||||||
RegisterSpellScript(spell_muru_darkness_aura);
|
RegisterSpellScript(spell_muru_darkness_aura);
|
||||||
|
|||||||
Reference in New Issue
Block a user