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/c8ebf077c7b934eeb33466cd11a92ba00b931a3d)
This commit is contained in:
hondacrx
2023-05-02 14:26:30 -04:00
parent 1f75a2645a
commit 9decc17cd0
4 changed files with 196 additions and 3 deletions
+1 -1
View File
@@ -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); }
+10 -1
View File
@@ -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;
});
+156 -1
View File
@@ -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
{
+29
View File
@@ -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
{