Package megamek.common
Class InfantryCombatResult
java.lang.Object
megamek.common.InfantryCombatResult
Represents the result of an infantry vs. infantry combat action based on TOAR Infantry vs. Infantry Action Table.
Results can be: - ELIMINATED ('E'): Defender is eliminated - REPULSED ('R'): Attacker is repulsed and takes half damage - PARTIAL ('P'): Partial control, defenders eliminated or will no longer take half damage - CASUALTIES: Numeric percentage of casualties (stored as value)
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic InfantryCombatResultcasualties(int attackerCasualties, int defenderCasualties) Creates a CASUALTIES result (both sides take percentage casualties).static InfantryCombatResultCreates an ELIMINATED result (defender eliminated).intintintintgetType()booleanbooleanbooleanstatic InfantryCombatResultpartial(int attackerCasualties, int defenderCasualties) Creates a PARTIAL result for X%/Y% (P) table entries where both sides take casualties.The result the way the Infantry vs.static InfantryCombatResultrepulsed(int defenderCasualties) Creates a REPULSED result for E/n% table entries.static InfantryCombatResultrepulsed(int attackerCasualties, int defenderCasualties) Creates a REPULSED result for X%/Y% (R) table entries where both sides take casualties.toString()The table cell, which is locale-neutral, so the same text serves logs and reports.
-
Method Details
-
eliminated
Creates an ELIMINATED result (defender eliminated). -
repulsed
Creates a REPULSED result for E/n% table entries. The attacker is eliminated (100% casualties) and the defender takes n% casualties.- Parameters:
defenderCasualties- percentage of defender casualties
-
repulsed
Creates a REPULSED result for X%/Y% (R) table entries where both sides take casualties.- Parameters:
attackerCasualties- percentage of attacker casualtiesdefenderCasualties- percentage of defender casualties
-
partial
Creates a PARTIAL result for X%/Y% (P) table entries where both sides take casualties.- Parameters:
attackerCasualties- percentage of attacker casualtiesdefenderCasualties- percentage of defender casualties
-
casualties
Creates a CASUALTIES result (both sides take percentage casualties).- Parameters:
attackerCasualties- percentage of attacker casualtiesdefenderCasualties- percentage of defender casualties
-
getType
-
getAttackerCasualtiesPercent
public int getAttackerCasualtiesPercent() -
getDefenderCasualtiesPercent
public int getDefenderCasualtiesPercent() -
isDefenderEliminated
public boolean isDefenderEliminated() -
isAttackerRepulsed
public boolean isAttackerRepulsed() -
isPartialControl
public boolean isPartialControl() -
getAttackerCasualties
public int getAttackerCasualties() -
getDefenderCasualties
public int getDefenderCasualties() -
printedCell
The result the way the Infantry vs. Infantry Action Table prints it: the attacker's percentage, the defender's, and the R or P flag, with E for a side that is eliminated. An eliminated attacker cannot be repulsed as well, so the R flag is left off such a cell.- Returns:
- the cell, for example
70%/30% (R)or25%/E (P)
-
toString
The table cell, which is locale-neutral, so the same text serves logs and reports.
-