Scripts/Spells: Implemented Priest talent Divine Aegis/ Fixed PW:S Crit

Port From (https://github.com/TrinityCore/TrinityCore/commit/0abdd8ce3d426d7a1c9ecec5380114a02d150da6)
This commit is contained in:
hondacrx
2024-02-28 18:36:03 -05:00
parent e8e9af86a6
commit cc8643b1cd
+61 -5
View File
@@ -45,6 +45,8 @@ namespace Scripts.Spells.Priest
public const uint DarkReprimandDamage = 373130;
public const uint DarkReprimandHealing = 400187;
public const uint DazzlingLight = 196810;
public const uint DivineAegis = 47515;
public const uint DivineAegisAbsorb = 47753;
public const uint DivineBlessing = 40440;
public const uint DivineHymnHeal = 64844;
public const uint DivineImageSummon = 392990;
@@ -1886,7 +1888,7 @@ namespace Scripts.Spells.Priest
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellInfo(SpellIds.StrengthOfSoul, SpellIds.StrengthOfSoulEffect, SpellIds.AtonementEffect, SpellIds.TrinityEffect, SpellIds.ShieldDiscipline, SpellIds.ShieldDisciplineEffect, SpellIds.PvpRulesEnabledHardcoded)
&& ValidateSpellEffect((SpellIds.MasteryGrace, 0), (SpellIds.Rapture, 1), (SpellIds.Benevolence, 0));
&& ValidateSpellEffect((SpellIds.MasteryGrace, 0), (SpellIds.Rapture, 1), (SpellIds.Benevolence, 0), (SpellIds.DivineAegis, 1));
}
void CalculateAmount(AuraEffect auraEffect, ref int amount, ref bool canBeRecalculated)
@@ -1909,14 +1911,32 @@ namespace Scripts.Spells.Priest
if (GetUnitOwner().HasAura(SpellIds.AtonementEffect) || GetUnitOwner().HasAura(SpellIds.TrinityEffect))
MathFunctions.AddPct(ref modifiedAmount, masteryGraceEffect.GetAmount());
if (player.GetPrimarySpecialization() != ChrSpecialization.PriestHoly)
switch (player.GetPrimarySpecialization())
{
modifiedAmount *= 1.25f;
if (caster.HasAura(SpellIds.PvpRulesEnabledHardcoded))
modifiedAmount *= 0.8f;
case ChrSpecialization.PriestDiscipline:
modifiedAmount *= 1.37f;
break;
case ChrSpecialization.PriestShadow:
modifiedAmount *= 1.25f;
if (caster.HasAura(SpellIds.PvpRulesEnabledHardcoded))
modifiedAmount *= 0.8f;
break;
}
}
float critChanceDone = caster.SpellCritChanceDone(null, auraEffect, GetSpellInfo().GetSchoolMask(), GetSpellInfo().GetAttackType());
float critChanceTaken = GetUnitOwner().SpellCritChanceTaken(caster, null, auraEffect, GetSpellInfo().GetSchoolMask(), critChanceDone, GetSpellInfo().GetAttackType());
if (RandomHelper.randChance(critChanceTaken))
{
modifiedAmount *= 2;
// Divine Aegis
AuraEffect divineEff = caster.GetAuraEffect(SpellIds.DivineAegis, 1);
if (divineEff != null)
MathFunctions.AddPct(ref modifiedAmount, divineEff.GetAmount());
}
// Rapture talent (Tbd: move into DoEffectCalcDamageAndHealing hook).
AuraEffect raptureEffect = caster.GetAuraEffect(SpellIds.Rapture, 1);
if (raptureEffect != null)
@@ -1961,6 +1981,42 @@ namespace Scripts.Spells.Priest
}
}
[Script] // 47515 - Divine Aegis
class spell_pri_divine_aegis : AuraScript
{
public override bool Validate(SpellInfo spellInfo)
{
return ValidateSpellEffect((SpellIds.DivineAegisAbsorb, 0));
}
bool CheckProc(ProcEventInfo eventInfo)
{
return eventInfo.GetHealInfo() != null;
}
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
{
Unit caster = eventInfo.GetActor();
if (caster == null)
return;
int aegisAmount = (int)MathFunctions.CalculatePct(eventInfo.GetHealInfo().GetHeal(), aurEff.GetAmount());
AuraEffect existingAegis = eventInfo.GetProcTarget().GetAuraEffect(SpellIds.DivineAegisAbsorb, 0, caster.GetGUID());
if (existingAegis != null)
aegisAmount += existingAegis.GetAmount();
CastSpellExtraArgs args = new(aurEff);
args.SetTriggerFlags(TriggerCastFlags.IgnoreCastInProgress | TriggerCastFlags.DontReportCastError);
args.AddSpellMod(SpellValueMod.BasePoint0, aegisAmount);
caster.CastSpell(eventInfo.GetProcTarget(), SpellIds.DivineAegisAbsorb, args);
}
public override void Register()
{
OnEffectProc.Add(new(HandleProc, 0, AuraType.Dummy));
}
}
[Script] // 129250 - Power Word: Solace
class spell_pri_power_word_solace : SpellScript
{