From 01830197a31d79828d15801ee6137e535bf851f0 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 4 Jan 2023 22:53:06 +0100 Subject: [PATCH] AS conversion: disregard weapons lacking ammo --- .../alphaStrike/conversion/ASDamageConverter.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/megamek/src/megamek/common/alphaStrike/conversion/ASDamageConverter.java b/megamek/src/megamek/common/alphaStrike/conversion/ASDamageConverter.java index cc32dc3d852..0343d744cc4 100644 --- a/megamek/src/megamek/common/alphaStrike/conversion/ASDamageConverter.java +++ b/megamek/src/megamek/common/alphaStrike/conversion/ASDamageConverter.java @@ -54,7 +54,7 @@ public class ASDamageConverter { protected int rearLocation; protected int turretLocation; - private final Map ammoForWeapon = new HashMap<>(); + private final Map ammoModifier = new HashMap<>(); protected final boolean hasTargetingComputer; protected List weaponsList; protected double rawSDamage; @@ -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)) { @@ -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); + } } }