feat(Core/Spells): add helper to get clean and unmitigated damage for pro… (#7244)

This commit is contained in:
UltraNix
2021-10-05 23:59:57 +02:00
committed by GitHub
parent 5af98783c9
commit 3223f90bcb
12 changed files with 283 additions and 169 deletions

View File

@@ -850,10 +850,15 @@ public:
uint32 resist = 0;
CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
int32 dmg = urand(2925, 3075) * (caster->GetMap()->GetDifficulty() - 1);
uint32 damage = dmg;
int32 resilienceReduction = damage;
if (caster->CanApplyResilience())
Unit::ApplyResilience(plr, nullptr, &dmg, false, CR_CRIT_TAKEN_SPELL);
uint32 damage = dmg;
Unit::CalcAbsorbResist(caster, plr, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo());
resilienceReduction = damage - resilienceReduction;
damage -= resilienceReduction;
uint32 mitigated_damage = resilienceReduction;
DamageInfo dmgInfo(caster, plr, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, mitigated_damage);
Unit::CalcAbsorbResist(dmgInfo);
Unit::DealDamageMods(plr, damage, &absorb);
int32 overkill = damage - plr->GetHealth();
if (overkill < 0)

View File

@@ -855,7 +855,7 @@ public:
uint32 damage = uint32( (GetEffectValue() / _targetCount) * (1.0f - ResistFactor) );
SpellNonMeleeDamage damageInfo(GetCaster(), GetHitUnit(), GetSpellInfo()->Id, GetSpellInfo()->SchoolMask);
SpellNonMeleeDamage damageInfo(GetCaster(), GetHitUnit(), GetSpellInfo(), GetSpellInfo()->SchoolMask);
damageInfo.damage = damage;
GetCaster()->SendSpellNonMeleeDamageLog(&damageInfo);
GetCaster()->DealSpellDamage(&damageInfo, false);

View File

@@ -414,7 +414,7 @@ public:
bool CheckProc(ProcEventInfo& eventInfo)
{
SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo)
return false;

View File

@@ -146,9 +146,7 @@ public:
Unit* procTarget = ObjectAccessor::GetUnit(*GetTarget(), _procTargetGUID);
if (procTarget && eventInfo.GetDamageInfo())
{
int32 damage = eventInfo.GetDamageInfo()->GetDamage();
// Xinef: Include AOE Damage Reduction auras
damage = procTarget->CalculateAOEDamageReduction(damage, SPELL_SCHOOL_MASK_NORMAL, GetTarget());
int32 damage = eventInfo.GetDamageInfo()->GetUnmitigatedDamage();
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage);

View File

@@ -818,8 +818,11 @@ public:
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
int32 damage = eventInfo.GetDamageInfo()->GetDamage();
GetTarget()->CastCustomSpell(_procTarget, SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK, &damage, 0, 0, true, nullptr, aurEff);
if (eventInfo.GetDamageInfo())
{
int32 damage = eventInfo.GetDamageInfo()->GetUnmitigatedDamage();
GetTarget()->CastCustomSpell(_procTarget, SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK, &damage, 0, 0, true, nullptr, aurEff);
}
}
void Register() override