Scripts/Spells: Power Word: Shield cleanup (#31411)

This commit is contained in:
Cristian Vintila
2025-12-03 19:08:19 +01:00
committed by GitHub
parent 90be8fafb3
commit fe3b54c17e
+7 -33
View File
@@ -2168,46 +2168,20 @@ class spell_pri_power_word_shield : public AuraScript
}); });
} }
void CalculateAmount(AuraEffect const* auraEffect, int32& amount, bool& canBeRecalculated) const void CalculateAbsorb(AuraEffect const* aurEff, Unit* /*victim*/, int32& /*absorb*/, int32& /*flatMod*/, float& pctMod)
{ {
canBeRecalculated = false; Unit* caster = GetCaster();
if (Unit* caster = GetCaster())
{
float modifiedAmount = caster->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask()) * 4.638f;
if (Player* player = caster->ToPlayer())
{
AddPct(modifiedAmount, player->GetRatingBonusValue(CR_VERSATILITY_DAMAGE_DONE));
// Mastery: Grace (TBD: move into DoEffectCalcDamageAndHealing hook with a new SpellScript and AuraScript). // Mastery: Grace (TBD: move into DoEffectCalcDamageAndHealing hook with a new SpellScript and AuraScript).
if (AuraEffect const* masteryGraceEffect = caster->GetAuraEffect(SPELL_PRIEST_MASTERY_GRACE, EFFECT_0)) if (AuraEffect const* masteryGraceEffect = caster->GetAuraEffect(SPELL_PRIEST_MASTERY_GRACE, EFFECT_0))
if (GetUnitOwner()->HasAura(SPELL_PRIEST_ATONEMENT_EFFECT)) if (GetUnitOwner()->HasAura(SPELL_PRIEST_ATONEMENT_EFFECT))
AddPct(modifiedAmount, masteryGraceEffect->GetAmount()); AddPct(pctMod, masteryGraceEffect->GetAmount());
switch (player->GetPrimarySpecialization()) float critChanceDone = caster->SpellCritChanceDone(nullptr, aurEff, GetSpellInfo()->GetSchoolMask(), GetSpellInfo()->GetAttackType());
{ float critChanceTaken = GetUnitOwner()->SpellCritChanceTaken(caster, nullptr, aurEff, GetSpellInfo()->GetSchoolMask(), critChanceDone, GetSpellInfo()->GetAttackType());
case ChrSpecialization::PriestDiscipline:
modifiedAmount *= 1.37f;
break;
case ChrSpecialization::PriestShadow:
modifiedAmount *= 1.25f;
if (caster->HasAura(SPELL_PVP_RULES_ENABLED_HARDCODED))
modifiedAmount *= 0.8f;
break;
default:
break;
}
}
float critChanceDone = caster->SpellCritChanceDone(nullptr, auraEffect, GetSpellInfo()->GetSchoolMask(), GetSpellInfo()->GetAttackType());
float critChanceTaken = GetUnitOwner()->SpellCritChanceTaken(caster, nullptr, auraEffect, GetSpellInfo()->GetSchoolMask(), critChanceDone, GetSpellInfo()->GetAttackType());
if (roll_chance_f(critChanceTaken)) if (roll_chance_f(critChanceTaken))
modifiedAmount *= 2; pctMod *= 2;
amount = modifiedAmount;
}
} }
void HandleOnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const void HandleOnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const
@@ -2233,7 +2207,7 @@ class spell_pri_power_word_shield : public AuraScript
void Register() override void Register() override
{ {
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_power_word_shield::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); DoEffectCalcDamageAndHealing += AuraEffectCalcAbsorbFn(spell_pri_power_word_shield::CalculateAbsorb, EFFECT_0);
AfterEffectApply += AuraEffectApplyFn(spell_pri_power_word_shield::HandleOnApply, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); AfterEffectApply += AuraEffectApplyFn(spell_pri_power_word_shield::HandleOnApply, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
AfterEffectRemove += AuraEffectRemoveFn(spell_pri_power_word_shield::HandleOnRemove, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB, AURA_EFFECT_HANDLE_REAL); AfterEffectRemove += AuraEffectRemoveFn(spell_pri_power_word_shield::HandleOnRemove, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB, AURA_EFFECT_HANDLE_REAL);
} }