Skip to content

Commit

Permalink
Use new roll dice, select casualties, and remove casualties steps (#8087
Browse files Browse the repository at this point in the history
)

The Fire and FireAa classes are no longer used in building the 3 fire
sub steps.

The AirVsNonSubs step is removed because that firing group is now named
and will be displayed in the battle ui when it fires, selects, and
removes.
  • Loading branch information
trevan authored Nov 5, 2020
1 parent ca8059a commit bf7a536
Show file tree
Hide file tree
Showing 38 changed files with 765 additions and 1,021 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import games.strategy.engine.delegate.IDelegateBridge;
import games.strategy.engine.player.Player;
import games.strategy.triplea.ai.weak.WeakAi;
import games.strategy.triplea.attachments.UnitAttachment;
import games.strategy.triplea.delegate.Matches;
import games.strategy.triplea.delegate.TerritoryEffectHelper;
import games.strategy.triplea.delegate.TransportTracker;
Expand Down Expand Up @@ -345,19 +344,6 @@ static GamePlayer findPlayerWithMostUnits(final Collection<Unit> units) {
return player;
}

/**
* The maximum number of hits that this collection of units can sustain, taking into account units
* with two hits, and accounting for existing damage.
*/
static int getMaxHits(final Collection<Unit> units) {
int count = 0;
for (final Unit unit : units) {
count += UnitAttachment.get(unit.getType()).getHitPoints();
count -= unit.getHits();
}
return count;
}

void markDamaged(final Collection<Unit> damaged, final IDelegateBridge bridge) {
BattleDelegate.markDamaged(damaged, bridge, battleSite);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@
import games.strategy.triplea.ai.weak.WeakAi;
import games.strategy.triplea.delegate.battle.MustFightBattle.ReturnFire;
import java.util.Collection;
import java.util.function.Predicate;

/** Actions that can occur in a battle that require interaction with {@link IDelegateBridge} */
public interface BattleActions {

void fireOffensiveAaGuns();

void fireDefensiveAaGuns();

void fireNavalBombardment(IDelegateBridge bridge);

void removeNonCombatants(IDelegateBridge bridge);

void clearWaitingToDieAndDamagedChangesInto(IDelegateBridge bridge);
Expand All @@ -28,17 +21,6 @@ void removeCasualties(

void endBattle(IBattle.WhoWon whoWon, IDelegateBridge bridge);

void findTargetGroupsAndFire(
ReturnFire returnFire,
String stepName,
boolean defending,
GamePlayer firingPlayer,
Predicate<Unit> firingUnitPredicate,
Collection<Unit> firingUnits,
Collection<Unit> firingUnitsWaitingToDie,
Collection<Unit> enemyUnits,
Collection<Unit> enemyUnitsWaitingToDie);

void remove(
Collection<Unit> killedUnits,
IDelegateBridge bridge,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ public boolean isFirstRound() {

void retreatUnits(Side side, Collection<Unit> units);

Collection<Unit> getAa(Side... sides);

Collection<Unit> getBombardingUnits();

GamePlayer getPlayer(Side side);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ public interface BattleStepStrings {

String AA_GUNS_FIRE_SUFFIX = " fire";
String FIRE_SUFFIX = " fire";
String FIRST_STRIKE_UNITS_FIRE_SUFFIX = " first strike units fire";
String SELECT_PREFIX = " select ";
String REMOVE_PREFIX = " remove ";
String NOTIFY_PREFIX = " notify ";
String CASUALTIES_SUFFIX = " casualties";
String CASUALTIES_WITHOUT_SPACE_SUFFIX = "casualties";
String LAND_PARATROOPS = "Land Paratroopers";
Expand All @@ -21,8 +22,6 @@ public interface BattleStepStrings {
String UNITS = "units";
String FIRST_STRIKE_UNITS = "first strike units";
String REMOVE_SNEAK_ATTACK_CASUALTIES = "Remove sneak attack casualties";
String FIRE = " fire";
String FIRST_STRIKE_UNITS_FIRE = " first strike units fire";
String SELECT_FIRST_STRIKE_CASUALTIES = " select first strike casualties";
String SELECT_CASUALTIES = " select casualties";
String REMOVE_CASUALTIES = "Remove casualties";
Expand Down
Loading

0 comments on commit bf7a536

Please sign in to comment.