Core/Spells: Implemented SPELL_ATTR6_ABSORB_CANNOT_BE_IGNORE
This commit is contained in:
1 parent
c78371f321
commit
f93918ef0c
2 files changed
+61
-50
No files matched your search
@@ -1709,7 +1709,6 @@ static float GetArmorReduction(float armor, uint8 attackerLevel)
|
||||
RoundToInterval(auraAbsorbMod, 0.0f, 100.0f);
|
||||
|
||||
int32 absorbIgnoringDamage = CalculatePct(damageInfo.GetDamage(), auraAbsorbMod);
|
||||
damageInfo.ModifyDamage(-absorbIgnoringDamage);
|
||||
|
||||
// We're going to call functions which can modify content of the list during iteration over it's elements
|
||||
// Let's copy the list so we can prevent iterator invalidation
|
||||
@@ -1733,6 +1732,9 @@ static float GetArmorReduction(float armor, uint8 attackerLevel)
|
||||
if (currentAbsorb < 0)
|
||||
currentAbsorb = 0;
|
||||
|
||||
if (!absorbAurEff->GetSpellInfo()->HasAttribute(SPELL_ATTR6_ABSORB_CANNOT_BE_IGNORE))
|
||||
damageInfo.ModifyDamage(-absorbIgnoringDamage);
|
||||
|
||||
uint32 tempAbsorb = uint32(currentAbsorb);
|
||||
|
||||
bool defaultPrevented = false;
|
||||
@@ -1740,26 +1742,30 @@ static float GetArmorReduction(float armor, uint8 attackerLevel)
|
||||
absorbAurEff->GetBase()->CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, damageInfo, tempAbsorb, defaultPrevented);
|
||||
currentAbsorb = tempAbsorb;
|
||||
|
||||
if (defaultPrevented)
|
||||
continue;
|
||||
|
||||
// absorb must be smaller than the damage itself
|
||||
currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(damageInfo.GetDamage()));
|
||||
|
||||
damageInfo.AbsorbDamage(currentAbsorb);
|
||||
|
||||
tempAbsorb = currentAbsorb;
|
||||
absorbAurEff->GetBase()->CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, damageInfo, tempAbsorb);
|
||||
|
||||
// Check if our aura is using amount to count damage
|
||||
if (absorbAurEff->GetAmount() >= 0)
|
||||
if (!defaultPrevented)
|
||||
{
|
||||
// Reduce shield amount
|
||||
absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
|
||||
// Aura cannot absorb anything more - remove it
|
||||
if (absorbAurEff->GetAmount() <= 0)
|
||||
absorbAurEff->GetBase()->Remove(AuraRemoveFlags::ByEnemySpell);
|
||||
|
||||
// absorb must be smaller than the damage itself
|
||||
currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(damageInfo.GetDamage()));
|
||||
|
||||
damageInfo.AbsorbDamage(currentAbsorb);
|
||||
|
||||
tempAbsorb = currentAbsorb;
|
||||
absorbAurEff->GetBase()->CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, damageInfo, tempAbsorb);
|
||||
|
||||
// Check if our aura is using amount to count damage
|
||||
if (absorbAurEff->GetAmount() >= 0)
|
||||
{
|
||||
// Reduce shield amount
|
||||
absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
|
||||
// Aura cannot absorb anything more - remove it
|
||||
if (absorbAurEff->GetAmount() <= 0)
|
||||
absorbAurEff->GetBase()->Remove(AuraRemoveFlags::ByEnemySpell);
|
||||
}
|
||||
}
|
||||
|
||||
if (!absorbAurEff->GetSpellInfo()->HasAttribute(SPELL_ATTR6_ABSORB_CANNOT_BE_IGNORE))
|
||||
damageInfo.ModifyDamage(absorbIgnoringDamage);
|
||||
}
|
||||
|
||||
// absorb by mana cost
|
||||
@@ -1781,6 +1787,9 @@ static float GetArmorReduction(float armor, uint8 attackerLevel)
|
||||
if (currentAbsorb < 0)
|
||||
currentAbsorb = 0;
|
||||
|
||||
if (!absorbAurEff->GetSpellInfo()->HasAttribute(SPELL_ATTR6_ABSORB_CANNOT_BE_IGNORE))
|
||||
damageInfo.ModifyDamage(-absorbIgnoringDamage);
|
||||
|
||||
uint32 tempAbsorb = currentAbsorb;
|
||||
|
||||
bool defaultPrevented = false;
|
||||
@@ -1788,38 +1797,40 @@ static float GetArmorReduction(float armor, uint8 attackerLevel)
|
||||
absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, damageInfo, tempAbsorb, defaultPrevented);
|
||||
currentAbsorb = tempAbsorb;
|
||||
|
||||
if (defaultPrevented)
|
||||
continue;
|
||||
|
||||
// absorb must be smaller than the damage itself
|
||||
currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(damageInfo.GetDamage()));
|
||||
|
||||
int32 manaReduction = currentAbsorb;
|
||||
|
||||
// lower absorb amount by talents
|
||||
if (float manaMultiplier = absorbAurEff->GetSpellInfo()->Effects[absorbAurEff->GetEffIndex()].CalcValueMultiplier(absorbAurEff->GetCaster()))
|
||||
manaReduction = int32(float(manaReduction) * manaMultiplier);
|
||||
|
||||
int32 manaTaken = -damageInfo.GetVictim()->ModifyPower(POWER_MANA, -manaReduction);
|
||||
|
||||
// take case when mana has ended up into account
|
||||
currentAbsorb = currentAbsorb ? int32(float(currentAbsorb) * (float(manaTaken) / float(manaReduction))) : 0;
|
||||
|
||||
damageInfo.AbsorbDamage(currentAbsorb);
|
||||
|
||||
tempAbsorb = currentAbsorb;
|
||||
absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, damageInfo, tempAbsorb);
|
||||
|
||||
// Check if our aura is using amount to count damage
|
||||
if (absorbAurEff->GetAmount() >= 0)
|
||||
if (!defaultPrevented)
|
||||
{
|
||||
absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
|
||||
if ((absorbAurEff->GetAmount() <= 0))
|
||||
absorbAurEff->GetBase()->Remove(AuraRemoveFlags::ByEnemySpell);
|
||||
}
|
||||
}
|
||||
|
||||
damageInfo.ModifyDamage(absorbIgnoringDamage);
|
||||
// absorb must be smaller than the damage itself
|
||||
currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(damageInfo.GetDamage()));
|
||||
|
||||
int32 manaReduction = currentAbsorb;
|
||||
|
||||
// lower absorb amount by talents
|
||||
if (float manaMultiplier = absorbAurEff->GetSpellInfo()->Effects[absorbAurEff->GetEffIndex()].CalcValueMultiplier(absorbAurEff->GetCaster()))
|
||||
manaReduction = int32(float(manaReduction) * manaMultiplier);
|
||||
|
||||
int32 manaTaken = -damageInfo.GetVictim()->ModifyPower(POWER_MANA, -manaReduction);
|
||||
|
||||
// take case when mana has ended up into account
|
||||
currentAbsorb = currentAbsorb ? int32(float(currentAbsorb) * (float(manaTaken) / float(manaReduction))) : 0;
|
||||
|
||||
damageInfo.AbsorbDamage(currentAbsorb);
|
||||
|
||||
tempAbsorb = currentAbsorb;
|
||||
absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, damageInfo, tempAbsorb);
|
||||
|
||||
// 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(AuraRemoveFlags::ByEnemySpell);
|
||||
}
|
||||
}
|
||||
|
||||
if (!absorbAurEff->GetSpellInfo()->HasAttribute(SPELL_ATTR6_ABSORB_CANNOT_BE_IGNORE))
|
||||
damageInfo.ModifyDamage(absorbIgnoringDamage);
|
||||
}
|
||||
|
||||
// split damage auras - only when not damaging self
|
||||
if (damageInfo.GetVictim() != damageInfo.GetAttacker())
|
||||
|
||||
Reference in new issue
Block a user