aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp100
1 files changed, 41 insertions, 59 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index df6ebbb8639..14a6f2b690b 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -1614,9 +1614,6 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
dmgInfo.ResistDamage(uint32(damageResisted));
}
- // Incanter's Absorption, for converting to spell power
- int32 incanterAbsorption = 0;
-
// Ignore Absorption Auras
float auraAbsorbMod = 0;
AuraEffectList const & AbsIgnoreAurasA = GetAuraEffectsByType(SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL);
@@ -1696,65 +1693,62 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
}
}
- if (auraAbsorbMod < 100) // Do nothing if 100% absorb ignore
+ // absorb by mana cost
+ AuraEffectList vManaShieldCopy(pVictim->GetAuraEffectsByType(SPELL_AURA_MANA_SHIELD));
+ for (AuraEffectList::const_iterator itr = vManaShieldCopy.begin(); (itr != vManaShieldCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
{
- // absorb by mana cost
- AuraEffectList vManaShieldCopy(pVictim->GetAuraEffectsByType(SPELL_AURA_MANA_SHIELD));
- for (AuraEffectList::const_iterator itr = vManaShieldCopy.begin(); (itr != vManaShieldCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
- {
- AuraEffect * absorbAurEff = (*itr);
- // Check if aura was removed during iteration - we don't need to work on such auras
- AuraApplication const * aurApp = absorbAurEff->GetBase()->GetApplicationOfTarget(pVictim->GetGUID());
- if (!aurApp)
- continue;
- // check damage school mask
- if (!(absorbAurEff->GetMiscValue() & schoolMask))
- continue;
+ AuraEffect * absorbAurEff = (*itr);
+ // Check if aura was removed during iteration - we don't need to work on such auras
+ AuraApplication const * aurApp = absorbAurEff->GetBase()->GetApplicationOfTarget(pVictim->GetGUID());
+ if (!aurApp)
+ continue;
+ // check damage school mask
+ if (!(absorbAurEff->GetMiscValue() & schoolMask))
+ continue;
- // get amount which can be still absorbed by the aura
- int32 currentAbsorb = absorbAurEff->GetAmount();
- // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
- if (currentAbsorb < 0)
- currentAbsorb = 0;
+ // get amount which can be still absorbed by the aura
+ int32 currentAbsorb = absorbAurEff->GetAmount();
+ // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
+ if (currentAbsorb < 0)
+ currentAbsorb = 0;
- uint32 absorb = currentAbsorb;
+ uint32 absorb = currentAbsorb;
- bool defaultPrevented = false;
+ bool defaultPrevented = false;
- absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, absorb, defaultPrevented);
- currentAbsorb = absorb;
+ absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, absorb, defaultPrevented);
+ currentAbsorb = absorb;
- if (defaultPrevented)
- continue;
+ if (defaultPrevented)
+ continue;
- AddPctF(currentAbsorb, -auraAbsorbMod);
+ AddPctF(currentAbsorb, -auraAbsorbMod);
- // absorb must be smaller than the damage itself
- currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
+ // absorb must be smaller than the damage itself
+ currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
- int32 manaReduction = currentAbsorb;
+ int32 manaReduction = currentAbsorb;
- // lower absorb amount by talents
- if (float manaMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(absorbAurEff->GetSpellProto(), absorbAurEff->GetEffIndex(), absorbAurEff->GetCaster()))
- manaReduction = int32(float(manaReduction) * manaMultiplier);
+ // lower absorb amount by talents
+ if (float manaMultiplier = SpellMgr::CalculateSpellEffectValueMultiplier(absorbAurEff->GetSpellProto(), absorbAurEff->GetEffIndex(), absorbAurEff->GetCaster()))
+ manaReduction = int32(float(manaReduction) * manaMultiplier);
- int32 manaTaken = -pVictim->ModifyPower(POWER_MANA, -manaReduction);
+ int32 manaTaken = -pVictim->ModifyPower(POWER_MANA, -manaReduction);
- // take case when mana has ended up into account
- currentAbsorb = int32(float(currentAbsorb)*(float(manaTaken) / float(manaReduction)));
+ // take case when mana has ended up into account
+ currentAbsorb = int32(float(currentAbsorb)*(float(manaTaken) / float(manaReduction)));
- dmgInfo.AbsorbDamage(currentAbsorb);
+ dmgInfo.AbsorbDamage(currentAbsorb);
- absorb = currentAbsorb;
- absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, absorb);
+ absorb = currentAbsorb;
+ absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, absorb);
- // Check if our aura is using amount to count damage
- if (absorbAurEff->GetAmount() >= 0)
- {
- absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
- if ((absorbAurEff->GetAmount() <= 0))
- absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
- }
+ // Check if our aura is using amount to count damage
+ if (absorbAurEff->GetAmount() >= 0)
+ {
+ absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
+ if ((absorbAurEff->GetAmount() <= 0))
+ absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
}
}
@@ -1832,18 +1826,6 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
*resist = dmgInfo.GetResist();
*absorb = dmgInfo.GetAbsorb();
-
- // Incanter's Absorption, if have affective absorbing
- if (incanterAbsorption)
- {
- // Incanter's Absorption
- if (AuraEffect const * aurEff = pVictim->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2941, EFFECT_0))
- {
- int32 new_dmg = CalculatePctN(int32(*absorb), aurEff->GetAmount());
- if (new_dmg > 0)
- pVictim->CastCustomSpell(pVictim, 44413, &new_dmg, NULL, NULL, true);
- }
- }
}
void Unit::CalcHealAbsorb(Unit *pVictim, const SpellEntry *healSpell, uint32 &healAmount, uint32 &absorb)