diff --git a/Source/Game/Scripting/SpellScript.cs b/Source/Game/Scripting/SpellScript.cs index 39425a494..c2a4be3ee 100644 --- a/Source/Game/Scripting/SpellScript.cs +++ b/Source/Game/Scripting/SpellScript.cs @@ -1692,7 +1692,7 @@ namespace Game.Scripting public int GetDuration() { return m_aura.GetDuration(); } public void SetDuration(int duration, bool withMods = false) { m_aura.SetDuration(duration, withMods); } // sets duration to maxduration - void RefreshDuration() { m_aura.RefreshDuration(); } + public void RefreshDuration() { m_aura.RefreshDuration(); } long GetApplyTime() { return m_aura.GetApplyTime(); } public int GetMaxDuration() { return m_aura.GetMaxDuration(); } public void SetMaxDuration(int duration) { m_aura.SetMaxDuration(duration); } diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index 725a171c4..9e8050dc1 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -4341,8 +4341,17 @@ namespace Game.Entities }); }); + ApplySpellFix(new[] { 265057 }, spellInfo => + { + ApplySpellEffectFix(spellInfo, 0, spellEffectInfo => + { + // Fix incorrect spell id (it has self in TriggerSpell) + spellEffectInfo.TriggerSpell = 16403; + }); + }); + // Ray of Frost (Fingers of Frost charges) - ApplySpellFix(new []{ 269748 }, spellInfo => + ApplySpellFix(new[] { 269748 }, spellInfo => { spellInfo.AttributesEx &= ~SpellAttr1.IsChannelled; }); diff --git a/Source/Scripts/Spells/Azerite.cs b/Source/Scripts/Spells/Azerite.cs index 231e95ed5..bed7ed871 100644 --- a/Source/Scripts/Spells/Azerite.cs +++ b/Source/Scripts/Spells/Azerite.cs @@ -17,7 +17,7 @@ namespace Scripts.Spells.Azerite public const uint StrengthInNumbersBuff = 271550; // Blessedportents - public const uint BlessedPortentsTrait = 267889; + public const uint BlessedPortentsTrait = 267889; public const uint BlessedPortentsHeal = 280052; // Concentratedmending @@ -34,6 +34,44 @@ namespace Scripts.Spells.Azerite // Bluroftalons public const uint HunterCoordinatedAssault = 266779; + + // Tradewinds + public const uint TradewindsAllyBuff = 281844; + + // Bastion of Might + public const uint WarriorIgnorePain = 190456; + + // Echoing Blades + public const uint EchoingBladesTrait = 287649; + + } + + [Script] + class spell_azerite_gen_aura_calc_from_2nd_effect_triggered_spell : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return spellInfo.GetEffects().Count > 1 && ValidateSpellInfo(spellInfo.GetEffect(1).TriggerSpell); + } + + void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated) + { + Unit caster = GetCaster(); + if (caster != null) + { + AuraEffect trait = caster.GetAuraEffect(GetEffectInfo(1).TriggerSpell, 0); + if (trait != null) + { + amount = trait.GetAmount(); + canBeRecalculated = false; + } + } + } + + public override void Register() + { + DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 0, AuraType.ModRating)); + } } [Script] // 270658 - Azerite Fortification @@ -283,6 +321,123 @@ namespace Scripts.Spells.Azerite } } + [Script] // 280409 - Blood Rite + class spell_item_blood_rite : AuraScript + { + void HandleProc(AuraEffect aurEff, ProcEventInfo procInfo) + { + RefreshDuration(); + } + + public override void Register() + { + AfterEffectProc.Add(new EffectProcHandler(HandleProc, 1, AuraType.Dummy)); + } + } + + [Script] // 281843 - Tradewinds + class spell_item_tradewinds : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.TradewindsAllyBuff); + } + + void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + AuraEffect trait = GetTarget().GetAuraEffect(GetEffectInfo(1).TriggerSpell, 1); + if (trait != null) + GetTarget().CastSpell((WorldObject)null, SpellIds.TradewindsAllyBuff, + new CastSpellExtraArgs(aurEff).AddSpellMod(SpellValueMod.BasePoint0, trait.GetAmount())); + } + + public override void Register() + { + AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.ModRating, AuraEffectHandleModes.Real)); + } + } + + [Script] // 287379 - Bastion of Might + class spell_item_bastion_of_might : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.WarriorIgnorePain); + } + + void TriggerIgnorePain() + { + GetCaster().CastSpell(GetCaster(), SpellIds.WarriorIgnorePain, GetSpell()); + } + + public override void Register() + { + AfterHit.Add(new HitHandler(TriggerIgnorePain)); + } + } + + [Script] // 287650 - Echoing Blades + class spell_item_echoing_blades : AuraScript + { + void PrepareProc(ProcEventInfo eventInfo) + { + if (eventInfo.GetProcSpell()) + { + if (eventInfo.GetProcSpell().m_castId != _lastFanOfKnives) + GetEffect(0).RecalculateAmount(); + + _lastFanOfKnives = eventInfo.GetProcSpell().m_castId; + } + } + + bool CheckFanOfKnivesCounter(AuraEffect aurEff, ProcEventInfo eventInfo) + { + return aurEff.GetAmount() > 0; + } + + void ReduceCounter(AuraEffect aurEff, ProcEventInfo procInfo) + { + aurEff.SetAmount(aurEff.GetAmount() - 1); + } + + public override void Register() + { + DoPrepareProc.Add(new AuraProcHandler(PrepareProc)); + DoCheckEffectProc.Add(new CheckEffectProcHandler(CheckFanOfKnivesCounter, 0, AuraType.ProcTriggerSpell)); + AfterEffectProc.Add(new EffectProcHandler(ReduceCounter, 0, AuraType.ProcTriggerSpell)); + } + + ObjectGuid _lastFanOfKnives; + } + + [Script] // 287653 - Echoing Blades + class spell_item_echoing_blades_damage : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.EchoingBladesTrait) + && Global.SpellMgr.GetSpellInfo(SpellIds.EchoingBladesTrait, Difficulty.None).GetEffects().Count > 2; + } + + void CalculateDamage(uint effIndex) + { + AuraEffect trait = GetCaster().GetAuraEffect(SpellIds.EchoingBladesTrait, 2); + if (trait != null) + SetHitDamage(trait.GetAmount() * 2); + } + + void ForceCritical(Unit victim, ref float critChance) + { + critChance = 100.0f; + } + + public override void Register() + { + OnEffectLaunchTarget.Add(new EffectHandler(CalculateDamage, 0, SpellEffectName.SchoolDamage)); + OnCalcCritChance.Add(new OnCalcCritChanceHandler(ForceCritical)); + } + } + [Script] // 277253 - Heart of Azeroth class spell_item_heart_of_azeroth : AuraScript { diff --git a/Source/Scripts/Spells/DeathKnight.cs b/Source/Scripts/Spells/DeathKnight.cs index 057b7b5ea..b35c0a914 100644 --- a/Source/Scripts/Spells/DeathKnight.cs +++ b/Source/Scripts/Spells/DeathKnight.cs @@ -40,8 +40,11 @@ namespace Scripts.Spells.DeathKnight public const uint GlyphOfFoulMenagerie = 58642; public const uint GlyphOfTheGeist = 58640; public const uint GlyphOfTheSkeleton = 146652; + public const uint KillingMachineProc = 51124; public const uint MarkOfBloodHeal = 206945; public const uint NecrosisEffect = 216974; + public const uint Obliteration = 281238; + public const uint ObliterationRuneEnergize = 281327; public const uint RaiseDeadSummon = 52150; public const uint RecentlyUsedDeathStrike = 180612; public const uint RunicPowerEnergize = 49088; @@ -639,6 +642,32 @@ namespace Scripts.Spells.DeathKnight } } + [Script] // 207256 - Obliteration + class spell_dk_obliteration : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.Obliteration, SpellIds.ObliterationRuneEnergize, SpellIds.KillingMachineProc) + && Global.SpellMgr.GetSpellInfo(SpellIds.Obliteration, Difficulty.None).GetEffects().Count > 1; + } + + void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo) + { + Unit target = GetTarget(); + target.CastSpell(target, SpellIds.KillingMachineProc, new CastSpellExtraArgs(aurEff)); + + AuraEffect oblitaration = target.GetAuraEffect(SpellIds.Obliteration, 1); + if (oblitaration != null) + if (RandomHelper.randChance(oblitaration.GetAmount())) + target.CastSpell(target, SpellIds.ObliterationRuneEnergize, new CastSpellExtraArgs(aurEff)); + } + + public override void Register() + { + AfterEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy)); + } + } + [Script] // 121916 - Glyph of the Geist (Unholy) class spell_dk_pet_geist_transform : SpellScript {