Skip to content

Commit

Permalink
Merge pull request #5839 from NickAragua/heavy_lifter_spa
Browse files Browse the repository at this point in the history
implement heavy lifter SPA
  • Loading branch information
SJuliez authored Aug 2, 2024
2 parents 3fdd443 + 37a465c commit d228257
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
2 changes: 2 additions & 0 deletions megamek/i18n/megamek/common/options/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion megamek/src/megamek/common/BipedMech.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 12 additions & 8 deletions megamek/src/megamek/common/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -3290,19 +3290,19 @@ public void setBotSettings(Map<String, BehaviorSettings> 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);
}
}

Expand All @@ -3311,15 +3311,15 @@ public void removeGroundObject(Coords coords, ICarryable carryable) {
* guaranteed to return non-null, but may return empty list
*/
public List<ICarryable> getGroundObjects(Coords coords) {
return groundObjects.containsKey(coords) ? groundObjects.get(coords) : new ArrayList<>();
return getGroundObjects().containsKey(coords) ? getGroundObjects().get(coords) : new ArrayList<>();
}

/**
* Get a list of all objects on the ground at the given coordinates
* that can be picked up by the given entity
*/
public List<ICarryable> getGroundObjects(Coords coords, Entity entity) {
if (!groundObjects.containsKey(coords)) {
if (!getGroundObjects().containsKey(coords)) {
return new ArrayList<>();
}

Expand All @@ -3331,7 +3331,7 @@ public List<ICarryable> getGroundObjects(Coords coords, Entity entity) {
double maxTonnage = entity.maxGroundObjectTonnage();
ArrayList<ICarryable> result = new ArrayList<>();

for (ICarryable object : groundObjects.get(coords)) {
for (ICarryable object : getGroundObjects().get(coords)) {
if (maxTonnage >= object.getTonnage()) {
result.add(object);
}
Expand All @@ -3345,6 +3345,10 @@ public List<ICarryable> getGroundObjects(Coords coords, Entity entity) {
* if looking for objects in specific hex
*/
public Map<Coords, List<ICarryable>> getGroundObjects() {
if (groundObjects == null) {
groundObjects = new HashMap<>();
}

return groundObjects;
}

Expand Down
5 changes: 4 additions & 1 deletion megamek/src/megamek/common/Protomech.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion megamek/src/megamek/common/TripodMech.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/options/OptionsConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/options/PilotOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d228257

Please sign in to comment.