From a1e0e2e1d038f732b2a6d42b9d50b659a69b1b36 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 18 Nov 2021 20:13:29 -0500 Subject: [PATCH] Core/Scripts: Move some spells to scripts Port From (https://github.com/TrinityCore/TrinityCore/commit/3b1ed434aeacfa57f392387c2176dfb4438b13f8) --- Source/Framework/Constants/CreatureConst.cs | 2 +- Source/Game/Spells/SpellEffects.cs | 33 ------------------- Source/Scripts/Spells/Generic.cs | 25 ++++++++++++-- ...021_11_18_03_world_2019_01_05_01_world.sql | 9 +++++ 4 files changed, 33 insertions(+), 36 deletions(-) create mode 100644 sql/updates/world/master/2021_11_18_03_world_2019_01_05_01_world.sql diff --git a/Source/Framework/Constants/CreatureConst.cs b/Source/Framework/Constants/CreatureConst.cs index c114c1a4b..41c86b778 100644 --- a/Source/Framework/Constants/CreatureConst.cs +++ b/Source/Framework/Constants/CreatureConst.cs @@ -260,7 +260,7 @@ namespace Framework.Constants WildPet = 14, Aberration = 15, - MaskDemonOrUnDead = (1 << (Demon - 1)) | (1 << (Undead - 1)), + MaskDemonOrUndead = (1 << (Demon - 1)) | (1 << (Undead - 1)), MaskHumanoidOrUndead = (1 << (Humanoid - 1)) | (1 << (Undead - 1)), MaskMechanicalOrElemental = (1 << (Mechanical - 1)) | (1 << (Elemental - 1)) } diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index d6d103803..c41f24751 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -161,39 +161,6 @@ namespace Game.Spells damage /= (int)count; } - switch (m_spellInfo.SpellFamilyName) - { - case SpellFamilyNames.Generic: - { - ///@todo: move those to scripts - switch (m_spellInfo.Id) // better way to check unknown - { - // Consumption - case 28865: - damage = 2750; - if (m_caster.GetMap().IsHeroic()) - damage = 4250; - break; - // percent from health with min - case 25599: // Thundercrash - { - damage = (int)unitTarget.GetHealth() / 2; - if (damage < 200) - damage = 200; - break; - } - // arcane charge. must only affect demons (also undead?) - case 45072: - { - if ((unitTarget.GetCreatureTypeMask() & (uint)CreatureType.MaskDemonOrUnDead) == 0) - return; - break; - } - } - break; - } - } - if (unitCaster != null && apply_direct_bonus) { uint bonus = unitCaster.SpellDamageBonusDone(unitTarget, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect, effectInfo); diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index cc48d9aed..a2cc88193 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -528,6 +528,27 @@ namespace Scripts.Spells.Generic } } + [Script] + class spell_gen_arcane_charge : SpellScript + { + SpellCastResult CheckRequirement() + { + Unit target = GetExplTargetUnit(); + if (target != null) + { + if ((target.GetCreatureTypeMask() & (uint)CreatureType.MaskDemonOrUndead) == 0) + return SpellCastResult.DontReport; + } + + return SpellCastResult.SpellCastOk; + } + + public override void Register() + { + OnCheckCast.Add(new CheckCastHandler(CheckRequirement)); + } + } + // 430 Drink // 431 Drink // 432 Drink @@ -1624,7 +1645,7 @@ namespace Scripts.Spells.Generic AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); } } - + [Script] // 131474 - Fishing class spell_gen_fishing : SpellScript { @@ -3832,4 +3853,4 @@ namespace Scripts.Spells.Generic OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); } } -} +} \ No newline at end of file diff --git a/sql/updates/world/master/2021_11_18_03_world_2019_01_05_01_world.sql b/sql/updates/world/master/2021_11_18_03_world_2019_01_05_01_world.sql new file mode 100644 index 000000000..7109d05b5 --- /dev/null +++ b/sql/updates/world/master/2021_11_18_03_world_2019_01_05_01_world.sql @@ -0,0 +1,9 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_four_horsemen_consumption', +'spell_rajaxx_thundercrash', +'spell_gen_arcane_charge'); + +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(28865, 'spell_four_horsemen_consumption'), +(25599, 'spell_rajaxx_thundercrash'), +(45072, 'spell_gen_arcane_charge');