Core/Stats: Updated handling crit chance - removed school specific crit chances
This commit is contained in:
@@ -5086,7 +5086,7 @@ void Player::UpdateRating(CombatRating cr)
|
||||
break;
|
||||
case CR_CRIT_SPELL:
|
||||
if (affectStats)
|
||||
UpdateAllSpellCritChances();
|
||||
UpdateSpellCritChance();
|
||||
break;
|
||||
case CR_MULTISTRIKE:
|
||||
case CR_READINESS:
|
||||
|
||||
@@ -1966,8 +1966,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
void UpdateRangedHitChances();
|
||||
void UpdateSpellHitChances();
|
||||
|
||||
void UpdateAllSpellCritChances();
|
||||
void UpdateSpellCritChance(uint32 school);
|
||||
void UpdateSpellCritChance();
|
||||
void UpdateArmorPenetration(int32 amount);
|
||||
void UpdateExpertise(WeaponAttackType attType);
|
||||
void ApplyManaRegenBonus(int32 amount, bool apply);
|
||||
|
||||
@@ -114,7 +114,7 @@ bool Player::UpdateStats(Stats stat)
|
||||
UpdateMaxHealth();
|
||||
break;
|
||||
case STAT_INTELLECT:
|
||||
UpdateAllSpellCritChances();
|
||||
UpdateSpellCritChance();
|
||||
UpdateArmor(); //SPELL_AURA_MOD_RESISTANCE_OF_INTELLECT_PERCENT, only armor currently
|
||||
break;
|
||||
default:
|
||||
@@ -201,7 +201,7 @@ bool Player::UpdateAllStats()
|
||||
|
||||
UpdateAllRatings();
|
||||
UpdateAllCritPercentages();
|
||||
UpdateAllSpellCritChances();
|
||||
UpdateSpellCritChance();
|
||||
UpdateBlockPercentage();
|
||||
UpdateParryPercentage();
|
||||
UpdateDodgePercentage();
|
||||
@@ -636,27 +636,18 @@ void Player::UpdateDodgePercentage()
|
||||
SetStatFloatValue(PLAYER_DODGE_PERCENTAGE, value);
|
||||
}
|
||||
|
||||
void Player::UpdateSpellCritChance(uint32 school)
|
||||
void Player::UpdateSpellCritChance()
|
||||
{
|
||||
// For normal school set zero crit chance
|
||||
if (school == SPELL_SCHOOL_NORMAL)
|
||||
{
|
||||
SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1, 0.0f);
|
||||
return;
|
||||
}
|
||||
// For others recalculate it from:
|
||||
float crit = 5.0f;
|
||||
// Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
|
||||
crit += GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
|
||||
// Increase crit from SPELL_AURA_MOD_CRIT_PCT
|
||||
crit += GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
|
||||
// Increase crit by school from SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
|
||||
crit += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, 1<<school);
|
||||
// Increase crit from spell crit ratings
|
||||
crit += GetRatingBonusValue(CR_CRIT_SPELL);
|
||||
|
||||
// Store crit value
|
||||
SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + school, crit);
|
||||
SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1, crit);
|
||||
}
|
||||
|
||||
void Player::UpdateArmorPenetration(int32 amount)
|
||||
@@ -683,12 +674,6 @@ void Player::UpdateSpellHitChances()
|
||||
m_modSpellHitChance += GetRatingBonusValue(CR_HIT_SPELL);
|
||||
}
|
||||
|
||||
void Player::UpdateAllSpellCritChances()
|
||||
{
|
||||
for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
|
||||
UpdateSpellCritChance(i);
|
||||
}
|
||||
|
||||
void Player::UpdateExpertise(WeaponAttackType attack)
|
||||
{
|
||||
if (attack == RANGED_ATTACK)
|
||||
|
||||
@@ -8244,10 +8244,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto
|
||||
else if (GetTypeId() == TYPEID_PLAYER)
|
||||
crit_chance = GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1);
|
||||
else
|
||||
{
|
||||
crit_chance = (float)m_baseSpellCritChance;
|
||||
crit_chance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask);
|
||||
}
|
||||
// taken
|
||||
if (victim)
|
||||
{
|
||||
@@ -8366,10 +8363,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto
|
||||
case SPELL_DAMAGE_CLASS_RANGED:
|
||||
{
|
||||
if (victim)
|
||||
{
|
||||
crit_chance += GetUnitCriticalChance(attackType, victim);
|
||||
crit_chance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -128,7 +128,7 @@ enum AuraType
|
||||
SPELL_AURA_MOD_STALKED = 68,
|
||||
SPELL_AURA_SCHOOL_ABSORB = 69,
|
||||
SPELL_AURA_EXTRA_ATTACKS = 70,
|
||||
SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL = 71,
|
||||
SPELL_AURA_71 = 71,
|
||||
SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT = 72,
|
||||
SPELL_AURA_MOD_POWER_COST_SCHOOL = 73,
|
||||
SPELL_AURA_REFLECT_SPELLS_SCHOOL = 74,
|
||||
|
||||
@@ -130,7 +130,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
|
||||
&AuraEffect::HandleAuraModStalked, // 68 SPELL_AURA_MOD_STALKED
|
||||
&AuraEffect::HandleNoImmediateEffect, // 69 SPELL_AURA_SCHOOL_ABSORB implemented in Unit::CalcAbsorbResist
|
||||
&AuraEffect::HandleUnused, // 70 SPELL_AURA_EXTRA_ATTACKS clientside
|
||||
&AuraEffect::HandleModSpellCritChanceShool, // 71 SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
|
||||
&AuraEffect::HandleNULL, // 71 SPELL_AURA_71
|
||||
&AuraEffect::HandleModPowerCostPCT, // 72 SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
|
||||
&AuraEffect::HandleModPowerCost, // 73 SPELL_AURA_MOD_POWER_COST_SCHOOL
|
||||
&AuraEffect::HandleNoImmediateEffect, // 74 SPELL_AURA_REFLECT_SPELLS_SCHOOL implemented in Unit::SpellHitResult
|
||||
@@ -4328,26 +4328,11 @@ void AuraEffect::HandleModSpellCritChance(AuraApplication const* aurApp, uint8 m
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->ToPlayer()->UpdateAllSpellCritChances();
|
||||
target->ToPlayer()->UpdateSpellCritChance();
|
||||
else
|
||||
target->m_baseSpellCritChance += (apply) ? GetAmount():-GetAmount();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleModSpellCritChanceShool(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
|
||||
{
|
||||
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
|
||||
return;
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
|
||||
if (GetMiscValue() & (1<<school))
|
||||
target->ToPlayer()->UpdateSpellCritChance(school);
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModCritPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||
{
|
||||
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
|
||||
@@ -4366,7 +4351,7 @@ void AuraEffect::HandleAuraModCritPct(AuraApplication const* aurApp, uint8 mode,
|
||||
target->ToPlayer()->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
|
||||
// included in Player::UpdateSpellCritChance calculation
|
||||
target->ToPlayer()->UpdateAllSpellCritChances();
|
||||
target->ToPlayer()->UpdateSpellCritChance();
|
||||
}
|
||||
|
||||
/********************************/
|
||||
|
||||
@@ -258,7 +258,6 @@ class TC_GAME_API AuraEffect
|
||||
void HandleModHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModSpellHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModSpellCritChance(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModSpellCritChanceShool(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModCritPct(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// attack speed
|
||||
void HandleModCastingSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
|
||||
Reference in New Issue
Block a user