Public feed
#887933
Index: game/Unit.cpp
===================================================================
--- game/Unit.cpp (revision 5121)
+++ game/Unit.cpp (working copy)
@@ -1062,12 +1062,9 @@
// TODO this in only generic way, check for exceptions
DEBUG_LOG("DealDamageBySchool (BEFORE) SCHOOL %u >> DMG:%u", spellInfo->School, *damage);
- // Per-school calc
- switch (spellInfo->School)
- {
- // Physical damage school
- case SPELL_SCHOOL_NORMAL:
- {
+ // Melee and Ranged spells
+ if ( spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED || spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE )
+ {
// Calculate physical outcome
MeleeHitOutcome outcome = RollPhysicalOutcomeAgainst(pVictim, BASE_ATTACK, spellInfo);
@@ -1101,10 +1098,23 @@
VictimState victimState = VICTIMSTATE_NORMAL;
//Calculate armor mitigation
- uint32 damageAfterArmor;
- damageAfterArmor = CalcArmorReducedDamage(pVictim, *damage);
- cleanDamage->damage += *damage - damageAfterArmor;
- *damage = damageAfterArmor;
+ if ( spellInfo->School == SPELL_SCHOOL_NORMAL )
+ {
+ uint32 damageAfterArmor;
+ damageAfterArmor = CalcArmorReducedDamage(pVictim, *damage);
+ cleanDamage->damage += *damage - damageAfterArmor;
+ *damage = damageAfterArmor;
+ }
+ // Spell damage bonus ( Hammer of Wrath for example )
+ // Exclude all non-magic using spells, ugly but removes need of manualy exluding all the spells not affected by it
+ else if ( spellInfo->SpellFamilyName != SPELLFAMILY_WARRIOR &&
+ spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE &&
+ spellInfo->SpellFamilyName != SPELLFAMILY_HUNTER &&
+ spellInfo->SpellFamilyName != SPELLFAMILY_GENERIC &&
+ spellInfo->SpellFamilyName != SPELLFAMILY_POTION )
+ {
+ *damage = SpellDamageBonus(pVictim, spellInfo, *damage, SPELL_DIRECT_DAMAGE);
+ }
uint32 blocked_amount = 0;
@@ -1142,7 +1152,7 @@
case MELEE_HIT_PARRY:
{
// this special attack can't be parryed
- if ( spellInfo->Attributes & 0x200000 )
+ if ( spellInfo->Attributes & 0x200000 || spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED )
{
outcome = MELEE_HIT_NORMAL;
cleanDamage->hitOutCome = MELEE_HIT_NORMAL;
@@ -1213,7 +1223,7 @@
case MELEE_HIT_DODGE:
{
// this special attack can't be dodged
- if ( spellInfo->Attributes & 0x200000 )
+ if ( spellInfo->Attributes & 0x200000 || spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED )
{
outcome = MELEE_HIT_NORMAL;
cleanDamage->hitOutCome = MELEE_HIT_NORMAL;
@@ -1293,17 +1303,9 @@
if(damage <= 0)
CastMeleeProcDamageAndSpell(pVictim,0,BASE_ATTACK,outcome,spellInfo,isTriggeredSpell);
- 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:
-
+ }
+ else
+ {
//Spell miss (sends resist message)
if( SpellMissChanceCalc(pVictim) > urand(0,10000) )
{
@@ -1317,22 +1319,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 2x%
- uint32 resilienceReduction = uint32(pVictim->m_modResilience * 2/100 * (*damage));
- cleanDamage->damage += resilienceReduction;
- *damage -= resilienceReduction;
- }
- }
- else
- *crit = SpellCriticalBonus(spellInfo, damage, pVictim);
+ *crit = SpellCriticalBonus(spellInfo, damage, pVictim);
if(*crit)
cleanDamage->hitOutCome = MELEE_HIT_CRIT;
@@ -1346,8 +1333,6 @@
ProcDamageAndSpell(pVictim, procAttacker, procVictim, 0, spellInfo, isTriggeredSpell);
}
-
- break;
}
// TODO this in only generic way, check for exceptions