From 74298050ad596f5ee48c5deac3f0ed47d21ba83d Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 29 May 2023 22:16:32 -0400 Subject: [PATCH] Scripts/Spells: Added proc requirements to a few auras that have SPELL_ATTR3_CAN_PROC_FROM_PROCS attribute Port From (https://github.com/TrinityCore/TrinityCore/commit/092119058ba11e6d9d0b929787693c70032aebe1) --- Source/Scripts/Shadowlands/SpellCovenant.cs | 37 ++++++ .../Shadowlands/Torghast/SpellTorghast.cs | 124 ++++++++++++++++++ Source/Scripts/Spells/Azerite.cs | 59 ++++++++- Source/Scripts/Spells/Items.cs | 70 ++++++++++ 4 files changed, 288 insertions(+), 2 deletions(-) create mode 100644 Source/Scripts/Shadowlands/SpellCovenant.cs create mode 100644 Source/Scripts/Shadowlands/Torghast/SpellTorghast.cs diff --git a/Source/Scripts/Shadowlands/SpellCovenant.cs b/Source/Scripts/Shadowlands/SpellCovenant.cs new file mode 100644 index 000000000..269cb03b2 --- /dev/null +++ b/Source/Scripts/Shadowlands/SpellCovenant.cs @@ -0,0 +1,37 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Framework.Constants; +using Game.Entities; +using Game.Scripting; +using Game.Spells; + +namespace Scripts.Shadowlands +{ + [Script] // 323916 - Sulfuric Emission + class spell_soulbind_sulfuric_emission : AuraScript + { + static uint SPELL_SULFURIC_EMISSION_COOLDOWN_AURA = 347684; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SPELL_SULFURIC_EMISSION_COOLDOWN_AURA); + } + + bool CheckProc(AuraEffect aurEff, ProcEventInfo procInfo) + { + if (!procInfo.GetProcTarget().HealthBelowPct(aurEff.GetAmount())) + return false; + + if (procInfo.GetProcTarget().HasAura(SPELL_SULFURIC_EMISSION_COOLDOWN_AURA)) + return false; + + return true; + } + + public override void Register() + { + DoCheckEffectProc.Add(new CheckEffectProcHandler(CheckProc, 0, AuraType.ProcTriggerSpell)); + } + } +} diff --git a/Source/Scripts/Shadowlands/Torghast/SpellTorghast.cs b/Source/Scripts/Shadowlands/Torghast/SpellTorghast.cs new file mode 100644 index 000000000..bded2d4ac --- /dev/null +++ b/Source/Scripts/Shadowlands/Torghast/SpellTorghast.cs @@ -0,0 +1,124 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Framework.Constants; +using Game.Entities; +using Game.Scripting; +using Game.Spells; +using System.Collections.Generic; + +using static Global; + +namespace Scripts.Shadowlands.Torghast +{ + [Script] // 300771 - Blade of the Lifetaker + class spell_torghast_blade_of_the_lifetaker : AuraScript + { + void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo) + { + PreventDefaultAction(); + + procInfo.GetActor().CastSpell(procInfo.GetProcTarget(), aurEff.GetSpellEffectInfo().TriggerSpell, new CastSpellExtraArgs(aurEff) + .AddSpellMod(SpellValueMod.BasePoint0, (int)GetTarget().CountPctFromMaxHealth(aurEff.GetAmount())) + .SetTriggeringSpell(procInfo.GetProcSpell())); + } + + public override void Register() + { + OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell)); + } + } + + [Script] // 300796 - Touch of the Unseen + class spell_torghast_touch_of_the_unseen : AuraScript + { + static uint SPELL_DOOR_OF_SHADOWS = 300728; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SPELL_DOOR_OF_SHADOWS); + } + + bool CheckProc(ProcEventInfo procInfo) + { + return procInfo.GetSpellInfo() != null && procInfo.GetSpellInfo().Id == SPELL_DOOR_OF_SHADOWS; + } + + void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo) + { + PreventDefaultAction(); + + procInfo.GetActor().CastSpell(procInfo.GetProcTarget(), aurEff.GetSpellEffectInfo().TriggerSpell, new CastSpellExtraArgs(aurEff) + .AddSpellMod(SpellValueMod.BasePoint0, (int)GetTarget().CountPctFromMaxHealth(aurEff.GetAmount())) + .SetTriggeringSpell(procInfo.GetProcSpell())); + } + + public override void Register() + { + DoCheckProc.Add(new CheckProcHandler(CheckProc)); + OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell)); + } + } + + [Script] // 305060 - Yel'Shir's Powerglove + class spell_torghast_yelshirs_powerglove : SpellScript + { + void HandleEffect(uint effIndex) + { + SpellInfo triggeringSpell = GetTriggeringSpell(); + if (triggeringSpell != null) + { + Aura triggerAura = GetCaster().GetAura(triggeringSpell.Id); + if (triggerAura != null) + SetEffectValue(GetEffectValue() * triggerAura.GetStackAmount()); + } + } + + public override void Register() + { + OnEffectLaunchTarget.Add(new EffectHandler(HandleEffect, 0, SpellEffectName.SchoolDamage)); + } + } + + [Script] // 321706 - Dimensional Blade + class spell_torghast_dimensional_blade : SpellScript + { + static uint SPELL_MAGE_BLINK = 1953; + static uint SPELL_MAGE_SHIMMER = 212653; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SPELL_MAGE_BLINK, SPELL_MAGE_SHIMMER); + } + + void FilterTargets(List targets) + { + if (!targets.Empty()) + { + GetCaster().GetSpellHistory().RestoreCharge(SpellMgr.GetSpellInfo(SPELL_MAGE_BLINK, Difficulty.None).ChargeCategoryId); + GetCaster().GetSpellHistory().RestoreCharge(SpellMgr.GetSpellInfo(SPELL_MAGE_SHIMMER, Difficulty.None).ChargeCategoryId); + } + + // filter targets by entry here and not with conditions table because we need to know if any enemy was hit for charge restoration, not just mawrats + targets.RemoveAll(target => + { + switch (target.GetEntry()) + { + case 151353: // Mawrat + case 179458: // Protective Mawrat + case 154030: // Oddly Large Mawrat + case 169871: // Hungry Mawrat + return false; + default: + break; + } + return true; + }); + } + + public override void Register() + { + OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitDestAreaEnemy)); + } + } +} diff --git a/Source/Scripts/Spells/Azerite.cs b/Source/Scripts/Spells/Azerite.cs index cf3966ece..17b031ce0 100644 --- a/Source/Scripts/Spells/Azerite.cs +++ b/Source/Scripts/Spells/Azerite.cs @@ -6,6 +6,7 @@ using Game.Entities; using Game.Networking.Packets; using Game.Scripting; using Game.Spells; +using System; using System.Collections.Generic; namespace Scripts.Spells.Azerite @@ -426,7 +427,7 @@ namespace Scripts.Spells.Azerite { AuraEffect trait = GetCaster().GetAuraEffect(SpellIds.EchoingBladesTrait, 2); if (trait != null) - SetHitDamage(trait.GetAmount() * 2); + SetHitDamage(trait.GetAmount() * 2); } void ForceCritical(Unit victim, ref float critChance) @@ -484,7 +485,40 @@ namespace Scripts.Spells.Azerite DoCheckEffectProc.Add(new CheckEffectProcHandler(CheckProc, 0, AuraType.ProcTriggerSpell)); } } - + + [Script] // 305723 - Strife (Azerite Essence) + class spell_item_conflict_rank3 : AuraScript + { + bool CheckProc(ProcEventInfo eventInfo) + { + if (eventInfo.GetHitMask().HasAnyFlag(ProcFlagsHit.Interrupt | ProcFlagsHit.Dispel)) + return true; + + Spell procSpell = eventInfo.GetProcSpell(); + if (!procSpell) + return false; + + bool isCrowdControl = procSpell.GetSpellInfo().HasAura(AuraType.ModConfuse) + || procSpell.GetSpellInfo().HasAura(AuraType.ModFear) + || procSpell.GetSpellInfo().HasAura(AuraType.ModStun) + || procSpell.GetSpellInfo().HasAura(AuraType.ModPacify) + || procSpell.GetSpellInfo().HasAura(AuraType.ModRoot) + || procSpell.GetSpellInfo().HasAura(AuraType.ModSilence) + || procSpell.GetSpellInfo().HasAura(AuraType.ModPacifySilence) + || procSpell.GetSpellInfo().HasAura(AuraType.ModRoot2); + + if (!isCrowdControl) + return false; + + return eventInfo.GetActionTarget().HasAura(aura => aura.GetCastId() == procSpell.m_castId); + } + + public override void Register() + { + DoCheckProc.Add(new CheckProcHandler(CheckProc)); + } + } + [Script] // 277253 - Heart of Azeroth class spell_item_heart_of_azeroth : AuraScript { @@ -517,4 +551,25 @@ namespace Scripts.Spells.Azerite OnEffectRemove.Add(new EffectApplyHandler(ClearEquippedFlag, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); } } + + [Script] // 315176 - Grasping Tendrils + class spell_item_corruption_grasping_tendrils : AuraScript + { + public override bool Load() + { + return GetUnitOwner().IsPlayer(); + } + + void CalcAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated) + { + Player player = GetUnitOwner().ToPlayer(); + amount = (int)Math.Clamp(10.0f + player.GetRatingBonusValue(CombatRating.Corruption) - player.GetRatingBonusValue(CombatRating.CorruptionResistance), 0.0f, 99.0f); + canBeRecalculated = false; + } + + public override void Register() + { + DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalcAmount, 0, AuraType.ModDecreaseSpeed)); + } + } } diff --git a/Source/Scripts/Spells/Items.cs b/Source/Scripts/Spells/Items.cs index c6c743be5..3c77db3b6 100644 --- a/Source/Scripts/Spells/Items.cs +++ b/Source/Scripts/Spells/Items.cs @@ -4237,4 +4237,74 @@ namespace Scripts.Spells.Items DoCheckEffectProc.Add(new CheckEffectProcHandler(CheckProc, 0, AuraType.ProcTriggerSpell)); } } + + // 303358 Venomous Bolt + // 303361 Shivering Lance + [Script("spell_item_shiver_venom_crossbow", 303559)] + [Script("spell_item_shiver_venom_lance", 303562)] + class spell_item_shiver_venom_weapon_proc : AuraScript + { + static uint SPELL_SHIVER_VENOM = 301624; + + uint _additionalProcSpellId; + + public spell_item_shiver_venom_weapon_proc(uint additionalProcSpellId) + { + _additionalProcSpellId = additionalProcSpellId; + } + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SPELL_SHIVER_VENOM, _additionalProcSpellId); + } + + void HandleAdditionalProc(AuraEffect aurEff, ProcEventInfo procInfo) + { + if (procInfo.GetProcTarget().HasAura(SPELL_SHIVER_VENOM)) + procInfo.GetActor().CastSpell(procInfo.GetProcTarget(), _additionalProcSpellId, new CastSpellExtraArgs(aurEff) + .AddSpellMod(SpellValueMod.BasePoint0, aurEff.GetAmount()) + .SetTriggeringSpell(procInfo.GetProcSpell())); + } + + public override void Register() + { + OnEffectProc.Add(new EffectProcHandler(HandleAdditionalProc, 1, AuraType.Dummy)); + } + } + + [Script] // 302774 - Arcane Tempest + class spell_item_phial_of_the_arcane_tempest_damage : SpellScript + { + void ModifyStacks() + { + if (GetUnitTargetCountForEffect(0) != 1 || GetTriggeringSpell() == null) + return; + + AuraEffect aurEff = GetCaster().GetAuraEffect(GetTriggeringSpell().Id, 0); + if (aurEff != null) + { + aurEff.GetBase().ModStackAmount(1, AuraRemoveMode.None, false); + aurEff.CalculatePeriodic(GetCaster(), false); + } + } + + public override void Register() + { + AfterCast.Add(new CastHandler(ModifyStacks)); + } + } + + [Script] // 302769 - Arcane Tempest + class spell_item_phial_of_the_arcane_tempest_periodic : AuraScript + { + void CalculatePeriod(AuraEffect aurEff, ref bool isPeriodic, ref int period) + { + period -= (GetStackAmount() - 1) * 300; + } + + public override void Register() + { + DoEffectCalcPeriodic.Add(new EffectCalcPeriodicHandler(CalculatePeriod, 0, AuraType.PeriodicTriggerSpell)); + } + } }