Package megamek.common.orders
Class LanceRoles
java.lang.Object
megamek.common.orders.LanceRoles
Finding and defaulting lance roles: which lances on a side are convoys an escort can guard, and the edge a new convoy
leaves by.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA lance an escort can be given: a convoy, or a lance that becomes one when an escort is given it. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<LanceRoles.ConvoyChoice> convoyChoices(Game game, Player side, int excludeForceId) The lances an escort can be given: every other lance on the side with a bot's units, convoys first.static OffBoardDirectiondefaultExitEdge(Entity unit) The edge a new convoy leaves by: the one opposite where its units deploy - deploy south, exit north (HammerGS, 2026-10-02).static LanceRoleeffectiveRole(Entity unit) The role of a unit's lance: its own, else that of a unit of the same owner in the same lance, so a unit added to a convoy or escort lance later joins it (HammerGS, 2026-10-03).static LanceRole
-
Method Details
-
convoyChoices
public static List<LanceRoles.ConvoyChoice> convoyChoices(Game game, Player side, int excludeForceId) The lances an escort can be given: every other lance on the side with a bot's units, convoys first. One that is not a convoy yet becomes one when an escort is given it, so roles can be set in any order (HammerGS, 2026-10-03). Escort lances are left out.- Parameters:
game- the gameside- a player of the sideexcludeForceId- a lance to leave out - the escort itself - or -1- Returns:
- the lances, convoys first, each group in force order
-
unitsOf
- Returns:
- a lance's units still in the game, deployed or not
-
defaultExitEdge
The edge a new convoy leaves by: the one opposite where its units deploy - deploy south, exit north (HammerGS, 2026-10-02). North when the deployment is not along an edge.- Parameters:
unit- one of the convoy's units, ornull- Returns:
- the edge
-
effectiveRole
The role of a unit's lance: its own, else that of a unit of the same owner in the same lance, so a unit added to a convoy or escort lance later joins it (HammerGS, 2026-10-03). This looks through every unit in the game; the bot, which asks for every move it scores, keeps its own table a phase instead.- Parameters:
unit- a unit- Returns:
- the role, or
nullfor none
-
roleOf
- Parameters:
units- a lance's units- Returns:
- the role its units share, or the first one found;
nullwhen none has a role
-