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/122d41eb067eecd76debc35778164ee163cda813)
This commit is contained in:
hondacrx
2023-04-21 19:17:34 -04:00
parent afceddc29a
commit 4a3369b586
+100
View File
@@ -3979,4 +3979,104 @@ namespace Scripts.Spells.Items
OnEffectHitTarget.Add(new EffectHandler(HandleScript, 2, SpellEffectName.Inebriate)); OnEffectHitTarget.Add(new EffectHandler(HandleScript, 2, SpellEffectName.Inebriate));
} }
} }
enum AmalgamsSeventhSpineSpellIds
{
FragileEchoesMonk = 225281,
FragileEchoesShaman = 225292,
FragileEchoesPriestDiscipline = 225294,
FragileEchoesPaladin = 225297,
FragileEchoesDruid = 225298,
FragileEchoesPriestHoly = 225366,
FragileEchoEnergize = 215270,
}
[Script] // 215266
class spell_item_amalgams_seventh_spine : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo((uint)AmalgamsSeventhSpineSpellIds.FragileEchoesMonk, (uint)AmalgamsSeventhSpineSpellIds.FragileEchoesShaman, (uint)AmalgamsSeventhSpineSpellIds.FragileEchoesPriestDiscipline,
(uint)AmalgamsSeventhSpineSpellIds.FragileEchoesPaladin, (uint)AmalgamsSeventhSpineSpellIds.FragileEchoesDruid, (uint)AmalgamsSeventhSpineSpellIds.FragileEchoesPriestHoly);
}
void ForcePeriodic(AuraEffect aurEff, ref bool isPeriodic, ref int amplitude)
{
// simulate heartbeat timer
isPeriodic = true;
amplitude = 5000;
}
void UpdateSpecAura(AuraEffect aurEff)
{
PreventDefaultAction();
Player target = GetTarget().ToPlayer();
if (!target)
return;
void updateAuraIfInCorrectSpec(TalentSpecialization spec, AmalgamsSeventhSpineSpellIds aura)
{
if (target.GetPrimarySpecialization() != (uint)spec)
target.RemoveAurasDueToSpell((uint)aura);
else if (!target.HasAura((uint)aura))
target.CastSpell(target, (uint)aura, new CastSpellExtraArgs(aurEff));
};
switch (target.GetClass())
{
case Class.Monk:
updateAuraIfInCorrectSpec(TalentSpecialization.MonkMistweaver, AmalgamsSeventhSpineSpellIds.FragileEchoesMonk);
break;
case Class.Shaman:
updateAuraIfInCorrectSpec(TalentSpecialization.ShamanRestoration, AmalgamsSeventhSpineSpellIds.FragileEchoesShaman);
break;
case Class.Priest:
updateAuraIfInCorrectSpec(TalentSpecialization.PriestDiscipline, AmalgamsSeventhSpineSpellIds.FragileEchoesPriestDiscipline);
updateAuraIfInCorrectSpec(TalentSpecialization.PriestHoly, AmalgamsSeventhSpineSpellIds.FragileEchoesPriestHoly);
break;
case Class.Paladin:
updateAuraIfInCorrectSpec(TalentSpecialization.PaladinHoly, AmalgamsSeventhSpineSpellIds.FragileEchoesPaladin);
break;
case Class.Druid:
updateAuraIfInCorrectSpec(TalentSpecialization.DruidRestoration, AmalgamsSeventhSpineSpellIds.FragileEchoesDruid);
break;
default:
break;
}
}
public override void Register()
{
DoEffectCalcPeriodic.Add(new EffectCalcPeriodicHandler(ForcePeriodic, 0, AuraType.Dummy));
OnEffectPeriodic.Add(new EffectPeriodicHandler(UpdateSpecAura, 0, AuraType.Dummy));
}
}
[Script] // 215267
class spell_item_amalgams_seventh_spine_mana_restore : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo((uint)AmalgamsSeventhSpineSpellIds.FragileEchoEnergize);
}
void TriggerManaRestoration(AuraEffect aurEff, AuraEffectHandleModes mode)
{
if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Expire)
return;
Unit caster = GetCaster();
if (!caster)
return;
AuraEffect trinketEffect = caster.GetAuraEffect(aurEff.GetSpellEffectInfo().TriggerSpell, 0);
if (trinketEffect != null)
caster.CastSpell(caster, (uint)AmalgamsSeventhSpineSpellIds.FragileEchoEnergize, new CastSpellExtraArgs(aurEff).AddSpellMod(SpellValueMod.BasePoint0, trinketEffect.GetAmount()));
}
public override void Register()
{
AfterEffectRemove.Add(new EffectApplyHandler(TriggerManaRestoration, 1, AuraType.Dummy, AuraEffectHandleModes.Real));
}
}
} }