Skip to content

Commit

Permalink
Core/Spells: Implement SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER
Browse files Browse the repository at this point in the history
Correct variable names / comments for SPELL_AURA_BYPASS_ARMOR_FOR_CASTER
  • Loading branch information
Shocker committed Nov 26, 2011
1 parent d26b721 commit d1135f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Spells/Auras/SpellAuraDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ enum AuraType
SPELL_AURA_MOD_MINIMUM_SPEED = 305,
SPELL_AURA_306 = 306,
SPELL_AURA_HEAL_ABSORB_TEST = 307,
SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER = 308, // NYI
SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER = 308,
SPELL_AURA_309 = 309,
SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE = 310,
SPELL_AURA_311 = 311,
Expand Down

0 comments on commit d1135f0

Please sign in to comment.