From 26c42d517e120a5d4726ab1ec154f06bea20cb83 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 31 Dec 2020 15:49:46 -0500 Subject: [PATCH] Core/Spells: Ice Lance Port From (https://github.com/TrinityCore/TrinityCore/commit/041ceeed1a6c2a1f4418d348631fd051056ff5c0) --- Source/Game/Spells/SpellManager.cs | 2 +- Source/Scripts/Spells/Mage.cs | 103 +++++++++++++++++- .../world/master/2020_12_24_01_world.sql | 13 +++ 3 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 sql/updates/world/master/2020_12_24_01_world.sql diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index 70ce9c685..ac68d6dd8 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -2841,7 +2841,7 @@ namespace Game.Entities spellInfo.GetEffect(0).TriggerSpell = 33760; break; case 44544: // Fingers of Frost - spellInfo.GetEffect(0).SpellClassMask = new FlagArray128(685904631, 1151048, 0, 0); + spellInfo.GetEffect(0).SpellClassMask[0] |= 0x20000; break; case 52212: // Death and Decay case 41485: // Deadly Poison - Black Temple diff --git a/Source/Scripts/Spells/Mage.cs b/Source/Scripts/Spells/Mage.cs index 0c4ef752f..924ba9e07 100644 --- a/Source/Scripts/Spells/Mage.cs +++ b/Source/Scripts/Spells/Mage.cs @@ -54,6 +54,11 @@ namespace Scripts.Spells.Mage public const uint TemporalDisplacement = 80354; public const uint WorgenForm = 32819; public const uint Chilled = 205708; + public const uint IceLanceTrigger = 228598; + public const uint ThermalVoid = 155149; + public const uint IcyVeins = 12472; + public const uint ChainReactionDummy = 278309; + public const uint ChainReaction = 278310; //Misc public const uint HunterInsanity = 95809; @@ -238,6 +243,26 @@ namespace Scripts.Spells.Mage } } + [Script] // 44544 - Fingers of Frost + class spell_mage_fingers_of_frost : AuraScript + { + void SuppressWarning(AuraEffect aurEff, ProcEventInfo procInfo) + { + PreventDefaultAction(); + } + + void DropFingersOfFrost(ProcEventInfo eventInfo) + { + GetAura().ModStackAmount(-1); + } + + public override void Register() + { + OnEffectProc.Add(new EffectProcHandler(SuppressWarning, 1, AuraType.Dummy)); + AfterProc.Add(new AuraProcHandler(DropFingersOfFrost)); + } + } + [Script] // 11426 - Ice Barrier class spell_mage_ice_barrier : AuraScript { @@ -270,8 +295,82 @@ namespace Scripts.Spells.Mage } } - // 11119 - Ignite - [Script] + [Script] // Ice Lance - 30455 + class spell_mage_ice_lance : SpellScript + { + List _orderedTargets = new List(); + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.IceLanceTrigger, SpellIds.ThermalVoid, SpellIds.IcyVeins, SpellIds.ChainReactionDummy, SpellIds.ChainReaction, SpellIds.FingersOfFrost); + } + + void IndexTarget(uint effIndex) + { + _orderedTargets.Add(GetHitUnit().GetGUID()); + } + + void HandleOnHit(uint effIndex) + { + Unit caster = GetCaster(); + Unit target = GetHitUnit(); + + int index = _orderedTargets.IndexOf(target.GetGUID()); + + if (index == 0 // only primary target triggers these benefits + && target.HasAuraState(AuraStateType.Frozen, GetSpellInfo(), caster)) + { + // Thermal Void + Aura thermalVoid = caster.GetAura(SpellIds.ThermalVoid); + if (thermalVoid != null) + { + SpellEffectInfo thermalVoidEffect = thermalVoid.GetSpellInfo().GetEffect(0); + if (thermalVoidEffect != null) + { + Aura icyVeins = caster.GetAura(SpellIds.IcyVeins); + if (icyVeins != null) + icyVeins.SetDuration(icyVeins.GetDuration() + thermalVoidEffect.CalcValue(caster) * Time.InMilliseconds); + } + } + + // Chain Reaction + if (caster.HasAura(SpellIds.ChainReactionDummy)) + caster.CastSpell(caster, SpellIds.ChainReaction, true); + } + + // put target index for chain value multiplier into EFFECT_1 base points, otherwise triggered spell doesn't know which damage multiplier to apply + caster.CastCustomSpell(SpellIds.IceLanceTrigger, SpellValueMod.BasePoint1, index, target, true); + } + + public override void Register() + { + OnEffectLaunchTarget.Add(new EffectHandler(IndexTarget, 0, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new EffectHandler(HandleOnHit, 0, SpellEffectName.ScriptEffect)); + } + } + + [Script] // 228598 - Ice Lance + class spell_mage_ice_lance_damage : SpellScript + { + void ApplyDamageMultiplier(uint effIndex) + { + SpellValue spellValue = GetSpellValue(); + if ((spellValue.CustomBasePointsMask & (1 << 1)) != 0) + { + int originalDamage = GetHitDamage(); + float targetIndex = (float)spellValue.EffectBasePoints[1]; + float multiplier = MathF.Pow(GetEffectInfo().CalcDamageMultiplier(GetCaster(), GetSpell()), targetIndex); + SetHitDamage((int)(originalDamage * multiplier)); + } + } + + public override void Register() + { + OnEffectHitTarget.Add(new EffectHandler(ApplyDamageMultiplier, 0, SpellEffectName.SchoolDamage)); + } + } + + [Script] // 11119 - Ignite class spell_mage_ignite : AuraScript { public override bool Validate(SpellInfo spellInfo) diff --git a/sql/updates/world/master/2020_12_24_01_world.sql b/sql/updates/world/master/2020_12_24_01_world.sql new file mode 100644 index 000000000..5a9c83377 --- /dev/null +++ b/sql/updates/world/master/2020_12_24_01_world.sql @@ -0,0 +1,13 @@ +-- Fingers of Frost +DELETE FROM `spell_proc` WHERE `SpellId`=44544; +INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES +(44544,0,3,0,0,0,0x100,0x10000,0,0x4,0x3FFF,0,0,0,100,0,0); -- PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG; PROC_SPELL_PHASE_FINISH; PROC_HIT_MASK_ALL + +-- mage ice lance +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_mage_fingers_of_frost'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_mage_ice_lance'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_mage_ice_lance_damage'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(44544,'spell_mage_fingers_of_frost'), +(30455,'spell_mage_ice_lance'), +(228598,'spell_mage_ice_lance_damage');