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

SPA Cross-Country #4118

Merged
merged 7 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
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
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 @@ -534,6 +534,8 @@ PilotOptionsInfo.option.animal_mimic.displayableName=Animal Mimicry (CamOps)
PilotOptionsInfo.option.animal_mimic.description=Allows a Quad Mek or ProtoMek, or a bipedal Mek or ProtoMek with the animalistic quirk, the following benefits.\n-1 MP per hex of Woods and Jungle terrain.\n In addition quads gain a -1 to any quad related PSR check.\nNOTE: The quirk should be used only on bipedal units that have an animal like appearance.
PilotOptionsInfo.option.blood_stalker.displayableName=Blood Stalker (CamOps)
PilotOptionsInfo.option.blood_stalker.description=Unit has -1 bonus against designated target, +2 penalty against all others; lasts until target retreats, can only be used once per battle.
PilotOptionsInfo.option.cross_country.displayableName=Cross-Country (CamOps)
PilotOptionsInfo.option.cross_country.description=Allows a unit to use terrain normally restricted to said unit at the cost of increased MP.
PilotOptionsInfo.option.dodge_maneuver.displayableName= Dodge (MaxTech)
PilotOptionsInfo.option.dodge_maneuver.description=Enables the unit to make a dodge maneuver instead of a physical attack.\nThis maneuver adds +2 to the BTH to physical attacks against the unit.\nNOTE: The dodge maneuver is declared during the weapons phase.\nNote: This ability is only used for BattleMeks.
PilotOptionsInfo.option.eagle_eyes.displayableName= Eagle's Eyes (CamOps)
Expand Down
21 changes: 21 additions & 0 deletions megamek/src/megamek/common/Tank.java
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,18 @@ public boolean isLocationProhibited(Coords c, int currElevation) {
boolean isAmphibious = hasWorkingMisc(MiscType.F_FULLY_AMPHIBIOUS);
boolean hexHasRoad = hex.containsTerrain(Terrains.ROAD);
boolean scoutBikeIntoLightWoods = (hex.terrainLevel(Terrains.WOODS) == 1) && hasQuirk(OptionsConstants.QUIRK_POS_SCOUT_BIKE);
boolean isCrossCountry = hasAbility(OptionsConstants.PILOT_CROSS_COUNTRY);

// roads allow movement through hexes that you normally couldn't go through
switch (movementMode) {
case TRACKED:
if (isCrossCountry && !isSuperHeavy()) {
return ((hex.terrainLevel(Terrains.WATER) > 0)
&& !hex.containsTerrain(Terrains.ICE)
&& !hasFlotationHull && !isAmphibious)
|| (hex.terrainLevel(Terrains.MAGMA) > 1);
}

if (!isSuperHeavy()) {
return ((hex.terrainLevel(Terrains.WOODS) > 1) && !hexHasRoad)
|| ((hex.terrainLevel(Terrains.WATER) > 0)
Expand All @@ -632,6 +640,15 @@ public boolean isLocationProhibited(Coords c, int currElevation) {
|| (hex.terrainLevel(Terrains.MAGMA) > 1);
}
case WHEELED:
if (isCrossCountry && !isSuperHeavy()) {
return ((hex.terrainLevel(Terrains.WATER) > 0)
&& !hex.containsTerrain(Terrains.ICE)
&& !hasFlotationHull && !isAmphibious)
|| hex.containsTerrain(Terrains.MAGMA)
|| ((hex.terrainLevel(Terrains.SNOW) > 1) && !hexHasRoad)
|| (hex.terrainLevel(Terrains.GEYSER) == 2);
}

if (!isSuperHeavy()) {
return (hex.containsTerrain(Terrains.WOODS) && !hexHasRoad && !scoutBikeIntoLightWoods)
|| (hex.containsTerrain(Terrains.ROUGH) && !hexHasRoad)
Expand All @@ -655,6 +672,10 @@ public boolean isLocationProhibited(Coords c, int currElevation) {
|| (hex.terrainLevel(Terrains.GEYSER) == 2);
}
case HOVER:
if (isCrossCountry && !isSuperHeavy()) {
return (hex.terrainLevel(Terrains.MAGMA) > 1);
}

if (!isSuperHeavy()) {
return (hex.containsTerrain(Terrains.WOODS) && !hexHasRoad && !scoutBikeIntoLightWoods)
|| (hex.containsTerrain(Terrains.JUNGLE) && !hexHasRoad)
Expand Down
41 changes: 41 additions & 0 deletions megamek/src/megamek/common/Terrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ public void pilotingModifier(EntityMovementMode moveMode, PilotingRollData roll,
public int movementCost(Entity e) {
EntityMovementMode moveMode = e.getMovementMode();
int mp;
boolean isCrossCountry = e.hasAbility(OptionsConstants.PILOT_CROSS_COUNTRY);

switch (type) {
case Terrains.MAGMA:
return level - 1;
Expand All @@ -381,34 +383,55 @@ public int movementCost(Entity e) {
}
return 0;
case Terrains.RUBBLE:
boolean allowRubbleHoverTracked = ((moveMode == EntityMovementMode.HOVER) || (moveMode == EntityMovementMode.TRACKED)) && (level == 6);

if (level == 6) {
mp = 2;
} else {
mp = 1;
}

if (isCrossCountry && e.isGround() && e.isCombatVehicle()) {
if (allowRubbleHoverTracked || (moveMode == EntityMovementMode.WHEELED)) {
mp *= 2;
}
}

if ((e instanceof Mech) && e.isSuperHeavy()) {
mp -= 1;
}

if (e.hasAbility(OptionsConstants.PILOT_TM_MOUNTAINEER)) {
mp -= 1;
}

if ((e.hasAbility(OptionsConstants.INFANTRY_FOOT_CAV)
&& (moveMode == EntityMovementMode.INF_LEG))) {
mp -= 1;
}
return Math.max(0, mp);
case Terrains.WOODS:
mp = level;
if (isCrossCountry && e.isGround() && e.isCombatVehicle()) {
if (((level == 1) && ((moveMode == EntityMovementMode.HOVER) || (moveMode == EntityMovementMode.WHEELED)))
|| (level > 1)) {
mp *= 2;
}
}

if ((e instanceof Mech) && e.isSuperHeavy()) {
mp -= 1;
}

if (e.hasAbility(OptionsConstants.PILOT_TM_FOREST_RANGER)) {
mp -= 1;
}

if ((e.hasAbility(OptionsConstants.INFANTRY_FOOT_CAV)
&& (moveMode == EntityMovementMode.INF_LEG))) {
mp -= 1;
}

if (e.hasAbility(OptionsConstants.PILOT_ANIMAL_MIMIC)) {
if ((e.entityIsQuad()) || ((moveMode == EntityMovementMode.BIPED) && e.hasQuirk("animalistic"))) {
mp -= 1;
Expand All @@ -417,16 +440,23 @@ public int movementCost(Entity e) {
return Math.max(0, mp);
case Terrains.JUNGLE:
mp = level +1;
if (isCrossCountry && e.isGround() && e.isCombatVehicle()) {
mp *= 2;
}

if ((e instanceof Mech) && e.isSuperHeavy()) {
mp -= 1;
}

if (e.hasAbility(OptionsConstants.PILOT_TM_FOREST_RANGER)) {
mp -= 1;
}

if ((e.hasAbility(OptionsConstants.INFANTRY_FOOT_CAV)
&& (moveMode == EntityMovementMode.INF_LEG))) {
mp -= 1;
}

if (e.hasAbility(OptionsConstants.PILOT_ANIMAL_MIMIC)) {
if ((e.entityIsQuad()) || ((moveMode == EntityMovementMode.BIPED) && e.hasQuirk("animalistic"))) {
mp -= 1;
Expand Down Expand Up @@ -489,17 +519,28 @@ public int movementCost(Entity e) {
}
return Math.max(0, mp);
case Terrains.ROUGH:
boolean allowRoughHoverTracked = ((moveMode == EntityMovementMode.HOVER) || (moveMode == EntityMovementMode.TRACKED)) && (level == 2);

if (level == 2) {
mp = 2;
} else {
mp = 1;
}

if (isCrossCountry && e.isGround() && e.isCombatVehicle()) {
if ( allowRoughHoverTracked || (moveMode == EntityMovementMode.WHEELED)) {
mp *= 2;
}
}

if ((e instanceof Mech) && e.isSuperHeavy()) {
mp -= 1;
}

if (e.hasAbility(OptionsConstants.PILOT_TM_MOUNTAINEER)) {
mp -= 1;
}

if ((e.hasAbility(OptionsConstants.INFANTRY_FOOT_CAV)
&& (moveMode == EntityMovementMode.INF_LEG))) {
mp -= 1;
Expand Down
3 changes: 2 additions & 1 deletion megamek/src/megamek/common/options/OptionsConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public class OptionsConstants {
public static final String PILOT_APTITUDE_GUNNERY = "aptitude_gunnery";
public static final String PILOT_APTITUDE_PILOTING = "aptitude_piloting";
public static final String PILOT_ANIMAL_MIMIC = "animal_mimic";
// public static final String PILOT_CROSS_COUNTRY = "cross_country";
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";
Expand All @@ -170,6 +170,7 @@ public class OptionsConstants {
// public static final String PILOT_WIND_WALKER = "wind_walker";
public static final String PILOT_ZWEIHANDER = "zweihander";


// GUNNERY SKILLS
public static final String GUNNERY_BLOOD_STALKER = "blood_stalker";
public static final String GUNNERY_CLUSTER_HITTER = "cluster_hitter";
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 @@ -36,7 +36,7 @@ public void initialize() {
IBasicOptionGroup adv = addGroup("adv", LVL3_ADVANTAGES);

addOption(adv, OptionsConstants.PILOT_ANIMAL_MIMIC, false);
// addOption(adv, OptionsConstants.PILOT_CROSS_COUNTRY, false);
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);
Expand Down