Core/Spells: Implement SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER

Correct variable names / comments for SPELL_AURA_BYPASS_ARMOR_FOR_CASTER
This commit is contained in:
Shocker committed 2011-11-26 23:27:02 +02:00
1 parent d26b7210fb
commit d1135f00c6
2 files changed
+10 -5

No files matched your search

+9 -4
View File
@@ -1490,13 +1490,13 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
uint32 newdamage = 0;
float armor = float(victim->GetArmor());
// bypass enemy armor effectiveness by SPELL_AURA_BYPASS_ARMOR_FOR_CASTER
int32 auraEffectivenessReduction = 0;
// bypass enemy armor by SPELL_AURA_BYPASS_ARMOR_FOR_CASTER
int32 armorBypassPct = 0;
AuraEffectList const & reductionAuras = victim->GetAuraEffectsByType(SPELL_AURA_BYPASS_ARMOR_FOR_CASTER);
for (AuraEffectList::const_iterator i = reductionAuras.begin(); i != reductionAuras.end(); ++i)
if ((*i)->GetCasterGUID() == GetGUID())
auraEffectivenessReduction += (*i)->GetAmount();
armor = CalculatePctN(armor, 100 - std::min(auraEffectivenessReduction, 100));
armorBypassPct += (*i)->GetAmount();
armor = CalculatePctN(armor, 100 - std::min(armorBypassPct, 100));
// Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura
armor += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL);
@@ -11025,6 +11025,11 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRITICAL_CHANCE, crit_chance);
AuraEffectList const& critAuras = victim->GetAuraEffectsByType(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER);
for (AuraEffectList::const_iterator i = critAuras.begin(); i != critAuras.end(); ++i)
if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
crit_chance += (*i)->GetAmount();
crit_chance = crit_chance > 0.0f ? crit_chance : 0.0f;
if (roll_chance_f(crit_chance))
return true;