Fix best weapon calculations
This commit is contained in:
parent
330edde003
commit
7096116296
|
@ -1714,17 +1714,18 @@ static Object* _ai_best_weapon(Object* attacker, Object* weapon1, Object* weapon
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
avgDamage1 = (maxDamage - minDamage) / 2;
|
// SFALL: Fix avg damage calculation.
|
||||||
|
avgDamage1 = (maxDamage + minDamage) / 2;
|
||||||
if (_item_w_area_damage_radius(weapon1, HIT_MODE_RIGHT_WEAPON_PRIMARY) > 0 && defender != NULL) {
|
if (_item_w_area_damage_radius(weapon1, HIT_MODE_RIGHT_WEAPON_PRIMARY) > 0 && defender != NULL) {
|
||||||
attack.weapon = weapon1;
|
attack.weapon = weapon1;
|
||||||
_compute_explosion_on_extras(&attack, 0, weaponIsGrenade(weapon1), 1);
|
_compute_explosion_on_extras(&attack, 0, weaponIsGrenade(weapon1), 1);
|
||||||
avgDamage1 *= attack.extrasLength + 1;
|
avgDamage1 *= attack.extrasLength + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Probably an error, why it takes [weapon2], should likely use
|
// SFALL: Fix for the incorrect item being checked.
|
||||||
// [weapon1].
|
if (weaponGetPerk(weapon1) != -1) {
|
||||||
if (weaponGetPerk(weapon2) != -1) {
|
// SFALL: Lower weapon score multiplier for having perk.
|
||||||
avgDamage1 *= 5;
|
avgDamage1 *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defender != NULL) {
|
if (defender != NULL) {
|
||||||
|
@ -1758,7 +1759,8 @@ static Object* _ai_best_weapon(Object* attacker, Object* weapon1, Object* weapon
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
avgDamage2 = (maxDamage - minDamage) / 2;
|
// SFALL: Fix avg damage calculation.
|
||||||
|
avgDamage2 = (maxDamage + minDamage) / 2;
|
||||||
if (_item_w_area_damage_radius(weapon2, HIT_MODE_RIGHT_WEAPON_PRIMARY) > 0 && defender != NULL) {
|
if (_item_w_area_damage_radius(weapon2, HIT_MODE_RIGHT_WEAPON_PRIMARY) > 0 && defender != NULL) {
|
||||||
attack.weapon = weapon2;
|
attack.weapon = weapon2;
|
||||||
_compute_explosion_on_extras(&attack, 0, weaponIsGrenade(weapon2), 1);
|
_compute_explosion_on_extras(&attack, 0, weaponIsGrenade(weapon2), 1);
|
||||||
|
@ -1766,7 +1768,8 @@ static Object* _ai_best_weapon(Object* attacker, Object* weapon1, Object* weapon
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weaponGetPerk(weapon2) != -1) {
|
if (weaponGetPerk(weapon2) != -1) {
|
||||||
avgDamage2 *= 5;
|
// SFALL: Lower weapon score multiplier for having perk.
|
||||||
|
avgDamage2 *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defender != NULL) {
|
if (defender != NULL) {
|
||||||
|
|
Loading…
Reference in New Issue