diff --git a/megamek/i18n/megamek/common/options/messages.properties b/megamek/i18n/megamek/common/options/messages.properties index 837dc6e4052..dea9a6b922b 100644 --- a/megamek/i18n/megamek/common/options/messages.properties +++ b/megamek/i18n/megamek/common/options/messages.properties @@ -566,6 +566,8 @@ PilotOptionsInfo.option.eagle_eyes.displayableName= Eagle's Eyes (CamOps) PilotOptionsInfo.option.eagle_eyes.description= Acts as an active probe or extends range of existing active probe. Also makes avoiding minefields easier PilotOptionsInfo.option.hot_dog.displayableName= Hot Dog (CamOps) PilotOptionsInfo.option.hot_dog.description= Reduce heat-related target rolls (e.g ammo, damage, shutdown) by 1. +PilotOptionsInfo.option.hvy_lifter.displayableName= Heavy Lifter (CamOps) +PilotOptionsInfo.option.hvy_lifter.description= Increases cargo carrying capability by 50%. PilotOptionsInfo.option.jumping_jack.displayableName= Jumping Jack (CamOps) PilotOptionsInfo.option.jumping_jack.description=Unit only suffers a +1 to-hit penalty for jumping, rather than a +3 to-hit penalty. PilotOptionsInfo.option.hopping_jack.displayableName= Hopping Jack (Unofficial) diff --git a/megamek/src/megamek/common/BipedMech.java b/megamek/src/megamek/common/BipedMech.java index d80461cb1a8..e8a1470a053 100644 --- a/megamek/src/megamek/common/BipedMech.java +++ b/megamek/src/megamek/common/BipedMech.java @@ -109,7 +109,9 @@ public double maxGroundObjectTonnage() { percentage += 0.05; } - return getWeight() * percentage; + double heavyLifterMultiplier = hasAbility(OptionsConstants.PILOT_HVY_LIFTER) ? 1.5 : 1.0; + + return getWeight() * percentage * heavyLifterMultiplier; } @Override diff --git a/megamek/src/megamek/common/Game.java b/megamek/src/megamek/common/Game.java index bbbcc8821de..de5ab8b62ce 100644 --- a/megamek/src/megamek/common/Game.java +++ b/megamek/src/megamek/common/Game.java @@ -3290,19 +3290,19 @@ public void setBotSettings(Map botSettings) { * Place a carryable object on the ground at the given coordinates */ public void placeGroundObject(Coords coords, ICarryable carryable) { - if (!groundObjects.containsKey(coords)) { - groundObjects.put(coords, new ArrayList<>()); + if (!getGroundObjects().containsKey(coords)) { + getGroundObjects().put(coords, new ArrayList<>()); } - groundObjects.get(coords).add(carryable); + getGroundObjects().get(coords).add(carryable); } /** * Remove the given carryable object from the ground at the given coordinates */ public void removeGroundObject(Coords coords, ICarryable carryable) { - if (groundObjects.containsKey(coords)) { - groundObjects.get(coords).remove(carryable); + if (getGroundObjects().containsKey(coords)) { + getGroundObjects().get(coords).remove(carryable); } } @@ -3311,7 +3311,7 @@ public void removeGroundObject(Coords coords, ICarryable carryable) { * guaranteed to return non-null, but may return empty list */ public List getGroundObjects(Coords coords) { - return groundObjects.containsKey(coords) ? groundObjects.get(coords) : new ArrayList<>(); + return getGroundObjects().containsKey(coords) ? getGroundObjects().get(coords) : new ArrayList<>(); } /** @@ -3319,7 +3319,7 @@ public List getGroundObjects(Coords coords) { * that can be picked up by the given entity */ public List getGroundObjects(Coords coords, Entity entity) { - if (!groundObjects.containsKey(coords)) { + if (!getGroundObjects().containsKey(coords)) { return new ArrayList<>(); } @@ -3331,7 +3331,7 @@ public List getGroundObjects(Coords coords, Entity entity) { double maxTonnage = entity.maxGroundObjectTonnage(); ArrayList result = new ArrayList<>(); - for (ICarryable object : groundObjects.get(coords)) { + for (ICarryable object : getGroundObjects().get(coords)) { if (maxTonnage >= object.getTonnage()) { result.add(object); } @@ -3345,6 +3345,10 @@ public List getGroundObjects(Coords coords, Entity entity) { * if looking for objects in specific hex */ public Map> getGroundObjects() { + if (groundObjects == null) { + groundObjects = new HashMap<>(); + } + return groundObjects; } diff --git a/megamek/src/megamek/common/Protomech.java b/megamek/src/megamek/common/Protomech.java index 11eebb940ab..eefda585432 100644 --- a/megamek/src/megamek/common/Protomech.java +++ b/megamek/src/megamek/common/Protomech.java @@ -18,6 +18,7 @@ import megamek.common.enums.AimingMode; import megamek.common.equipment.AmmoMounted; import megamek.common.equipment.ArmorType; +import megamek.common.options.OptionsConstants; import megamek.common.planetaryconditions.Atmosphere; import megamek.common.preference.PreferenceManager; import org.apache.logging.log4j.LogManager; @@ -596,7 +597,9 @@ public double maxGroundObjectTonnage() { percentage += 0.05; } - return getWeight() * percentage; + double heavyLifterMultiplier = hasAbility(OptionsConstants.PILOT_HVY_LIFTER) ? 1.5 : 1.0; + + return getWeight() * percentage * heavyLifterMultiplier; } @Override diff --git a/megamek/src/megamek/common/TripodMech.java b/megamek/src/megamek/common/TripodMech.java index 809400c0ad3..200e2d3a230 100644 --- a/megamek/src/megamek/common/TripodMech.java +++ b/megamek/src/megamek/common/TripodMech.java @@ -156,7 +156,9 @@ public double maxGroundObjectTonnage() { percentage += 0.05; } - return getWeight() * percentage; + double heavyLifterMultiplier = hasAbility(OptionsConstants.PILOT_HVY_LIFTER) ? 1.5 : 1.0; + + return getWeight() * percentage * heavyLifterMultiplier; } @Override diff --git a/megamek/src/megamek/common/options/OptionsConstants.java b/megamek/src/megamek/common/options/OptionsConstants.java index 9a65c56b4e8..60e22e04e9f 100644 --- a/megamek/src/megamek/common/options/OptionsConstants.java +++ b/megamek/src/megamek/common/options/OptionsConstants.java @@ -147,7 +147,7 @@ public class OptionsConstants { public static final String PILOT_CROSS_COUNTRY = "cross_country"; public static final String PILOT_DODGE_MANEUVER = "dodge_maneuver"; // public static final String PILOT_DUST_OFF = "dust_off"; - // public static final String PILOT_HVY_LIFTER = "hvy_lifter"; + public static final String PILOT_HVY_LIFTER = "hvy_lifter"; // public static final String PILOT_HOPPER = "hopper"; public static final String PILOT_HOPPING_JACK = "hopping_jack"; public static final String PILOT_HOT_DOG = "hot_dog"; diff --git a/megamek/src/megamek/common/options/PilotOptions.java b/megamek/src/megamek/common/options/PilotOptions.java index c28da03180f..68677db3359 100755 --- a/megamek/src/megamek/common/options/PilotOptions.java +++ b/megamek/src/megamek/common/options/PilotOptions.java @@ -39,7 +39,7 @@ public void initialize() { addOption(adv, OptionsConstants.PILOT_CROSS_COUNTRY, false); addOption(adv, OptionsConstants.PILOT_DODGE_MANEUVER, false); // addOption(adv, OptionsConstants.PILOT_DUST_OFF, false); - // addOption(adv, OptionsConstants.PILOT_HVY_LIFTER, false); + addOption(adv, OptionsConstants.PILOT_HVY_LIFTER, false); // addOption(adv, OptionsConstants.PILOT_HOPPER, false); addOption(adv, OptionsConstants.PILOT_HOPPING_JACK, false); addOption(adv, OptionsConstants.PILOT_HOT_DOG, false);