mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Script/Ulduar: Fixed conflict with Random Aggro Periodic spell (#26184)
This commit is contained in:
3
sql/updates/world/3.3.5/2021_02_28_00_world.sql
Normal file
3
sql/updates/world/3.3.5/2021_02_28_00_world.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_auriaya_random_agro_periodic','spell_ulduar_random_aggro_periodic');
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(61906,'spell_ulduar_random_aggro_periodic');
|
||||
@@ -233,13 +233,13 @@ struct boss_auriaya : public BossAI
|
||||
{
|
||||
case EVENT_SONIC_SCREECH:
|
||||
DoCastVictim(SPELL_SONIC_SCREECH);
|
||||
events.Repeat(Seconds(22), Seconds(30));
|
||||
events.Repeat(22s, 30s);
|
||||
break;
|
||||
case EVENT_TERRIFYING_SCREECH:
|
||||
Talk(EMOTE_FEAR);
|
||||
DoCastSelf(SPELL_TERRIFYING_SCREECH);
|
||||
events.ScheduleEvent(EVENT_BLAST, Milliseconds(1));
|
||||
events.Repeat(Seconds(36), Seconds(45));
|
||||
events.ScheduleEvent(EVENT_BLAST, 1ms);
|
||||
events.Repeat(36s, 45s);
|
||||
break;
|
||||
case EVENT_BLAST:
|
||||
DoCastAOE(SPELL_SENTINEL_BLAST);
|
||||
@@ -255,7 +255,7 @@ struct boss_auriaya : public BossAI
|
||||
case EVENT_SWARNING_GUARDIAN:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
|
||||
DoCast(target, SPELL_SUMMON_SWARMING_GUARDIAN);
|
||||
events.Repeat(Seconds(25), Seconds(45));
|
||||
events.Repeat(25s, 45s);
|
||||
break;
|
||||
case EVENT_BERSERK:
|
||||
DoCastSelf(SPELL_BERSERK, true);
|
||||
@@ -291,7 +291,7 @@ struct npc_sanctum_sentry : public ScriptedAI
|
||||
void JustEngagedWith(Unit* /*who*/) override
|
||||
{
|
||||
_events.ScheduleEvent(EVENT_RIP, 6s);
|
||||
_events.ScheduleEvent(EVENT_SAVAGE_POUNCE, Milliseconds(1));
|
||||
_events.ScheduleEvent(EVENT_SAVAGE_POUNCE, 1ms);
|
||||
me->SetWalk(false);
|
||||
}
|
||||
|
||||
@@ -317,16 +317,16 @@ struct npc_sanctum_sentry : public ScriptedAI
|
||||
{
|
||||
case EVENT_RIP:
|
||||
DoCastVictim(SPELL_RIP_FLESH);
|
||||
_events.Repeat(Seconds(10), Seconds(12));
|
||||
_events.Repeat(10s, 12s);
|
||||
break;
|
||||
case EVENT_SAVAGE_POUNCE:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, CatsTargetSelector(me, 10.0f, 15.0f)))
|
||||
{
|
||||
DoCast(target, SPELL_SAVAGE_POUNCE);
|
||||
_events.Repeat(Seconds(10));
|
||||
_events.Repeat(10s);
|
||||
break;
|
||||
}
|
||||
_events.Repeat(Seconds(1));
|
||||
_events.Repeat(1s);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -382,22 +382,39 @@ struct npc_feral_defender : public ScriptedAI
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
|
||||
AttackStart(target);
|
||||
_events.ScheduleEvent(EVENT_RUSH, 1s);
|
||||
_events.ScheduleEvent(EVENT_FERAL_POUNCE, 5s);
|
||||
break;
|
||||
case EVENT_FERAL_POUNCE:
|
||||
if (me->GetReactState() != REACT_PASSIVE)
|
||||
{
|
||||
if (Unit* target = me->GetVictim())
|
||||
{
|
||||
float distance = me->GetDistance2d(target);
|
||||
if (distance > 5.0f && distance <= 45.0f)
|
||||
{
|
||||
DoCastVictim(SPELL_FERAL_POUNCE);
|
||||
_events.Repeat(5s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_events.Repeat(1s);
|
||||
break;
|
||||
case EVENT_RUSH:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, CatsTargetSelector(me, 10.0f, 11.0f)))
|
||||
{
|
||||
DoCast(target, SPELL_FERAL_RUSH, true);
|
||||
_events.Repeat(Seconds(5));
|
||||
_events.Repeat(5s);
|
||||
break;
|
||||
}
|
||||
_events.Repeat(Seconds(1));
|
||||
_events.Repeat(1s);
|
||||
break;
|
||||
case EVENT_RESPAWN_DEFENDER:
|
||||
me->SetDisableGravity(true);
|
||||
me->SetHover(true);
|
||||
DoCastSelf(SPELL_DROWNED_STATE, true);
|
||||
_events.ScheduleEvent(EVENT_RESPAWN_DEFENDER_2, Seconds(3));
|
||||
_events.ScheduleEvent(EVENT_RESPAWN_DEFENDER_3, Seconds(5));
|
||||
_events.ScheduleEvent(EVENT_RESPAWN_DEFENDER_2, 3s);
|
||||
_events.ScheduleEvent(EVENT_RESPAWN_DEFENDER_3, 5s);
|
||||
break;
|
||||
case EVENT_RESPAWN_DEFENDER_2:
|
||||
me->RemoveAurasDueToSpell(SPELL_DROWNED_STATE);
|
||||
@@ -409,6 +426,7 @@ struct npc_feral_defender : public ScriptedAI
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
me->SetDisableGravity(false);
|
||||
me->SetHover(false);
|
||||
DoCastSelf(SPELL_RANDOM_AGRO_PERIODIC, true);
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
|
||||
AttackStart(target);
|
||||
_events.ScheduleEvent(EVENT_RUSH, 1s);
|
||||
@@ -434,6 +452,7 @@ struct npc_feral_defender : public ScriptedAI
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
me->AttackStop();
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
me->RemoveAurasDueToSpell(SPELL_RANDOM_AGRO_PERIODIC);
|
||||
DoCastSelf(SPELL_PERMANENT_FEIGN_DEATH, true);
|
||||
DoCastSelf(SPELL_FERAL_ESSENCE_APPLICATION_REMOVAL, true);
|
||||
DoCastSelf(SPELL_SUMMON_ESSENCE, true);
|
||||
@@ -464,7 +483,7 @@ struct npc_swarming_guardian : public ScriptedAI
|
||||
void Reset() override
|
||||
{
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
_scheduler.Schedule(Seconds(1), [this](TaskContext /*context*/)
|
||||
_scheduler.Schedule(1s, [this](TaskContext /*context*/)
|
||||
{
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
DoCastSelf(SPELL_AGRO_CREATOR);
|
||||
@@ -576,45 +595,6 @@ class spell_auriaya_agro_creator : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
// 61906 - Random Aggro Periodic (5 sec)
|
||||
class spell_auriaya_random_agro_periodic : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_auriaya_random_agro_periodic);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_FERAL_POUNCE });
|
||||
}
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
Creature* owner = GetUnitOwner()->ToCreature();
|
||||
if (!owner || !owner->IsAIEnabled() || owner->HasReactState(REACT_PASSIVE))
|
||||
return;
|
||||
|
||||
bool farTarget = true;
|
||||
Unit* target = owner->AI()->SelectTarget(SelectTargetMethod::Random, 0, CatsTargetSelector(owner, 15.0f, 25.0f));
|
||||
if (!target)
|
||||
{
|
||||
farTarget = false;
|
||||
target = owner->AI()->SelectTarget(SelectTargetMethod::Random, 0);
|
||||
}
|
||||
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
owner->GetThreatManager().AddThreat(target, 3000000.0f, nullptr, true);
|
||||
if (farTarget)
|
||||
owner->CastSpell(target, SPELL_FERAL_POUNCE, true);
|
||||
owner->AI()->AttackStart(target);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_auriaya_random_agro_periodic::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 64456 - Feral Essence Application Removal
|
||||
class spell_auriaya_feral_essence_removal : public SpellScript
|
||||
{
|
||||
@@ -704,7 +684,6 @@ void AddSC_boss_auriaya()
|
||||
RegisterSpellScript(spell_auriaya_strenght_of_the_pack);
|
||||
RegisterSpellScript(spell_auriaya_sentinel_blast);
|
||||
RegisterSpellScript(spell_auriaya_agro_creator);
|
||||
RegisterSpellScript(spell_auriaya_random_agro_periodic);
|
||||
RegisterSpellScript(spell_auriaya_feral_essence_removal);
|
||||
RegisterSpellScript(spell_auriaya_feral_rush);
|
||||
new achievement_nine_lives();
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include "Map.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Spell.h"
|
||||
#include "SpellScript.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "Vehicle.h"
|
||||
#include "WorldStatePackets.h"
|
||||
@@ -1082,43 +1080,7 @@ class instance_ulduar : public InstanceMapScript
|
||||
}
|
||||
};
|
||||
|
||||
class spell_ulduar_teleporter : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_ulduar_teleporter() : SpellScriptLoader("spell_ulduar_teleporter") { }
|
||||
|
||||
class spell_ulduar_teleporter_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_ulduar_teleporter_SpellScript);
|
||||
|
||||
SpellCastResult CheckRequirement()
|
||||
{
|
||||
if (GetExplTargetUnit()->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
||||
if (GetExplTargetUnit()->IsInCombat())
|
||||
{
|
||||
Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), 0, SPELL_FAILED_AFFECTING_COMBAT);
|
||||
return SPELL_FAILED_AFFECTING_COMBAT;
|
||||
}
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_ulduar_teleporter_SpellScript::CheckRequirement);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
return new spell_ulduar_teleporter_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_instance_ulduar()
|
||||
{
|
||||
new instance_ulduar();
|
||||
new spell_ulduar_teleporter();
|
||||
}
|
||||
|
||||
84
src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp
Normal file
84
src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "Spell.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellScript.h"
|
||||
|
||||
// 61906 - Random Aggro Periodic (5 sec)
|
||||
class spell_ulduar_random_aggro_periodic : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_ulduar_random_aggro_periodic);
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->GetThreatManager().ResetAllThreat();
|
||||
if (!target->IsAIEnabled())
|
||||
return;
|
||||
|
||||
if (Unit* victim = target->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true, false))
|
||||
{
|
||||
target->GetThreatManager().AddThreat(victim, 3000000.0f, nullptr, true, true);
|
||||
target->GetAI()->AttackStart(victim);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ulduar_random_aggro_periodic::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 64014 - Expedition Base Camp Teleport
|
||||
// 64025 - Halls of Invention Teleport
|
||||
// 64028 - Colossal Forge Teleport
|
||||
// 64029 - Shattered Walkway Teleport
|
||||
// 64030 - Antechamber Teleport
|
||||
// 64032 - Formation Grounds Teleport
|
||||
// 65042 - Prison of Yogg-Saron Teleport
|
||||
class spell_ulduar_teleporter : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_ulduar_teleporter);
|
||||
|
||||
SpellCastResult CheckRequirement()
|
||||
{
|
||||
if (GetExplTargetUnit()->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
||||
if (GetExplTargetUnit()->IsInCombat())
|
||||
{
|
||||
Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), 0, SPELL_FAILED_AFFECTING_COMBAT);
|
||||
return SPELL_FAILED_AFFECTING_COMBAT;
|
||||
}
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_ulduar_teleporter::CheckRequirement);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_ulduar()
|
||||
{
|
||||
RegisterSpellScript(spell_ulduar_teleporter);
|
||||
RegisterSpellScript(spell_ulduar_random_aggro_periodic);
|
||||
}
|
||||
@@ -122,6 +122,7 @@ void AddSC_boss_thorim();
|
||||
void AddSC_boss_yogg_saron();
|
||||
void AddSC_boss_algalon_the_observer();
|
||||
void AddSC_instance_ulduar();
|
||||
void AddSC_ulduar();
|
||||
// Utgarde Keep - Utgarde Keep
|
||||
void AddSC_boss_keleseth();
|
||||
void AddSC_boss_skarvald_dalronn();
|
||||
@@ -317,6 +318,7 @@ void AddNorthrendScripts()
|
||||
AddSC_boss_yogg_saron();
|
||||
AddSC_boss_algalon_the_observer();
|
||||
AddSC_instance_ulduar();
|
||||
AddSC_ulduar();
|
||||
// Utgarde Keep - Utgarde Keep
|
||||
AddSC_boss_keleseth();
|
||||
AddSC_boss_skarvald_dalronn();
|
||||
|
||||
Reference in New Issue
Block a user