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

Fix: Use all of the friendly units for support calculation in OOL #8000

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
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static class Parameters {
@Nonnull Collection<Unit> targetsToPickFrom;
@Nonnull GamePlayer player;
@Nonnull Collection<Unit> enemyUnits;
@Nonnull Collection<Unit> friendlyUnits;
@Nonnull Territory battlesite;
@Nonnull IntegerMap<UnitType> costs;
@Nonnull CombatModifiers combatModifiers;
Expand Down Expand Up @@ -107,7 +108,7 @@ List<Unit> sortUnitsForCasualtiesWithSupport(final Parameters parameters) {
TotalPowerAndTotalRolls.getUnitPowerAndRollsForNormalBattles(
sortedUnitsList,
new ArrayList<>(parameters.enemyUnits),
sortedUnitsList,
new ArrayList<>(parameters.friendlyUnits),
parameters.combatModifiers.isDefending(),
parameters.data,
parameters.battlesite,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public static CasualtyDetails selectCasualties(
defending,
player,
enemyUnits,
friendlyUnits,
battlesite,
costs,
territoryEffects,
Expand Down Expand Up @@ -281,6 +282,7 @@ private static Tuple<CasualtyList, List<Unit>> getDefaultCasualties(
final boolean defending,
final GamePlayer player,
final Collection<Unit> enemyUnits,
final Collection<Unit> friendlyUnits,
final Territory battlesite,
final IntegerMap<UnitType> costs,
final Collection<TerritoryEffect> territoryEffects,
Expand All @@ -295,6 +297,7 @@ private static Tuple<CasualtyList, List<Unit>> getDefaultCasualties(
.targetsToPickFrom(targetsToPickFrom)
.player(player)
.enemyUnits(enemyUnits)
.friendlyUnits(friendlyUnits)
.combatModifiers(
CombatModifiers.builder()
.territoryEffects(territoryEffects)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ private CasualtyOrderOfLosses.Parameters withFakeParameters() {
.build())
.player(player)
.enemyUnits(List.of())
.friendlyUnits(List.of())
.battlesite(territory)
.costs(IntegerMap.of(Map.of()))
.data(gameData)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private CasualtyOrderOfLosses.Parameters amphibAssault(final Collection<Unit> am
CombatModifiers.builder().defending(false).territoryEffects(List.of()).build())
.player(testData.british)
.enemyUnits(List.of())
.friendlyUnits(amphibUnits)
.battlesite(testData.france)
.costs(testData.costMap)
.data(testData.gameData)
Expand Down Expand Up @@ -193,6 +194,7 @@ void nonAmphibiousMarineWithAmphibiousAssault() {
CombatModifiers.builder().defending(false).territoryEffects(List.of()).build())
.player(testData.british)
.enemyUnits(List.of())
.friendlyUnits(attackingUnits)
.battlesite(testData.france)
.costs(testData.costMap)
.data(testData.gameData)
Expand Down Expand Up @@ -241,6 +243,7 @@ void amphibiousAndNonAmphibiousCaching() {
CombatModifiers.builder().defending(false).territoryEffects(List.of()).build())
.player(testData.british)
.enemyUnits(List.of())
.friendlyUnits(attackingUnits)
.battlesite(testData.france)
.costs(testData.costMap)
.data(testData.gameData)
Expand All @@ -260,6 +263,7 @@ void amphibiousAndNonAmphibiousCaching() {
CombatModifiers.builder().defending(false).territoryEffects(List.of()).build())
.player(testData.british)
.enemyUnits(List.of())
.friendlyUnits(attackingUnits.subList(0, 3))
.battlesite(testData.france)
.costs(testData.costMap)
.data(testData.gameData)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ private CasualtyOrderOfLosses.Parameters attackingWith(final Collection<Unit> un
CombatModifiers.builder().defending(false).territoryEffects(List.of()).build())
.player(BRITISH)
.enemyUnits(List.of())
.friendlyUnits(units)
.battlesite(FRANCE)
.costs(COST_MAP)
.data(data)
Expand Down Expand Up @@ -218,6 +219,7 @@ private CasualtyOrderOfLosses.Parameters amphibAssault(final Collection<Unit> am
CombatModifiers.builder().defending(false).territoryEffects(List.of()).build())
.player(BRITISH)
.enemyUnits(List.of())
.friendlyUnits(amphibUnits)
.battlesite(FRANCE)
.costs(COST_MAP)
.data(data)
Expand Down Expand Up @@ -298,6 +300,7 @@ private CasualtyOrderOfLosses.Parameters defendingWith(final Collection<Unit> un
CombatModifiers.builder().defending(true).territoryEffects(List.of()).build())
.player(BRITISH)
.enemyUnits(List.of())
.friendlyUnits(units)
.battlesite(FRANCE)
.costs(COST_MAP)
.data(data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ private CasualtyOrderOfLosses.Parameters attackingWith(final Collection<Unit> un
CombatModifiers.builder().defending(false).territoryEffects(List.of()).build())
.player(BRITISH)
.enemyUnits(List.of())
.friendlyUnits(units)
.battlesite(NORMANDY)
.costs(COST_MAP)
.data(data)
Expand Down