- Automatically handling multiple triggers from the same card(s) - i.e. Goblin Armory, etc.

This commit is contained in:
marcins78@gmail.com
2011-12-15 19:16:58 +00:00
parent 425c19806e
commit 6a095e9d1e
2 changed files with 21 additions and 0 deletions

View File

@@ -288,6 +288,11 @@ public class TurnProcedure {
public void doPlayEffect(LotroGame game) {
if (_actions.size() == 1) {
_game.getActionsEnvironment().addActionToStack(_actions.get(0));
} else if (areAllActionsTheSame(game)) {
Action anyAction = _actions.get(0);
_actions.remove(anyAction);
_game.getActionsEnvironment().addActionToStack(anyAction);
_action.insertEffect(new PlayoutAllActionsIfEffectNotCancelledEffect(_action, _actions));
} else {
_game.getUserFeedback().sendAwaitingDecision(_game.getGameState().getCurrentPlayerId(),
new ActionSelectionDecision(_game, 1, "Required responses", _actions) {
@@ -301,5 +306,20 @@ public class TurnProcedure {
});
}
}
private boolean areAllActionsTheSame(LotroGame game) {
Iterator<Action> actionIterator = _actions.iterator();
Action firstAction = actionIterator.next();
if (firstAction.getActionSource() == null)
return false;
while (actionIterator.hasNext()) {
Action otherAction = actionIterator.next();
if (otherAction.getActionSource() == null || otherAction.getActionSource().getBlueprint() != firstAction.getActionSource().getBlueprint())
return false;
}
return true;
}
}
}

View File

@@ -5,6 +5,7 @@
cards from discard.
- "One Good Turn Deserves Another" plays next site now, instead of replacing current one.
- "Safe Passage" should no longer freeze the game, when player moves after it's played.
- Automatically handling multiple triggers from the same card(s) - i.e. Goblin Armory, etc.
<b>14 Dec. 2011</b>
- Added "Black Rider" - set 12.