mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Spells: Power Word: Shield cleanup (#31411)
This commit is contained in:
@@ -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;
|
||||
// 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 (GetUnitOwner()->HasAura(SPELL_PRIEST_ATONEMENT_EFFECT))
|
||||
AddPct(pctMod, masteryGraceEffect->GetAmount());
|
||||
|
||||
if (Player* player = caster->ToPlayer())
|
||||
{
|
||||
AddPct(modifiedAmount, player->GetRatingBonusValue(CR_VERSATILITY_DAMAGE_DONE));
|
||||
float critChanceDone = caster->SpellCritChanceDone(nullptr, aurEff, GetSpellInfo()->GetSchoolMask(), GetSpellInfo()->GetAttackType());
|
||||
float critChanceTaken = GetUnitOwner()->SpellCritChanceTaken(caster, nullptr, aurEff, GetSpellInfo()->GetSchoolMask(), critChanceDone, GetSpellInfo()->GetAttackType());
|
||||
|
||||
// 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 (GetUnitOwner()->HasAura(SPELL_PRIEST_ATONEMENT_EFFECT))
|
||||
AddPct(modifiedAmount, masteryGraceEffect->GetAmount());
|
||||
|
||||
switch (player->GetPrimarySpecialization())
|
||||
{
|
||||
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))
|
||||
modifiedAmount *= 2;
|
||||
|
||||
amount = modifiedAmount;
|
||||
}
|
||||
if (roll_chance_f(critChanceTaken))
|
||||
pctMod *= 2;
|
||||
}
|
||||
|
||||
void HandleOnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const
|
||||
@@ -2233,7 +2207,7 @@ class spell_pri_power_word_shield : public AuraScript
|
||||
|
||||
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);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_pri_power_word_shield::HandleOnRemove, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user