mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[9144] Propertly update combat ratings fields.
* Implemented proper combat rating fields update like other stats fields. This will prevent reset combat ratings at .reset stats for example. * Skill loading moved after InitStatsForLevel for prevent reset fields setup as part of aura apply from skill set triggered spell casts. This fix for example talent 53125 work (combat rating set at skill loading)
This commit is contained in:
parent
7985fe3d0f
commit
324772283f
4 changed files with 46 additions and 19 deletions
|
|
@ -4925,7 +4925,36 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply)
|
|||
{
|
||||
m_baseRatingValue[cr]+=(apply ? value : -value);
|
||||
|
||||
int32 amount = uint32(m_baseRatingValue[cr]);
|
||||
// explicit affected values
|
||||
switch (cr)
|
||||
{
|
||||
case CR_HASTE_MELEE:
|
||||
{
|
||||
float RatingChange = value / GetRatingCoefficient(cr);
|
||||
ApplyAttackTimePercentMod(BASE_ATTACK,RatingChange,apply);
|
||||
ApplyAttackTimePercentMod(OFF_ATTACK,RatingChange,apply);
|
||||
break;
|
||||
}
|
||||
case CR_HASTE_RANGED:
|
||||
{
|
||||
float RatingChange = value / GetRatingCoefficient(cr);
|
||||
ApplyAttackTimePercentMod(RANGED_ATTACK, RatingChange, apply);
|
||||
break;
|
||||
}
|
||||
case CR_HASTE_SPELL:
|
||||
{
|
||||
float RatingChange = value / GetRatingCoefficient(cr);
|
||||
ApplyCastTimePercentMod(RatingChange,apply);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateRating(cr);
|
||||
}
|
||||
|
||||
void Player::UpdateRating(CombatRating cr)
|
||||
{
|
||||
int32 amount = m_baseRatingValue[cr];
|
||||
// Apply bonus from SPELL_AURA_MOD_RATING_FROM_STAT
|
||||
// stat used stored in miscValueB for this aura
|
||||
AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
|
||||
|
|
@ -4936,9 +4965,6 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply)
|
|||
amount = 0;
|
||||
SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr, uint32(amount));
|
||||
|
||||
float RatingCoeffecient = GetRatingCoefficient(cr);
|
||||
float RatingChange = 0.0f;
|
||||
|
||||
bool affectStats = CanModifyStats();
|
||||
|
||||
switch (cr)
|
||||
|
|
@ -4990,18 +5016,9 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply)
|
|||
break;
|
||||
case CR_CRIT_TAKEN_SPELL: // Implemented in Unit::SpellCriticalBonus (only for chance to crit)
|
||||
break;
|
||||
case CR_HASTE_MELEE:
|
||||
RatingChange = value / RatingCoeffecient;
|
||||
ApplyAttackTimePercentMod(BASE_ATTACK,RatingChange,apply);
|
||||
ApplyAttackTimePercentMod(OFF_ATTACK,RatingChange,apply);
|
||||
break;
|
||||
case CR_HASTE_MELEE: // Implemented in Player::ApplyRatingMod
|
||||
case CR_HASTE_RANGED:
|
||||
RatingChange = value / RatingCoeffecient;
|
||||
ApplyAttackTimePercentMod(RANGED_ATTACK, RatingChange, apply);
|
||||
break;
|
||||
case CR_HASTE_SPELL:
|
||||
RatingChange = value / RatingCoeffecient;
|
||||
ApplyCastTimePercentMod(RatingChange,apply);
|
||||
break;
|
||||
case CR_WEAPON_SKILL_MAINHAND: // Implemented in Unit::RollMeleeOutcomeAgainst
|
||||
case CR_WEAPON_SKILL_OFFHAND:
|
||||
|
|
@ -5021,6 +5038,12 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply)
|
|||
}
|
||||
}
|
||||
|
||||
void Player::UpdateAllRatings()
|
||||
{
|
||||
for(int cr = 0; cr < MAX_COMBAT_RATING; ++cr)
|
||||
UpdateRating(CombatRating(cr));
|
||||
}
|
||||
|
||||
void Player::SetRegularAttackTime()
|
||||
{
|
||||
for(int i = 0; i < MAX_ATTACK; ++i)
|
||||
|
|
@ -14900,8 +14923,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
// cleanup aura list explicitly before skill load wher some spells can be applied
|
||||
RemoveAllAuras();
|
||||
|
||||
_LoadSkills(holder->GetResult(PLAYER_LOGIN_QUERY_LOADSKILLS));
|
||||
|
||||
// make sure the unit is considered out of combat for proper loading
|
||||
ClearInCombat();
|
||||
|
||||
|
|
@ -14917,10 +14938,13 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
|
||||
// reset stats before loading any modifiers
|
||||
InitStatsForLevel();
|
||||
InitTaxiNodesForLevel();
|
||||
InitGlyphsForLevel();
|
||||
InitTaxiNodesForLevel();
|
||||
InitRunes();
|
||||
|
||||
// load skills after InitStatsForLevel because it triggering aura apply also
|
||||
_LoadSkills(holder->GetResult(PLAYER_LOGIN_QUERY_LOADSKILLS));
|
||||
|
||||
// apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods()
|
||||
|
||||
// Mail
|
||||
|
|
|
|||
|
|
@ -1774,11 +1774,13 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
void UpdateDamagePhysical(WeaponAttackType attType);
|
||||
void ApplySpellPowerBonus(int32 amount, bool apply);
|
||||
void UpdateSpellDamageAndHealingBonus();
|
||||
void ApplyRatingMod(CombatRating cr, int32 value, bool apply);
|
||||
void UpdateRating(CombatRating cr);
|
||||
void UpdateAllRatings();
|
||||
|
||||
void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, float& min_damage, float& max_damage);
|
||||
|
||||
void UpdateDefenseBonusesMod();
|
||||
void ApplyRatingMod(CombatRating cr, int32 value, bool apply);
|
||||
float GetMeleeCritFromAgility();
|
||||
float GetDodgeFromAgility();
|
||||
float GetSpellCritFromIntellect();
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ bool Player::UpdateAllStats()
|
|||
for(int i = POWER_MANA; i < MAX_POWERS; ++i)
|
||||
UpdateMaxPower(Powers(i));
|
||||
|
||||
UpdateAllRatings();
|
||||
UpdateAllCritPercentages();
|
||||
UpdateAllSpellCritChances();
|
||||
UpdateDefenseBonusesMod();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9143"
|
||||
#define REVISION_NR "9144"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue