Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
- index 92ea8a4..24f9caf 100644
- --- a/src/game/SpellAuras.cpp
- +++ b/src/game/SpellAuras.cpp
- @@ -6437,7 +6437,7 @@ void Aura::PeriodicTick()
- uint32 absorb = 0;
- uint32 resist = 0;
- - CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL );
- + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL );
- // ignore non positive values (can be result apply spellmods to aura damage
- uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;
- @@ -6499,6 +6499,7 @@ void Aura::PeriodicTick()
- pdamage -= target->GetSpellDamageReduction(pdamage);
- target->CalculateAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !(GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED));
- + cleanDamage.absorb += absorb;
- DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
- GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), pdamage, GetId(),absorb);
- @@ -6558,7 +6559,7 @@ void Aura::PeriodicTick()
- uint32 absorb=0;
- uint32 resist=0;
- - CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL );
- + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL );
- uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;
- @@ -6588,6 +6589,7 @@ void Aura::PeriodicTick()
- pdamage -= target->GetSpellDamageReduction(pdamage);
- target->CalculateAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !(spellProto->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED));
- + cleanDamage.absorb += absorb;
- if(target->GetHealth() < pdamage)
- pdamage = uint32(target->GetHealth());
- @@ -6711,7 +6713,7 @@ void Aura::PeriodicTick()
- pCaster->DealDamageMods(pCaster, damage, &absorb);
- pCaster->SendSpellNonMeleeDamageLog(pCaster, GetId(), damage, GetSpellSchoolMask(spellProto), absorb, 0, false, 0, false);
- - CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL );
- + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL );
- pCaster->DealDamage(pCaster, damage, &cleanDamage, NODAMAGE, GetSpellSchoolMask(spellProto), spellProto, true);
- }
- }
- diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
- index 1fd33fe..d87edcf 100644
- --- a/src/game/Unit.cpp
- +++ b/src/game/Unit.cpp
- @@ -534,11 +534,17 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
- if(!damage)
- {
- - // Rage from physical damage received .
- - if(cleanDamage && cleanDamage->damage && (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL) && pVictim->GetTypeId() == TYPEID_PLAYER && (pVictim->getPowerType() == POWER_RAGE))
- - ((Player*)pVictim)->RewardRage(cleanDamage->damage, 0, false);
- + if (!cleanDamage)
- + return 0;
- - return 0;
- + if (!cleanDamage->absorb)
- + {
- + // Rage from physical damage received .
- + if(cleanDamage->damage && (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL) && pVictim->GetTypeId() == TYPEID_PLAYER && (pVictim->getPowerType() == POWER_RAGE))
- + ((Player*)pVictim)->RewardRage(cleanDamage->damage, 0, false);
- +
- + return 0;
- + }
- }
- if (!spellProto || !IsSpellHaveAura(spellProto,SPELL_AURA_MOD_FEAR))
- pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_FEAR, damage);
- @@ -602,7 +608,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
- else
- weaponSpeedHitFactor = uint32(GetAttackTime(cleanDamage->attackType)/1000.0f * 3.5f);
- - ((Player*)this)->RewardRage(damage, weaponSpeedHitFactor, true);
- + ((Player*)this)->RewardRage(damage + cleanDamage->absorb, weaponSpeedHitFactor, true);
- break;
- }
- @@ -613,7 +619,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
- else
- weaponSpeedHitFactor = uint32(GetAttackTime(cleanDamage->attackType)/1000.0f * 1.75f);
- - ((Player*)this)->RewardRage(damage, weaponSpeedHitFactor, true);
- + ((Player*)this)->RewardRage(damage + cleanDamage->absorb, weaponSpeedHitFactor, true);
- break;
- }
- @@ -931,7 +937,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
- // Rage from damage received
- if(this != pVictim && pVictim->getPowerType() == POWER_RAGE)
- {
- - uint32 rage_damage = damage + (cleanDamage ? cleanDamage->damage : 0);
- + uint32 rage_damage = damage + (cleanDamage ? (cleanDamage->damage + cleanDamage->absorb) : 0);
- ((Player*)pVictim)->RewardRage(rage_damage, 0, false);
- }
- @@ -1316,7 +1322,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
- }
- // Call default DealDamage (send critical in hit info for threat calculation)
- - CleanDamage cleanDamage(0, BASE_ATTACK, damageInfo->HitInfo & SPELL_HIT_TYPE_CRIT ? MELEE_HIT_CRIT : MELEE_HIT_NORMAL);
- + CleanDamage cleanDamage(0, damageInfo->absorb, BASE_ATTACK, damageInfo->HitInfo & SPELL_HIT_TYPE_CRIT ? MELEE_HIT_CRIT : MELEE_HIT_NORMAL);
- DealDamage(pVictim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, damageInfo->schoolMask, spellProto, durabilityLoss);
- }
- @@ -1662,7 +1668,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
- }
- // Call default DealDamage
- - CleanDamage cleanDamage(damageInfo->cleanDamage,damageInfo->attackType,damageInfo->hitOutCome);
- + CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, damageInfo->attackType, damageInfo->hitOutCome);
- DealDamage(pVictim, damageInfo->damage, &cleanDamage, DIRECT_DAMAGE, damageInfo->damageSchoolMask, NULL, durabilityLoss);
- // If this is a creature and it attacks from behind it has a probability to daze it's victim
- @@ -2260,7 +2266,7 @@ void Unit::CalculateAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, D
- pCaster->SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, splitted_absorb, 0, false, 0, false);
- - CleanDamage cleanDamage = CleanDamage(splitted, BASE_ATTACK, MELEE_HIT_NORMAL);
- + CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
- pCaster->DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
- }
- @@ -2287,7 +2293,7 @@ void Unit::CalculateAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, D
- pCaster->SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, split_absorb, 0, false, 0, false);
- - CleanDamage cleanDamage = CleanDamage(splitted, BASE_ATTACK, MELEE_HIT_NORMAL);
- + CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
- pCaster->DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
- }
- }
- diff --git a/src/game/Unit.h b/src/game/Unit.h
- index 828b37b..9be1435 100644
- --- a/src/game/Unit.h
- +++ b/src/game/Unit.h
- @@ -865,10 +865,11 @@ enum MeleeHitOutcome
- struct CleanDamage
- {
- - CleanDamage(uint32 _damage, WeaponAttackType _attackType, MeleeHitOutcome _hitOutCome) :
- - damage(_damage), attackType(_attackType), hitOutCome(_hitOutCome) {}
- + CleanDamage(uint32 _damage, uint32 _absorb, WeaponAttackType _attackType, MeleeHitOutcome _hitOutCome) :
- + damage(_damage), absorb(_absorb), attackType(_attackType), hitOutCome(_hitOutCome) {}
- uint32 damage;
- + uint32 absorb; // for calculation of rage from absorbed dmg
- WeaponAttackType attackType;
- MeleeHitOutcome hitOutCome;
- };
Advertisement
Add Comment
Please, Sign In to add comment