mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Spells: Remove some incanter's absorbtion code forgotten in previous rev.
This commit is contained in:
@@ -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;
|
||||
|
||||
// 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;
|
||||
|
||||
bool defaultPrevented = false;
|
||||
|
||||
absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, absorb, defaultPrevented);
|
||||
currentAbsorb = absorb;
|
||||
|
||||
if (defaultPrevented)
|
||||
continue;
|
||||
|
||||
AddPctF(currentAbsorb, -auraAbsorbMod);
|
||||
|
||||
// absorb must be smaller than the damage itself
|
||||
currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
|
||||
|
||||
int32 manaReduction = currentAbsorb;
|
||||
|
||||
// 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);
|
||||
|
||||
// take case when mana has ended up into account
|
||||
currentAbsorb = int32(float(currentAbsorb)*(float(manaTaken) / float(manaReduction)));
|
||||
|
||||
dmgInfo.AbsorbDamage(currentAbsorb);
|
||||
|
||||
absorb = currentAbsorb;
|
||||
absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, absorb);
|
||||
|
||||
// Check if our aura is using amount to count damage
|
||||
if (absorbAurEff->GetAmount() >= 0)
|
||||
{
|
||||
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;
|
||||
|
||||
uint32 absorb = currentAbsorb;
|
||||
|
||||
bool defaultPrevented = false;
|
||||
|
||||
absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, absorb, defaultPrevented);
|
||||
currentAbsorb = absorb;
|
||||
|
||||
if (defaultPrevented)
|
||||
continue;
|
||||
|
||||
AddPctF(currentAbsorb, -auraAbsorbMod);
|
||||
|
||||
// absorb must be smaller than the damage itself
|
||||
currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
|
||||
|
||||
int32 manaReduction = currentAbsorb;
|
||||
|
||||
// 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);
|
||||
|
||||
// take case when mana has ended up into account
|
||||
currentAbsorb = int32(float(currentAbsorb)*(float(manaTaken) / float(manaReduction)));
|
||||
|
||||
dmgInfo.AbsorbDamage(currentAbsorb);
|
||||
|
||||
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);
|
||||
}
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user