Skip to content

Commit

Permalink
feat: added behavior to stop targeted attack if there is a time limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Scoppio committed Jan 12, 2025
1 parent 8bce3f3 commit 3a3cbb3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions MekHQ/src/mekhq/campaign/autoresolve/OrderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ private void createOrderFromObjective(int ownerId, ScenarioObjective objective)
private void createForceWithdrawOrder(int ownerId, ScenarioObjective objective) {
var orderBuilder = Order.OrderBuilder.anOrder(ownerId, OrderType.ATTACK_TARGET_NOT_WITHDRAWING)
.withCondition(Condition.alwaysTrue());
if (objective.getTimeLimitType() != ScenarioObjective.TimeLimitType.None) {
orderBuilder.withCondition(context -> context.getCurrentRound() <= objective.getTimeLimit());
}
addOrder(orderBuilder.build());
}

Expand All @@ -106,6 +109,9 @@ private void createReachMapEdgeOrder(int ownerId, ScenarioObjective objective) {
private void createPreventReachMapEdgeOrder(int ownerId, ScenarioObjective objective) {
var orderBuilder = Order.OrderBuilder.anOrder(ownerId, OrderType.ATTACK_TARGET_WITHDRAWING)
.withCondition(Condition.alwaysTrue());
if (objective.getTimeLimitType() != ScenarioObjective.TimeLimitType.None) {
orderBuilder.withCondition(context -> context.getCurrentRound() <= objective.getTimeLimit());
}
addOrder(orderBuilder.build());
}

Expand Down

0 comments on commit 3a3cbb3

Please sign in to comment.