Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AS conversion: disregard weapons lacking ammo #4087

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class ASDamageConverter {
protected int rearLocation;
protected int turretLocation;

private final Map<WeaponType, Boolean> ammoForWeapon = new HashMap<>();
private final Map<WeaponType, Double> ammoModifier = new HashMap<>();
protected final boolean hasTargetingComputer;
protected List<Mounted> weaponsList;
protected double rawSDamage;
Expand Down Expand Up @@ -358,7 +358,7 @@ protected void processEDamage() { }

protected double getDamageMultiplier(Mounted weapon, WeaponType weaponType) {
// Low ammo count
double damageModifier = ammoForWeapon.getOrDefault(weaponType, true) ? 1 : 0.75;
double damageModifier = ammoModifier.getOrDefault(weaponType, 1d);

// Oneshot or Fusillade
if (weaponType.hasFlag(WeaponType.F_ONESHOT) && !(weaponType instanceof CLFussilade)) {
Expand Down Expand Up @@ -409,7 +409,14 @@ protected void assembleAmmoCounts() {
|| weaponType.getAmmoType() == AmmoType.T_AC_ULTRA_THB) {
divisor = 2;
}
ammoForWeapon.put(weaponType, ammoCount / weaponCount.get(weaponType) >= 10 * divisor);

if (ammoCount / weaponCount.get(weaponType) >= 10 * divisor) {
ammoModifier.put(weaponType, 1d);
} else if (ammoCount > 0) {
ammoModifier.put(weaponType, 0.75);
} else {
ammoModifier.put(weaponType, 0d);
}
}
}

Expand Down