Guest User

Untitled

a guest
Sep 9th, 2010
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 8.39 KB | None | 0 0
  1. diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
  2. index 92ea8a4..24f9caf 100644
  3. --- a/src/game/SpellAuras.cpp
  4. +++ b/src/game/SpellAuras.cpp
  5. @@ -6437,7 +6437,7 @@ void Aura::PeriodicTick()
  6.  
  7.              uint32 absorb = 0;
  8.              uint32 resist = 0;
  9. -            CleanDamage cleanDamage =  CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL );
  10. +            CleanDamage cleanDamage =  CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL );
  11.  
  12.              // ignore non positive values (can be result apply spellmods to aura damage
  13.              uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;
  14. @@ -6499,6 +6499,7 @@ void Aura::PeriodicTick()
  15.                  pdamage -= target->GetSpellDamageReduction(pdamage);
  16.  
  17.              target->CalculateAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !(GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED));
  18. +            cleanDamage.absorb += absorb;
  19.  
  20.              DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
  21.                  GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), pdamage, GetId(),absorb);
  22. @@ -6558,7 +6559,7 @@ void Aura::PeriodicTick()
  23.  
  24.              uint32 absorb=0;
  25.              uint32 resist=0;
  26. -            CleanDamage cleanDamage =  CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL );
  27. +            CleanDamage cleanDamage =  CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL );
  28.  
  29.              uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;
  30.  
  31. @@ -6588,6 +6589,7 @@ void Aura::PeriodicTick()
  32.                  pdamage -= target->GetSpellDamageReduction(pdamage);
  33.  
  34.              target->CalculateAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !(spellProto->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED));
  35. +            cleanDamage.absorb += absorb;
  36.  
  37.              if(target->GetHealth() < pdamage)
  38.                  pdamage = uint32(target->GetHealth());
  39. @@ -6711,7 +6713,7 @@ void Aura::PeriodicTick()
  40.                      pCaster->DealDamageMods(pCaster, damage, &absorb);
  41.                      pCaster->SendSpellNonMeleeDamageLog(pCaster, GetId(), damage, GetSpellSchoolMask(spellProto), absorb, 0, false, 0, false);
  42.  
  43. -                    CleanDamage cleanDamage =  CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL );
  44. +                    CleanDamage cleanDamage =  CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL );
  45.                      pCaster->DealDamage(pCaster, damage, &cleanDamage, NODAMAGE, GetSpellSchoolMask(spellProto), spellProto, true);
  46.                  }
  47.              }
  48. diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
  49. index 1fd33fe..d87edcf 100644
  50. --- a/src/game/Unit.cpp
  51. +++ b/src/game/Unit.cpp
  52. @@ -534,11 +534,17 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
  53.  
  54.      if(!damage)
  55.      {
  56. -        // Rage from physical damage received .
  57. -        if(cleanDamage && cleanDamage->damage && (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL) && pVictim->GetTypeId() == TYPEID_PLAYER && (pVictim->getPowerType() == POWER_RAGE))
  58. -            ((Player*)pVictim)->RewardRage(cleanDamage->damage, 0, false);
  59. +        if (!cleanDamage)
  60. +            return 0;
  61.  
  62. -        return 0;
  63. +        if (!cleanDamage->absorb)
  64. +        {
  65. +            // Rage from physical damage received .
  66. +            if(cleanDamage->damage && (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL) && pVictim->GetTypeId() == TYPEID_PLAYER && (pVictim->getPowerType() == POWER_RAGE))
  67. +                ((Player*)pVictim)->RewardRage(cleanDamage->damage, 0, false);
  68. +
  69. +            return 0;
  70. +        }
  71.      }
  72.      if (!spellProto || !IsSpellHaveAura(spellProto,SPELL_AURA_MOD_FEAR))
  73.          pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_FEAR, damage);
  74. @@ -602,7 +608,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
  75.                  else
  76.                      weaponSpeedHitFactor = uint32(GetAttackTime(cleanDamage->attackType)/1000.0f * 3.5f);
  77.  
  78. -                ((Player*)this)->RewardRage(damage, weaponSpeedHitFactor, true);
  79. +                ((Player*)this)->RewardRage(damage + cleanDamage->absorb, weaponSpeedHitFactor, true);
  80.  
  81.                  break;
  82.              }
  83. @@ -613,7 +619,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
  84.                  else
  85.                      weaponSpeedHitFactor = uint32(GetAttackTime(cleanDamage->attackType)/1000.0f * 1.75f);
  86.  
  87. -                ((Player*)this)->RewardRage(damage, weaponSpeedHitFactor, true);
  88. +                ((Player*)this)->RewardRage(damage + cleanDamage->absorb, weaponSpeedHitFactor, true);
  89.  
  90.                  break;
  91.              }
  92. @@ -931,7 +937,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
  93.              // Rage from damage received
  94.              if(this != pVictim && pVictim->getPowerType() == POWER_RAGE)
  95.              {
  96. -                uint32 rage_damage = damage + (cleanDamage ? cleanDamage->damage : 0);
  97. +                uint32 rage_damage = damage + (cleanDamage ? (cleanDamage->damage + cleanDamage->absorb) : 0);
  98.                  ((Player*)pVictim)->RewardRage(rage_damage, 0, false);
  99.              }
  100.  
  101. @@ -1316,7 +1322,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
  102.      }
  103.  
  104.      // Call default DealDamage (send critical in hit info for threat calculation)
  105. -    CleanDamage cleanDamage(0, BASE_ATTACK, damageInfo->HitInfo & SPELL_HIT_TYPE_CRIT ? MELEE_HIT_CRIT : MELEE_HIT_NORMAL);
  106. +    CleanDamage cleanDamage(0, damageInfo->absorb, BASE_ATTACK, damageInfo->HitInfo & SPELL_HIT_TYPE_CRIT ? MELEE_HIT_CRIT : MELEE_HIT_NORMAL);
  107.      DealDamage(pVictim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, damageInfo->schoolMask, spellProto, durabilityLoss);
  108.  }
  109.  
  110. @@ -1662,7 +1668,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
  111.      }
  112.  
  113.      // Call default DealDamage
  114. -    CleanDamage cleanDamage(damageInfo->cleanDamage,damageInfo->attackType,damageInfo->hitOutCome);
  115. +    CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, damageInfo->attackType, damageInfo->hitOutCome);
  116.      DealDamage(pVictim, damageInfo->damage, &cleanDamage, DIRECT_DAMAGE, damageInfo->damageSchoolMask, NULL, durabilityLoss);
  117.  
  118.      // If this is a creature and it attacks from behind it has a probability to daze it's victim
  119. @@ -2260,7 +2266,7 @@ void Unit::CalculateAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, D
  120.  
  121.              pCaster->SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, splitted_absorb, 0, false, 0, false);
  122.  
  123. -            CleanDamage cleanDamage = CleanDamage(splitted, BASE_ATTACK, MELEE_HIT_NORMAL);
  124. +            CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
  125.              pCaster->DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
  126.          }
  127.  
  128. @@ -2287,7 +2293,7 @@ void Unit::CalculateAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, D
  129.  
  130.              pCaster->SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, split_absorb, 0, false, 0, false);
  131.  
  132. -            CleanDamage cleanDamage = CleanDamage(splitted, BASE_ATTACK, MELEE_HIT_NORMAL);
  133. +            CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
  134.              pCaster->DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
  135.          }
  136.      }
  137. diff --git a/src/game/Unit.h b/src/game/Unit.h
  138. index 828b37b..9be1435 100644
  139. --- a/src/game/Unit.h
  140. +++ b/src/game/Unit.h
  141. @@ -865,10 +865,11 @@ enum MeleeHitOutcome
  142.  
  143.  struct CleanDamage
  144.  {
  145. -    CleanDamage(uint32 _damage, WeaponAttackType _attackType, MeleeHitOutcome _hitOutCome) :
  146. -    damage(_damage), attackType(_attackType), hitOutCome(_hitOutCome) {}
  147. +    CleanDamage(uint32 _damage, uint32 _absorb, WeaponAttackType _attackType, MeleeHitOutcome _hitOutCome) :
  148. +    damage(_damage), absorb(_absorb), attackType(_attackType), hitOutCome(_hitOutCome) {}
  149.  
  150.      uint32 damage;
  151. +    uint32 absorb;                          // for calculation of rage from absorbed dmg
  152.      WeaponAttackType attackType;
  153.      MeleeHitOutcome hitOutCome;
  154.  };
Advertisement
Add Comment
Please, Sign In to add comment