rendered paste bodyIndex: game/Unit.cpp
===================================================================
--- game/Unit.cpp (revision 5427)
+++ game/Unit.cpp (working copy)
@@ -1057,17 +1057,18 @@
spell->prepare(&targets, triggredByAura);
}
-void Unit::DealDamageBySchool(Unit *pVictim, SpellEntry const *spellInfo, uint32 *damage, CleanDamage *cleanDamage, bool *crit, bool isTriggeredSpell)
+void Unit::DealFlatDamage(Unit *pVictim, SpellEntry const *spellInfo, uint32 *damage, CleanDamage *cleanDamage, bool *crit, bool isTriggeredSpell)
{
// TODO this in only generic way, check for exceptions
- DEBUG_LOG("DealDamageBySchool (BEFORE) SCHOOL %u >> DMG:%u", spellInfo->School, *damage);
+ DEBUG_LOG("DealFlatDamage (BEFORE) SCHOOL %u >> DMG:%u", spellInfo->School, *damage);
// Per-school calc
- switch (spellInfo->School)
+ switch (spellInfo->DmgClass)
{
- // Physical damage school
- case SPELL_SCHOOL_NORMAL:
+ // Melee and Ranged Spells
+ case SPELL_DAMAGE_CLASS_RANGED:
+ case SPELL_DAMAGE_CLASS_MELEE:
{
// Calculate physical outcome
MeleeHitOutcome outcome = RollPhysicalOutcomeAgainst(pVictim, BASE_ATTACK, spellInfo);
@@ -1101,12 +1102,28 @@
uint32 hitInfo = HITINFO_NORMALSWING;
VictimState victimState = VICTIMSTATE_NORMAL;
- //Calculate armor mitigation
- uint32 damageAfterArmor;
- damageAfterArmor = CalcArmorReducedDamage(pVictim, *damage);
- cleanDamage->damage += *damage - damageAfterArmor;
- *damage = damageAfterArmor;
+ // Physical Damage
+ if ( spellInfo->School == SPELL_SCHOOL_NORMAL )
+ {
+ uint32 damageAfterArmor;
+ uint32 modDamage=*damage;
+ // apply spellmod to Done damage
+ if(Player* modOwner = GetSpellModOwner())
+ modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_DAMAGE, *damage);
+
+ //Calculate armor mitigation
+ damageAfterArmor = CalcArmorReducedDamage(pVictim, *damage);
+ cleanDamage->damage += *damage - damageAfterArmor;
+ *damage = damageAfterArmor;
+ }
+ // Magical Damage
+ else
+ {
+ // Calculate damage bonus
+ *damage = SpellDamageBonus(pVictim, spellInfo, *damage, SPELL_DIRECT_DAMAGE);
+ }
+
uint32 blocked_amount = 0;
// Classify outcome
@@ -1298,13 +1315,9 @@
break;
}
- // Other schools
- case SPELL_SCHOOL_HOLY:
- case SPELL_SCHOOL_FIRE:
- case SPELL_SCHOOL_NATURE:
- case SPELL_SCHOOL_FROST:
- case SPELL_SCHOOL_SHADOW:
- case SPELL_SCHOOL_ARCANE:
+ // Magical Attacks
+ case SPELL_DAMAGE_CLASS_NONE:
+ case SPELL_DAMAGE_CLASS_MAGIC:
//Spell miss (sends resist message)
if( int32(SpellMissChanceCalc(pVictim)*100.0f) > irand(0,10000) )
@@ -1319,25 +1332,7 @@
// Calculate damage bonus
*damage = SpellDamageBonus(pVictim, spellInfo, *damage, SPELL_DIRECT_DAMAGE);
- // Calculate critical bonus
- if(spellInfo->DmgClass==SPELL_DAMAGE_CLASS_MELEE)
- {
- // Calculate physical outcome
- if(RollPhysicalOutcomeAgainst(pVictim, BASE_ATTACK, spellInfo) == MELEE_HIT_CRIT)
- {
- *crit = true;
- *damage *= 2;
- // Resilience - reduce crit damage by
- if (pVictim->GetTypeId()==TYPEID_PLAYER)
- {
- uint32 resilienceReduction = ((Player*)pVictim)->GetMeleeCritDamageReduction(*damage);
- cleanDamage->damage += resilienceReduction;
- *damage -= resilienceReduction;
- }
- }
- }
- else
- *crit = SpellCriticalBonus(spellInfo, damage, pVictim);
+ *crit = SpellCriticalBonus(spellInfo, damage, pVictim);
if(*crit)
cleanDamage->hitOutCome = MELEE_HIT_CRIT;
@@ -1356,7 +1351,7 @@
}
// TODO this in only generic way, check for exceptions
- DEBUG_LOG("DealDamageBySchool (AFTER) SCHOOL %u >> DMG:%u", spellInfo->School, *damage);
+ DEBUG_LOG("DealFlatDamage (AFTER) SCHOOL %u >> DMG:%u", spellInfo->School, *damage);
}
uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell, bool useSpellDamage)
@@ -1374,9 +1369,9 @@
bool crit = false;
if (useSpellDamage)
- DealDamageBySchool(pVictim, spellInfo, &damage, &cleanDamage, &crit, isTriggeredSpell);
+ DealFlatDamage(pVictim, spellInfo, &damage, &cleanDamage, &crit, isTriggeredSpell);
- // If we actually dealt some damage (spell proc's for 0 damage (normal and magic) called in DealDamageBySchool)
+ // If we actually dealt some damage (spell proc's for 0 damage (normal and magic) called in DealFlatDamage)
if(damage > 0)
{
// Calculate absorb & resists
@@ -1426,7 +1421,7 @@
}
else
{
- // all spell proc for 0 normal and magic damage called in DealDamageBySchool
+ // all spell proc for 0 normal and magic damage called in DealFlatDamage
//Check for rage
if(cleanDamage.damage)
Index: game/Unit.h
===================================================================
--- game/Unit.h (revision 5427)
+++ game/Unit.h (working copy)
@@ -675,7 +675,7 @@
uint16 GetMaxSkillValueForLevel() const { return getLevel()*5; }
void DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchools damageSchool, SpellEntry const *spellProto, bool durabilityLoss);
- void DealDamageBySchool(Unit *pVictim, SpellEntry const *spellInfo, uint32 *damage, CleanDamage *cleanDamage, bool *crit = false, bool isTriggeredSpell = false);
+ void DealFlatDamage(Unit *pVictim, SpellEntry const *spellInfo, uint32 *damage, CleanDamage *cleanDamage, bool *crit = false, bool isTriggeredSpell = false);
void DoAttackDamage(Unit *pVictim, uint32 *damage, CleanDamage *cleanDamage, uint32 *blocked_amount, SpellSchools damageType, uint32 *hitInfo, VictimState *victimState, uint32 *absorbDamage, uint32 *resistDamage, WeaponAttackType attType, SpellEntry const *spellCasted = NULL, bool isTriggeredSpell = false);
void CastMeleeProcDamageAndSpell(Unit* pVictim, uint32 damage, WeaponAttackType attType, MeleeHitOutcome outcome, SpellEntry const *spellCasted = NULL, bool isTriggeredSpell = false);