From 0b2e13dc67400e2ab19685272c0998d80ff619de Mon Sep 17 00:00:00 2001 From: WCSumpton Date: Tue, 17 Sep 2024 10:13:57 -0400 Subject: [PATCH] Update UnitScrollerModel.java This update improves the Active Unit Scroller ability to locate units that are capable to move. --- .../triplea/ui/unit/scroller/UnitScrollerModel.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/game-app/game-core/src/main/java/games/strategy/triplea/ui/unit/scroller/UnitScrollerModel.java b/game-app/game-core/src/main/java/games/strategy/triplea/ui/unit/scroller/UnitScrollerModel.java index ce8c8c070ff..4fe229299d5 100644 --- a/game-app/game-core/src/main/java/games/strategy/triplea/ui/unit/scroller/UnitScrollerModel.java +++ b/game-app/game-core/src/main/java/games/strategy/triplea/ui/unit/scroller/UnitScrollerModel.java @@ -26,7 +26,18 @@ static List getMoveableUnits( final Predicate moveableUnitOwnedByMe = PredicateBuilder.of(Matches.unitIsOwnedBy(player)) - .and(Matches.unitHasMovementLeft()) + .and((Matches.unitHasMovementLeft()) + // add transported units that have not landed + .or(Matches.unitIsBeingTransported() + .and(Matches.unitWasUnloadedThisTurn().negate())) + // including units that cannot move, that have not moved + // that can be transported or that can receive movement bonus + .or(Matches.unitCanMove().negate() + .and(Matches.unitHasMoved().negate()) + .and((Matches.unitCanBeTransported() + .or(Matches.unitIsAirTransportable() + .or(Matches.unitIsLandTransportable() + .or(Matches.unitCanBeGivenBonusMovementByFacilitiesInItsTerritory(t, player)))))))) // if not non combat, cannot move aa units .andIf( movePhase == UnitScroller.MovePhase.COMBAT, Matches.unitCanMoveDuringCombatMove())