diff --git a/data/sql/updates/pending_db_world/rev_1658855914422981600.sql b/data/sql/updates/pending_db_world/rev_1658855914422981600.sql new file mode 100644 index 000000000..16915e909 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1658855914422981600.sql @@ -0,0 +1,8 @@ +-- +DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_crystal_weakness'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(25177, 'spell_crystal_weakness'), +(25178, 'spell_crystal_weakness'), +(25180, 'spell_crystal_weakness'), +(25181, 'spell_crystal_weakness'), +(25183, 'spell_crystal_weakness'); diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp index bfa85bc52..f6ae0b579 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp @@ -21,6 +21,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellInfo.h" +#include "SpellScript.h" #include "ruins_of_ahnqiraj.h" #include "TaskScheduler.h" @@ -40,7 +41,14 @@ enum Spells SPELL_WAR_STOMP = 25188, SPELL_STRENGHT_OF_OSSIRIAN = 25176, SPELL_SAND_STORM = 25160, - SPELL_SUMMON_CRYSTAL = 25192 + SPELL_SUMMON_CRYSTAL = 25192, + + // Crystal + SPELL_FIRE_WEAKNESS = 25177, + SPELL_FROST_WEAKNESS = 25178, + SPELL_NATURE_WEAKNESS = 25180, + SPELL_ARCANE_WEAKNESS = 25181, + SPELL_SHADOW_WEAKNESS = 25183 }; enum Actions @@ -72,7 +80,8 @@ Position CrystalCoordinates[NUM_CRYSTALS] = float roomRadius = 165.0f; uint8 const NUM_TORNADOS = 2; uint8 const NUM_WEAKNESS = 5; -uint32 const spellWeakness[NUM_WEAKNESS] = { 25177, 25178, 25180, 25181, 25183 }; +uint32 const spellWeakness[NUM_WEAKNESS] = +{ SPELL_FIRE_WEAKNESS, SPELL_FROST_WEAKNESS, SPELL_NATURE_WEAKNESS, SPELL_ARCANE_WEAKNESS, SPELL_SHADOW_WEAKNESS }; Position const RoomCenter = { -9343.041992f, 1923.278198f, 85.555984f, 0.0 }; struct boss_ossirian : public BossAI @@ -92,7 +101,7 @@ struct boss_ossirian : public BossAI void SpellHit(Unit* caster, SpellInfo const* spell) override { - for (uint8 weakness : spellWeakness) + for (uint32 weakness : spellWeakness) { if (spell->Id == weakness) { @@ -220,7 +229,7 @@ struct boss_ossirian : public BossAI } else { - for (uint8 weakness : spellWeakness) + for (uint32 weakness : spellWeakness) { if (me->HasAura(weakness)) { @@ -363,9 +372,28 @@ private: TaskScheduler _scheduler; }; +class spell_crystal_weakness : public SpellScript +{ + PrepareSpellScript(spell_crystal_weakness); + + void FilterTargets(std::list& targets) + { + targets.remove_if([&](WorldObject const* target) -> bool + { + return target->GetEntry() != NPC_OSSIRIAN; + }); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_crystal_weakness::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENTRY); + } +}; + void AddSC_boss_ossirian() { RegisterRuinsOfAhnQirajCreatureAI(boss_ossirian); new go_ossirian_crystal(); RegisterCreatureAI(npc_anubisath_guardian); + RegisterSpellScript(spell_crystal_weakness); }