mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[11538] Add safeguard against weirdness in UpdateCombatSkills
Prevent weapon/defense update also in case of negative skill difference result (may become negative after use of .level -N -command) Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
4b919b1f32
commit
0fbf2cf7d3
2 changed files with 6 additions and 3 deletions
|
|
@ -5614,8 +5614,11 @@ void Player::UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool de
|
|||
if(lvldif < 3)
|
||||
lvldif = 3;
|
||||
|
||||
uint32 skilldif = 5 * plevel - (defence ? GetBaseDefenseSkillValue() : GetBaseWeaponSkillValue(attType));
|
||||
if(skilldif <= 0)
|
||||
int32 skilldif = 5 * plevel - (defence ? GetBaseDefenseSkillValue() : GetBaseWeaponSkillValue(attType));
|
||||
|
||||
// Max skill reached for level.
|
||||
// Can in some cases be less than 0: having max skill and then .level -1 as example.
|
||||
if (skilldif <= 0)
|
||||
return;
|
||||
|
||||
float chance = float(3 * lvldif * skilldif) / plevel;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue