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

Beast mounted infantry #4883

Merged
merged 34 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b08c24c
Added beast mounted infantry data.
neoancient Sep 5, 2023
ad3c601
Added code for beast-mounted infanry to Infantry.
neoancient Sep 6, 2023
e13ea21
Check mount size before adding anti-mech attacks.
neoancient Sep 6, 2023
3d5957d
Add bonus damage at range 0.
neoancient Sep 6, 2023
ed37a60
Apply damage to buildings from beasts entering.
neoancient Sep 6, 2023
5d18c70
Add building mp cost.
neoancient Sep 6, 2023
de5a23f
Add hit modifier for beast size.
neoancient Sep 6, 2023
1ee065e
String encoding and decoding for beast mounts.
neoancient Sep 6, 2023
006e0d0
BLK file import/export for beast-mounted infantry.
neoancient Sep 6, 2023
42d54d4
Added tech advancement for beast-mounted infantry.
neoancient Sep 7, 2023
2154c51
Added beast-mounted as a motive option for conventional infantry.
neoancient Sep 7, 2023
6d9288f
Merge branch 'master' into beast_mounted_infantry
neoancient Nov 5, 2023
ca956f1
Improvements to mount table.
neoancient Nov 5, 2023
d2bc76f
Update mount when selected
neoancient Nov 5, 2023
59baefb
Fix max platoon and squad size calculation for beast-mounted.
neoancient Nov 5, 2023
3194d31
Added missing break
neoancient Nov 6, 2023
946bebb
Manage damage divisor from armor kit, mount, and implants.
neoancient Nov 6, 2023
11b1069
Show mount name on movement line in MechView.
neoancient Nov 6, 2023
32c6d73
Added beast-mounted details to TRO view.
neoancient Nov 6, 2023
34f2320
Make InfantryMount serializable.
neoancient Nov 6, 2023
dff5674
Include mount in cost calculations.
neoancient Nov 7, 2023
8b91967
Apply rules clarification to damage divisor.
neoancient Nov 7, 2023
a25494d
Apply rules clarification about vehicle damage.
neoancient Nov 7, 2023
fe7ef64
Track rounds spent underwater.
neoancient Nov 7, 2023
828573c
Show remaining air for underwater mounts on summary panel and tooltip.
neoancient Nov 8, 2023
f0b2600
Destroy marine beast-mounted infantry units that do not surface in time.
neoancient Nov 8, 2023
d1aface
Show attacker to-hit mod due to size on the TRO view and record sheet.
neoancient Nov 9, 2023
93c207e
Make very large and monstrous mounted infantry 2 levels high.
neoancient Nov 9, 2023
fc017fb
Fix issues with aquatic beast infantry with height 2.
neoancient Nov 9, 2023
7720659
Handle uw beast-mounted infantry entering and leaving the water.
neoancient Nov 9, 2023
18e6837
Fix mount size attacker mod.
neoancient Nov 10, 2023
f0addbf
Implement mount effects on secondary weapon limits.
neoancient Nov 10, 2023
9241783
Data: Adding some units and first set of sprites for them.
HammerGS Nov 14, 2023
4f3dd81
Apply the underwater weapons checks to other height 2+ units.
neoancient Nov 15, 2023
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
4 changes: 4 additions & 0 deletions megamek/i18n/megamek/client/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ BoardView1.Tooltip.HotLoaded=Hot-Loaded
BoardView1.Tooltip.HotLoadedParens=(Hot-Loaded)
BoardView1.Tooltip.Immobile=Immobile
BoardView1.Tooltip.InfSpec=Specialization: {0}
BoardView1.Tooltip.InfUWDuration=Rounds of Air: {0}
BoardView1.Tooltip.Internals=Internal: {0}
BoardView1.Tooltip.Jammed=Jammed by Enemy ECM
BoardView1.Tooltip.JumpBoosters=Jump Boosters
Expand Down Expand Up @@ -2468,6 +2469,7 @@ MovementDisplay.ConfirmPilotingRoll=You must make the following piloting\nskill
MovementDisplay.ConfirmSprint=Are you sure you want to sprint?
MovementDisplay.ConfirmSuperchargerRoll=The movement you have selected will require a roll of {0} or higher\nto avoid Supercharger failure. Do you wish to proceed?
MovementDisplay.ConfirmLandingGearDamage=Landing in a rough or rubble hex will damage the landing ger.\n\nAre you sure you want to land here?
MovementDisplay.ConfirmMountSuffocation=This unit will be destroyed if it does not surface for air this round.\nDo you wish to proceed?
MovementDisplay.DFADialog.message=To Hit: {0} ({1}%) ({2})\nDamage to Target: {3} (in 5pt clusters){4}\nDamage to Self: {5} (in 5pt clusters) (using Kick table)
MovementDisplay.DFADialog.title=D.F.A. {0}?
MovementDisplay.Done=Done
Expand Down Expand Up @@ -3795,6 +3797,7 @@ WeaponAttackAction.TeNonAeroAirborne=targeting non-aerospace airborne unit
WeaponAttackAction.PutOutInferno=target is inferno fire
WeaponAttackAction.SensorShadow=Target in Sensor Shadow
WeaponAttackAction.SquadTarget=infantry squad target
WeaponAttackAction.MountSize=mount size
WeaponAttackAction.TeGroundAttack=target making air-to-ground attack
WeaponAttackAction.TeSuperheavyMech=target is superheavy mech
WeaponAttackAction.TeLargeSupportUnit=target is large support unit
Expand Down Expand Up @@ -4073,6 +4076,7 @@ GeneralInfoMapSet.over=Over:
GeneralInfoMapSet.vehicle.mpL1=Cruise:
GeneralInfoMapSet.vehicle.mpL2=Flank:
GeneralInfoMapSet.curMoveL=Currently:
GeneralInfoMapSet.uwCounterL=Rounds of Air Remaining:
GeneralInfoMapSet.currentSensorsL=Current Sensors:
GeneralInfoMapSet.capacity=capacity
GeneralInfoMapSet.heatL=Heat:
Expand Down
10 changes: 9 additions & 1 deletion megamek/i18n/megamek/common/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ TROView.BAModularTurret=Configurable Turret Mount
TROView.Foot=Foot
TROView.Mechanized=Mechanized
TROView.MechanizedSCUBA=Mechanized SCUBA
TROView.BeastMounted=Beast-Mounted
TROView.InfantryNote.FieldGuns=%d %s with %d rounds of ammo each. Each gun requires %d soldiers to operate.
TROView.InfantryNote.SingleFieldGun=1 %s with %d rounds of ammo. Requires %d soldiers to operate.
TROView.InfantryNote.SCUBA=Weapon range is halved (round down) underwater.
Expand All @@ -590,6 +591,9 @@ TROView.InfantryNote.CamoArmor=+3/+2/+1 to-hit modifier to attackers if unit doe
TROView.InfantryNote.IRArmor=Non-infantry units suffer a +1/+1/+2 to-hit modifier for S/M/L ranges.
TROView.InfantryNote.ECMArmor=Invisible to standard/light active probes.
TROView.InfantryNote.Augmented=Cybernetically enhanced infantry:
TROView.InfantryNote.MountInfantryDamage.format=+%dD6 damage vs. infantry
TROView.InfantryNote.MountVehicleDamage.format=+%d damage vs. Vehicles/'Mechs
TROView.InfantryNote.MountSizeMod.format=%d attacker to-hit
MovementType.None=None
MovementType.Biped=Biped
MovementType.Quad=Quad
Expand Down Expand Up @@ -622,4 +626,8 @@ MiscType.ton=ton

PilotingSPA.EnvSpec.RainSpec=Rain Specialist
PilotingSPA.EnvSpec.SnowSpec=Snow Specialist
PilotingSPA.EnvSpec.WindSpec=Wind Specialist
PilotingSPA.EnvSpec.WindSpec=Wind Specialist

BeastSize.large=Large
BeastSize.very_large=Very Large
BeastSize.monstrous=Monstrous
1 change: 1 addition & 0 deletions megamek/i18n/megamek/common/report-messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
2404=<data> (<data>) takes additional damage from beginning and ending movement in a magma hex!
2405=<data> (<data>) is damaged by the extreme heat of liquid magma!
2410=<data> (<data>) breaks through ice from below
2412=<data> (<data>) runs out of air and is destroyed.
2415=<data> collapes due to nuclear explosion ground zero.
2420=<data> (<data>) automatically avoids the skid.
2425=<data> (<data>) needs <data> to avoid the skid (<data>), rolls <data>.
Expand Down
4 changes: 3 additions & 1 deletion megamek/src/megamek/client/ui/swing/DeploymentDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,12 @@ public void hexMoused(BoardViewEvent b) {
} else if (!isAero && !isWiGE) {
// hovers and naval units go on the surface
if ((ce().getMovementMode() == EntityMovementMode.NAVAL)
|| (ce().getMovementMode() == EntityMovementMode.SUBMARINE)
|| (ce().getMovementMode() == EntityMovementMode.HYDROFOIL)
|| (ce().getMovementMode() == EntityMovementMode.HOVER)) {
ce().setElevation(0);
} else if (ce().getMovementMode().isSubmarine()) {
// submarines have one level above the surface
neoancient marked this conversation as resolved.
Show resolved Hide resolved
ce().setElevation(-ce().height());
} else if (isVTOL) {
// VTOLs go to elevation 1... unless set in the Lounge.
// or if mechanized BA, since VTOL movement is then illegal
Expand Down
17 changes: 16 additions & 1 deletion megamek/src/megamek/client/ui/swing/MovementDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,7 @@ && ce().getGame().getBoard().getHex(cmd.getFinalCoords())
if (landingPath.stream().map(c -> game().getBoard().getHex(c)).filter(Objects::nonNull)
.anyMatch(h -> h.containsTerrain(Terrains.ROUGH) || h.containsTerrain(Terrains.RUBBLE))) {
ConfirmDialog nag = new ConfirmDialog(clientgui.frame,
Messages.getString("MovementDisplay.areYourSure"),
Messages.getString("MovementDisplay.areYouSure"),
Messages.getString("MovementDisplay.ConfirmLandingGearDamage"),
false);
nag.setVisible(true);
Expand All @@ -1718,6 +1718,21 @@ && ce().getGame().getBoard().getHex(cmd.getFinalCoords())
isUsingChaff = false;
}

if (ce() instanceof Infantry) {
InfantryMount mount = ((Infantry) ce()).getMount();
if ((mount != null) && ce().getMovementMode().isSubmarine() && (ce().underwaterRounds >= mount.getUWEndurance())
&& cmd.isAllUnderwater(game())) {
ConfirmDialog nag = new ConfirmDialog(clientgui.frame,
Messages.getString("MovementDisplay.areYouSure"),
Messages.getString("MovementDisplay.ConfirmMountSuffocation"),
false);
nag.setVisible(true);
if (!nag.getAnswer()) {
return;
}
}
}

disableButtons();
clientgui.getBoardView().clearMovementData();
clientgui.getBoardView().clearMovementEnvelope();
Expand Down
11 changes: 11 additions & 0 deletions megamek/src/megamek/client/ui/swing/tooltip/UnitToolTip.java
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,17 @@ private static StringBuilder inGameValues(Entity entity, Player localPlayer, boo
}
}

if (entity instanceof Infantry) {
InfantryMount mount = ((Infantry) entity).getMount();
if ((mount != null) && entity.getMovementMode().isSubmarine() && (entity.underwaterRounds > 0)) {
String uw = "<br/>" + addToTT("InfUWDuration", NOBR, mount.getUWEndurance() - entity.underwaterRounds).toString();
if (entity.underwaterRounds >=mount.getUWEndurance()) {
uw = guiScaledFontHTML(GUIP.getWarningColor()) + uw + "</font>";
}
result += uw;
}
}

String sAeroInfo = "";

if (entity.isAero()) {
Expand Down
16 changes: 8 additions & 8 deletions megamek/src/megamek/common/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ public abstract class Entity extends TurnOrdered implements Transporter, Targeta
public int coolFromExternal = 0;
public int delta_distance = 0;
public int mpUsed = 0;
public int underwaterRounds = 0;
public EntityMovementType moved = EntityMovementType.MOVE_NONE;
public EntityMovementType movedLastRound = EntityMovementType.MOVE_NONE;
private boolean movedBackwards = false;
Expand Down Expand Up @@ -1947,7 +1948,7 @@ public void setElevation(int elevation) {
/**
* A helper function for fiddling with elevation. Takes the current hex, a
* hex being moved to, returns the elevation the Entity will be considered
* to be at w/r/t it's new hex.
* to be at w/r/t its new hex.
*/
public int calcElevation(Hex current, Hex next, int assumedElevation,
boolean climb, boolean wigeEndClimbPrevious) {
Expand Down Expand Up @@ -1990,12 +1991,11 @@ public int calcElevation(Hex current, Hex next, int assumedElevation,
}
// Elevation is this height of the level above the actual surface elevation of the hex.
retVal = nextLevel - next.getLevel();
} else if ((getMovementMode() == EntityMovementMode.SUBMARINE)
|| ((getMovementMode() == EntityMovementMode.INF_UMU)
} else if (((getMovementMode().isSubmarine() || getMovementMode().isUMUInfantry())
&& next.containsTerrain(Terrains.WATER) && current.containsTerrain(Terrains.WATER))
|| (getMovementMode() == EntityMovementMode.VTOL)
|| ((getMovementMode() == EntityMovementMode.QUAD_SWIM) && hasUMU())
|| ((getMovementMode() == EntityMovementMode.BIPED_SWIM) && hasUMU())) {
|| getMovementMode().isVTOL()
|| (getMovementMode().isQuadSwim() && hasUMU())
|| (getMovementMode().isBipedSwim() && hasUMU())) {
retVal += current.getLevel();
retVal -= next.getLevel();
} else {
Expand Down Expand Up @@ -2350,8 +2350,8 @@ && getMovementMode() == EntityMovementMode.INF_UMU) {
}
// only mechs can move underwater
if (hex.containsTerrain(Terrains.WATER)
&& (assumedAlt < hex.getLevel()) && !(this instanceof Mech)
&& !(this instanceof Protomech)) {
&& (assumedAlt < hex.getLevel()) && !(this instanceof Mech)
&& !(this instanceof Protomech)) {
return false;
}
// can move on the ground unless its underwater
Expand Down
Loading