Skip to content

Commit

Permalink
It was not possible to parry with fist weapons before 1.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
ratkosrb committed Oct 24, 2023
1 parent 9128f9e commit d391cd1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
23 changes: 23 additions & 0 deletions src/game/Objects/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8956,6 +8956,29 @@ Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool nonbroken, bo
return item;
}

bool Player::HasWeaponForParry() const
{
Item* pWeapon = GetWeaponForAttack(BASE_ATTACK, true, true);

// World of Warcraft Client Patch 1.6.0 (2005-07-12)
// - Fist Weapons will now have the normal chance to parry that all
// weapons use.
#if SUPPORTED_CLIENT_BUILD <= CLIENT_BUILD_1_5_1
if (pWeapon && pWeapon->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_FIST)
pWeapon = nullptr;
#endif

if (!pWeapon)
pWeapon = GetWeaponForAttack(OFF_ATTACK, true, true);

#if SUPPORTED_CLIENT_BUILD <= CLIENT_BUILD_1_5_1
if (pWeapon && pWeapon->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_FIST)
pWeapon = nullptr;
#endif

return pWeapon != nullptr;
}

uint32 Player::GetAttackBySlot(uint8 slot)
{
switch (slot)
Expand Down
11 changes: 2 additions & 9 deletions src/game/Objects/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2684,15 +2684,8 @@ float Unit::GetUnitParryChance() const

if (Player const* pPlayer = ToPlayer())
{
if (pPlayer->CanParry())
{
Item* tmpitem = pPlayer->GetWeaponForAttack(BASE_ATTACK, true, true);
if (!tmpitem)
tmpitem = pPlayer->GetWeaponForAttack(OFF_ATTACK, true, true);

if (tmpitem)
chance = GetFloatValue(PLAYER_PARRY_PERCENTAGE);
}
if (pPlayer->CanParry() && pPlayer->HasWeaponForParry())
chance = GetFloatValue(PLAYER_PARRY_PERCENTAGE);
}
else
{
Expand Down

0 comments on commit d391cd1

Please sign in to comment.