Fix max throw range calculation

This commit is contained in:
Alexander Batalov 2022-12-28 12:33:10 +03:00
parent b6ee5fcbe9
commit c2c26db5d9
1 changed files with 10 additions and 4 deletions

View File

@ -1584,7 +1584,7 @@ int weaponReload(Object* weapon, Object* ammo)
int weaponGetRange(Object* critter, int hitMode)
{
int range;
int v12;
int effectiveStrength;
// NOTE: Uninline.
Object* weapon = critterGetWeaponForHitMode(critter, hitMode);
@ -1600,12 +1600,18 @@ int weaponGetRange(Object* critter, int hitMode)
if (weaponGetAttackTypeForHitMode(weapon, hitMode) == ATTACK_TYPE_THROW) {
if (critter == gDude) {
v12 = critterGetStat(critter, STAT_STRENGTH) + 2 * perkGetRank(critter, PERK_HEAVE_HO);
effectiveStrength = critterGetStat(critter, STAT_STRENGTH) + 2 * perkGetRank(critter, PERK_HEAVE_HO);
// SFALL: Fix for Heave Ho! increasing effective strength above
// 10.
if (effectiveStrength > PRIMARY_STAT_MAX) {
effectiveStrength = PRIMARY_STAT_MAX;
}
} else {
v12 = critterGetStat(critter, STAT_STRENGTH);
effectiveStrength = critterGetStat(critter, STAT_STRENGTH);
}
int maxRange = 3 * v12;
int maxRange = 3 * effectiveStrength;
if (range >= maxRange) {
range = maxRange;
}