Trying to fix the PreventionEffect, it wasn't complicated enough for what it was supposed to do.

This commit is contained in:
marcins78@gmail.com
2011-10-26 09:51:26 +00:00
parent b64ae17e86
commit 7c198485b6
40 changed files with 389 additions and 205 deletions

View File

@@ -0,0 +1,70 @@
package com.gempukku.lotro.cards.actions;
import com.gempukku.lotro.cards.effects.PreventableEffect;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.decisions.MultipleChoiceAwaitingDecision;
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Iterator;
public class PreventSubAction extends SubAction {
private Effect _effectToExecute;
private Iterator<String> _choicePlayers;
private PreventableEffect.PreventionCost _preventionCost;
private Effect _playerPreventionCost;
public PreventSubAction(Action action, Effect effectToExecute, Iterator<String> choicePlayers, PreventableEffect.PreventionCost preventionCost) {
super(action);
_effectToExecute = effectToExecute;
_choicePlayers = choicePlayers;
_preventionCost = preventionCost;
appendEffect(new DecideIfPossible());
}
private class DecideIfPossible extends UnrespondableEffect {
@Override
protected void doPlayEffect(LotroGame game) {
if (_choicePlayers.hasNext()) {
String nextPlayer = _choicePlayers.next();
_playerPreventionCost = _preventionCost.createPreventionCostForPlayer(PreventSubAction.this, nextPlayer);
if (_playerPreventionCost.isPlayableInFull(game)) {
appendEffect(
new PlayoutDecisionEffect(game.getUserFeedback(), _choicePlayers.next(),
new MultipleChoiceAwaitingDecision(1, "Would you like to - " + _playerPreventionCost.getText(game) + " to prevent - " + _effectToExecute.getText(game), new String[]{"Yes", "No"}) {
@Override
protected void validDecisionMade(int index, String result) {
if (result.equals("Yes")) {
startPrevention();
} else {
appendEffect(new DecideIfPossible());
}
}
}));
} else {
appendEffect(new DecideIfPossible());
}
} else {
appendEffect(_effectToExecute);
}
}
}
private void startPrevention() {
appendEffect(_playerPreventionCost);
appendEffect(new CheckIfPreventingCostWasSuccessful());
}
private class CheckIfPreventingCostWasSuccessful extends UnrespondableEffect {
@Override
protected void doPlayEffect(LotroGame game) {
if (!_playerPreventionCost.wasCarriedOut())
appendEffect(new DecideIfPossible());
}
}
}

View File

@@ -56,9 +56,4 @@ public abstract class ForEachBurdenYouSpotEffect implements Effect {
public boolean wasCarriedOut() {
return true;
}
@Override
public void reset() {
}
}

View File

@@ -56,9 +56,4 @@ public abstract class ForEachTwilightTokenYouSpotEffect implements Effect {
public boolean wasCarriedOut() {
return true;
}
@Override
public void reset() {
}
}

View File

@@ -1,8 +1,9 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.cards.actions.PreventSubAction;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.actions.PreventSubAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.timing.AbstractEffect;
import com.gempukku.lotro.logic.timing.Effect;
@@ -15,17 +16,17 @@ public class PreventableEffect extends AbstractEffect {
private CostToEffectAction _action;
private Effect _effectToExecute;
private Iterator<String> _choicePlayers;
private Effect _preventionCost;
private PreventionCost _preventionCost;
public PreventableEffect(CostToEffectAction action, Effect effectToExecute, String[] choicePlayers, Effect preventionCost) {
public PreventableEffect(CostToEffectAction action, Effect effectToExecute, String[] choicePlayers, PreventionCost preventionCost) {
this(action, effectToExecute, Arrays.asList(choicePlayers), preventionCost);
}
public PreventableEffect(CostToEffectAction action, Effect effectToExecute, String choicePlayer, Effect preventionCost) {
public PreventableEffect(CostToEffectAction action, Effect effectToExecute, String choicePlayer, PreventionCost preventionCost) {
this(action, effectToExecute, Collections.singletonList(choicePlayer), preventionCost);
}
public PreventableEffect(CostToEffectAction action, Effect effectToExecute, List<String> choicePlayers, Effect preventionCost) {
public PreventableEffect(CostToEffectAction action, Effect effectToExecute, List<String> choicePlayers, PreventionCost preventionCost) {
_action = action;
_effectToExecute = effectToExecute;
_choicePlayers = choicePlayers.iterator();
@@ -52,4 +53,8 @@ public class PreventableEffect extends AbstractEffect {
game.getActionsEnvironment().addActionToStack(new PreventSubAction(_action, _effectToExecute, _choicePlayers, _preventionCost));
return new FullEffectResult(null, true, true);
}
public static interface PreventionCost {
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId);
}
}

View File

@@ -12,7 +12,9 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.DrawCardEffect;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Arrays;
@@ -42,7 +44,13 @@ public class Card2_013 extends AbstractOldEvent {
new PreventableEffect(action,
new DrawCardEffect(playerId, 3),
Arrays.asList(GameUtils.getOpponents(game, playerId)),
new RemoveTwilightEffect(3)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new RemoveTwilightEffect(3);
}
}
));
return action;
}

View File

@@ -11,6 +11,8 @@ import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
@@ -54,7 +56,13 @@ public class Card2_017 extends AbstractResponseOldEvent {
}
},
Collections.singletonList(opponentId),
new RemoveTwilightEffect(3)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new RemoveTwilightEffect(3);
}
}
));
}
});
return Collections.singletonList(action);

View File

@@ -10,8 +10,10 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.modifiers.KeywordModifier;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Arrays;
@@ -55,7 +57,13 @@ public class Card2_028 extends AbstractOldEvent {
}
},
Arrays.asList(GameUtils.getOpponents(game, playerId)),
new RemoveTwilightEffect(3)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new RemoveTwilightEffect(3);
}
}
));
return action;
}

View File

@@ -9,8 +9,10 @@ import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
@@ -49,7 +51,13 @@ public class Card2_033 extends AbstractResponseOldEvent {
new PreventableEffect(action,
new DiscardCardsFromPlayEffect(self, orc),
Collections.singletonList(orc.getOwner()),
new RemoveTwilightEffect(3)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new RemoveTwilightEffect(3);
}
}
));
}
});
return Collections.singletonList(action);

View File

@@ -10,8 +10,10 @@ import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.WoundCharactersEffect;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
@@ -53,7 +55,13 @@ public class Card2_103 extends AbstractOldEvent {
new PreventableEffect(action,
new WoundCharactersEffect(self, card),
Collections.singletonList(card.getOwner()),
new RemoveTwilightEffect(3)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new RemoveTwilightEffect(3);
}
}
));
}
});
return action;

View File

@@ -12,7 +12,9 @@ import com.gempukku.lotro.common.Side;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
@@ -52,7 +54,13 @@ public class Card3_050 extends AbstractOldEvent {
new PreventableEffect(action,
new ExhaustCharacterEffect(self, action, aragorn),
Collections.singletonList(game.getGameState().getCurrentPlayerId()),
new AddBurdenEffect(self, 2)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new AddBurdenEffect(self, 2);
}
}
));
}
});
return action;

View File

@@ -13,6 +13,7 @@ import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.AssignmentEffect;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.modifiers.Condition;
@@ -20,6 +21,7 @@ import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.ModifierFlag;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.LinkedList;
@@ -88,13 +90,19 @@ public class Card3_069 extends AbstractMinion {
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose non Ring-bearer companion", Filters.type(CardType.COMPANION), Filters.not(Filters.keyword(Keyword.RING_BEARER)), Filters.canBeAssignedToSkirmishByEffect(Side.SHADOW)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard companion) {
protected void cardSelected(LotroGame game, final PhysicalCard companion) {
action.appendEffect(
new PreventableEffect(
action,
new AssignmentEffect(playerId, companion, minion),
Collections.singletonList(game.getGameState().getCurrentPlayerId()),
new ExertCharactersEffect(self, companion)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ExertCharactersEffect(self, companion);
}
}
));
}
});
}

View File

@@ -11,7 +11,9 @@ import com.gempukku.lotro.common.Side;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Collections;
@@ -62,10 +64,15 @@ public class Card3_080 extends AbstractOldEvent {
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, Filters.name("Boromir")));
}
}, Collections.singletonList(game.getGameState().getCurrentPlayerId()),
new ChooseAndDiscardCardsFromPlayEffect(action, game.getGameState().getCurrentPlayerId(), 2, 2, Filters.side(Side.FREE_PEOPLE), Filters.type(CardType.POSSESSION)) {
new PreventableEffect.PreventionCost() {
@Override
public String getText(LotroGame game) {
return "Discard 2 Free People possessions";
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromPlayEffect(subAction, playerId, 2, 2, Filters.side(Side.FREE_PEOPLE), Filters.type(CardType.POSSESSION)) {
@Override
public String getText(LotroGame game) {
return "Discard 2 Free People possessions";
}
};
}
}
));

View File

@@ -8,7 +8,9 @@ import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Collections;
@@ -59,10 +61,15 @@ public class Card3_103 extends AbstractOldEvent {
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, Filters.name("Galadriel")));
}
}, Collections.singletonList(game.getGameState().getCurrentPlayerId()),
new ChooseAndDiscardCardsFromPlayEffect(action, game.getGameState().getCurrentPlayerId(), 2, 2, Filters.race(Race.ELF)) {
new PreventableEffect.PreventionCost() {
@Override
public String getText(LotroGame game) {
return "Discard 2 Elves from play";
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromPlayEffect(subAction, playerId, 2, 2, Filters.race(Race.ELF)) {
@Override
public String getText(LotroGame game) {
return "Discard 2 Elves from play";
}
};
}
}
));

View File

@@ -11,6 +11,8 @@ import com.gempukku.lotro.common.Side;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
@@ -40,8 +42,8 @@ public class Card3_105 extends AbstractOldEvent {
}
@Override
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
PlayEventAction action = new PlayEventAction(self);
public PlayEventAction getPlayCardAction(String playerId, final LotroGame game, PhysicalCard self, int twilightModifier) {
final PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new PreventableEffect(action,
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.name("Bilbo")) {
@@ -50,7 +52,13 @@ public class Card3_105 extends AbstractOldEvent {
return "Discard Bilbo";
}
}, Collections.singletonList(game.getGameState().getCurrentPlayerId()),
new ChooseAndDiscardCardsFromPlayEffect(action, game.getGameState().getCurrentPlayerId(), 2, 2, Filters.side(Side.FREE_PEOPLE), Filters.type(CardType.CONDITION))));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromPlayEffect(subAction, playerId, 2, 2, Filters.side(Side.FREE_PEOPLE), Filters.type(CardType.CONDITION));
}
}
));
return action;
}
}

View File

@@ -11,7 +11,9 @@ import com.gempukku.lotro.common.Side;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Collections;
@@ -60,7 +62,13 @@ public class Card3_085 extends AbstractOldEvent {
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, Filters.name("Gandalf")));
}
}, Collections.singletonList(game.getGameState().getCurrentPlayerId()),
new ChooseAndDiscardCardsFromHandEffect(action, game.getGameState().getCurrentPlayerId(), false, 2, 2, Filters.culture(Culture.GANDALF))));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromHandEffect(subAction, playerId, false, 2, 2, Filters.culture(Culture.GANDALF));
}
}
));
return action;
}
}

View File

@@ -10,7 +10,9 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Arrays;
@@ -36,8 +38,8 @@ public class Card4_097 extends AbstractOldEvent {
}
@Override
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
PlayEventAction action = new PlayEventAction(self);
public PlayEventAction getPlayCardAction(final String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
final PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new PreventableEffect(action,
new AddUntilEndOfPhaseActionProxyEffect(
@@ -48,10 +50,15 @@ public class Card4_097 extends AbstractOldEvent {
}
},
Arrays.asList(GameUtils.getOpponents(game, playerId)),
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, Filters.type(CardType.MINION)) {
new PreventableEffect.PreventionCost() {
@Override
public String getText(LotroGame game) {
return "Make fellowship player wound a minion";
public Effect createPreventionCostForPlayer(SubAction subAction, String shadowPlayerId) {
return new ChooseAndWoundCharactersEffect(subAction, playerId, 1, 1, Filters.type(CardType.MINION)) {
@Override
public String getText(LotroGame game) {
return "Make fellowship player wound a minion";
}
};
}
}
));

View File

@@ -16,7 +16,9 @@ import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.List;
@@ -50,7 +52,13 @@ public class Card4_112 extends AbstractAttachableFPPossession {
new PreventableEffect(action,
new CancelSkirmishEffect(Filters.hasAttached(self)),
GameUtils.getOpponents(game, playerId),
new RemoveTwilightEffect(1)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new RemoveTwilightEffect(1);
}
}
));
}
return null;
}

View File

@@ -10,8 +10,10 @@ import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.AssignmentEffect;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.Effect;
/**
* Set: The Two Towers
@@ -49,7 +51,7 @@ public class Card4_143 extends AbstractOldEvent {
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose an unbound companion", Filters.unboundCompanion, Filters.canBeAssignedToSkirmishByEffect(Side.SHADOW)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard companion) {
protected void cardSelected(LotroGame game, final PhysicalCard companion) {
Race race = companion.getBlueprint().getRace();
AssignmentEffect assignmentEffect = new AssignmentEffect(playerId, companion, minion);
if (race == Race.HOBBIT) {
@@ -59,7 +61,13 @@ public class Card4_143 extends AbstractOldEvent {
action.insertEffect(
new PreventableEffect(action,
assignmentEffect, game.getGameState().getCurrentPlayerId(),
new ExertCharactersEffect(self, companion)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ExertCharactersEffect(self, companion);
}
}
));
}
}
});

View File

@@ -13,10 +13,12 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.AssignmentEffect;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
@@ -76,7 +78,13 @@ public class Card4_159 extends AbstractAttachable {
new PreventableEffect(action,
new AssignmentEffect(playerId, self.getAttachedTo(), minion),
game.getGameState().getCurrentPlayerId(),
new ExertCharactersEffect(self, self.getAttachedTo())));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ExertCharactersEffect(self, self.getAttachedTo());
}
}
));
}
});
action.appendCost(

View File

@@ -9,9 +9,11 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.AssignmentEffect;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
@@ -45,12 +47,18 @@ public class Card4_164 extends AbstractMinion {
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose unbound companion", Filters.unboundCompanion, Filters.canBeAssignedToSkirmishByEffect(Side.SHADOW)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard companion) {
protected void cardSelected(LotroGame game, final PhysicalCard companion) {
action.insertEffect(
new PreventableEffect(action,
new AssignmentEffect(playerId, companion, self),
game.getGameState().getCurrentPlayerId(),
new ExertCharactersEffect(self, companion)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ExertCharactersEffect(self, companion);
}
}
));
}
});
return Collections.singletonList(action);

View File

@@ -11,6 +11,8 @@ import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.timing.Effect;
/**
* Set: The Two Towers
@@ -33,8 +35,8 @@ public class Card4_240 extends AbstractOldEvent {
}
@Override
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
PlayEventAction action = new PlayEventAction(self);
public PlayEventAction getPlayCardAction(String playerId, final LotroGame game, PhysicalCard self, int twilightModifier) {
final PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.culture(Culture.RAIDER), Filters.race(Race.MAN)));
int burdens = Math.max(0, Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.type(CardType.COMPANION)) - 4);
@@ -42,7 +44,13 @@ public class Card4_240 extends AbstractOldEvent {
new PreventableEffect(action,
new AddBurdenEffect(self, burdens),
game.getGameState().getCurrentPlayerId(),
new ChooseAndDiscardCardsFromPlayEffect(action, game.getGameState().getCurrentPlayerId(), 2, 2, Filters.type(CardType.COMPANION), Filters.not(Filters.keyword(Keyword.RING_BEARER)))));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromPlayEffect(subAction, playerId, 2, 2, Filters.type(CardType.COMPANION), Filters.not(Filters.keyword(Keyword.RING_BEARER)));
}
}
));
return action;
}

View File

@@ -9,9 +9,11 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.AssignmentEffect;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
@@ -49,7 +51,13 @@ public class Card4_249 extends AbstractMinion {
action.insertEffect(new PreventableEffect(action,
new AssignmentEffect(playerId, card, self),
game.getGameState().getCurrentPlayerId(),
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.unboundCompanion)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromPlayEffect(subAction, playerId, 1, 1, Filters.unboundCompanion);
}
}
));
}
});
return Collections.singletonList(action);

View File

@@ -9,8 +9,10 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.AssignmentEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
@@ -43,16 +45,22 @@ public class Card4_256 extends AbstractMinion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.ASSIGNMENT, self, 0)
&& PlayConditions.canSpot(game, 7, Filters.type(CardType.COMPANION))
&& PlayConditions.canCardAssignToSkirmish(self, game, self)) {
ActivateCardAction action = new ActivateCardAction(self);
final ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(
new PreventableEffect(action,
new AssignmentEffect(playerId, Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.RING_BEARER)), self),
game.getGameState().getCurrentPlayerId(),
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.type(CardType.COMPANION), Filters.not(Filters.keyword(Keyword.RING_BEARER)))));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String fpPlayerId) {
return new ChooseAndDiscardCardsFromPlayEffect(subAction, playerId, 1, 1, Filters.type(CardType.COMPANION), Filters.not(Filters.keyword(Keyword.RING_BEARER)));
}
}
));
return Collections.singletonList(action);
}
return null;

View File

@@ -9,9 +9,11 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.AddTwilightEffect;
import com.gempukku.lotro.logic.effects.AssignmentEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
@@ -36,7 +38,7 @@ public class Card4_258 extends AbstractMinion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.ASSIGNMENT, self, 0)
&& PlayConditions.canExert(self, game, Filters.sameCard(self))
&& PlayConditions.canSpot(game, 5, Filters.type(CardType.COMPANION))) {
@@ -47,7 +49,13 @@ public class Card4_258 extends AbstractMinion {
new PreventableEffect(action,
new AssignmentEffect(playerId, Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.RING_BEARER)), self),
game.getGameState().getCurrentPlayerId(),
new AddTwilightEffect(self, 4)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new AddTwilightEffect(self, 4);
}
}
));
return Collections.singletonList(action);
}
return null;

View File

@@ -11,8 +11,10 @@ import com.gempukku.lotro.common.Side;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.AssignmentEffect;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.Effect;
/**
* Set: The Two Towers
@@ -39,7 +41,13 @@ public class Card4_259 extends AbstractOldEvent {
new PreventableEffect(action,
new AssignmentEffect(playerId, Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.RING_BEARER)), card),
game.getGameState().getCurrentPlayerId(),
new AddBurdenEffect(self, 1)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new AddBurdenEffect(self, 1);
}
}
));
}
});
return action;

View File

@@ -14,8 +14,10 @@ import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
@@ -60,7 +62,13 @@ public class Card4_300 extends AbstractAttachable {
new PreventableEffect(action,
new CancelSkirmishEffect(Filters.hasAttached(self)),
GameUtils.getOpponents(game, playerId),
new RemoveTwilightEffect(1)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new RemoveTwilightEffect(1);
}
}
));
return Collections.singletonList(action);
}
return null;

View File

@@ -10,8 +10,10 @@ import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
@@ -44,7 +46,13 @@ public class Card4_310 extends AbstractCompanion {
new PreventableEffect(action,
new DiscardCardsFromPlayEffect(self, self),
GameUtils.getOpponents(game, playerId),
new RemoveTwilightEffect(2)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new RemoveTwilightEffect(2);
}
}
));
return Collections.singletonList(action);
}
return null;

View File

@@ -13,8 +13,10 @@ import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
@@ -46,7 +48,13 @@ public class Card4_314 extends AbstractCompanion {
new PreventableEffect(action,
new DiscardCardsFromPlayEffect(self, self),
GameUtils.getOpponents(game, playerId),
new RemoveTwilightEffect(2)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new RemoveTwilightEffect(2);
}
}
));
return Collections.singletonList(action);
}
return null;

View File

@@ -11,7 +11,9 @@ import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Side;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.DrawCardEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
/**
@@ -52,7 +54,13 @@ public class Card5_003 extends AbstractEvent {
return "Shuffle hand into draw deck and draw 8 cards";
}
}, game.getGameState().getCurrentPlayerId(),
new ChooseAndDiscardCardsFromHandEffect(action, game.getGameState().getCurrentPlayerId(), false, 3)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromHandEffect(subAction, playerId, false, 3);
}
}
));
return action;
}
}

View File

@@ -11,6 +11,8 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.timing.Effect;
/**
* Set: Battle of Helm's Deep
@@ -46,10 +48,15 @@ public class Card5_020 extends AbstractEvent {
return "Discard up to 2 shadow possessions";
}
}, GameUtils.getOpponents(game, playerId),
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, CardType.MINION) {
new PreventableEffect.PreventionCost() {
@Override
public String getText(LotroGame game) {
return "Discard a minion";
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromPlayEffect(subAction, playerId, 1, 1, CardType.MINION) {
@Override
public String getText(LotroGame game) {
return "Discard a minion";
}
};
}
}
));

View File

@@ -14,6 +14,8 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.timing.Effect;
/**
* Set: Battle of Helm's Deep
@@ -47,7 +49,13 @@ public class Card5_021 extends AbstractEvent {
return "Discard a minion";
}
}, GameUtils.getOpponents(game, playerId),
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, 2, CardType.MINION)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndExertCharactersEffect(subAction, playerId, 1, 1, 2, CardType.MINION);
}
}
));
return action;
}
}

View File

@@ -11,8 +11,10 @@ import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
@@ -47,12 +49,18 @@ public class Card5_089 extends AbstractAttachableFPPossession {
new PreventableEffect(action,
new CancelSkirmishEffect(self.getAttachedTo()),
GameUtils.getOpponents(game, playerId),
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, CardType.MINION, Filters.inSkirmish) {
new PreventableEffect.PreventionCost() {
@Override
public String getText(LotroGame game) {
return "Exert minion in skirmish";
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndExertCharactersEffect(subAction, playerId, 1, 1, CardType.MINION, Filters.inSkirmish) {
@Override
public String getText(LotroGame game) {
return "Exert minion in skirmish";
}
};
}
}));
}
));
return Collections.singletonList(action);
}
return null;

View File

@@ -14,9 +14,11 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.DrawCardEffect;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
@@ -46,7 +48,7 @@ public class Card5_100 extends AbstractMinion {
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.SHADOW, self, 0)
&& PlayConditions.canSelfExert(self, 2, game)
&& PlayConditions.canSpot(game, Culture.SAURON, Race.ORC, Filters.not(self))) {
@@ -59,7 +61,13 @@ public class Card5_100 extends AbstractMinion {
new PreventableEffect(action,
new DrawCardEffect(playerId, 3),
game.getGameState().getCurrentPlayerId(),
new AddBurdenEffect(self, 2)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new AddBurdenEffect(self, 2);
}
}
));
return Collections.singletonList(action);
}
return null;

View File

@@ -11,6 +11,8 @@ import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
@@ -34,20 +36,26 @@ public class Card6_004 extends AbstractMinion {
}
@Override
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, final LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (PlayConditions.played(game, effectResult, self)
&& PlayConditions.canSpot(game, 2, Culture.DUNLAND, Race.MAN, Filters.not(self))) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
final OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new PreventableEffect(action,
new TakeControlOfASiteEffect(self, playerId),
game.getGameState().getCurrentPlayerId(),
new ChooseAndDiscardCardsFromHandEffect(action, game.getGameState().getCurrentPlayerId(), false, 2) {
new PreventableEffect.PreventionCost() {
@Override
public String getText(LotroGame game) {
return "Discard 2 cards from hand";
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new ChooseAndDiscardCardsFromHandEffect(subAction, playerId, false, 2) {
@Override
public String getText(LotroGame game) {
return "Discard 2 cards from hand";
}
};
}
}));
}
));
return Collections.singletonList(action);
}
return null;

View File

@@ -9,7 +9,9 @@ import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.AddTwilightEffect;
import com.gempukku.lotro.logic.timing.Effect;
/**
* Set: Ents of Fangorn
@@ -32,7 +34,7 @@ public class Card6_082 extends AbstractEvent {
}
@Override
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, final PhysicalCard self, int twilightModifier) {
PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new PreventableEffect(action,
@@ -43,7 +45,13 @@ public class Card6_082 extends AbstractEvent {
}
},
game.getGameState().getCurrentPlayerId(),
new AddTwilightEffect(self, 4)));
new PreventableEffect.PreventionCost() {
@Override
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
return new AddTwilightEffect(self, 4);
}
}
));
return action;
}
}

View File

@@ -1,108 +0,0 @@
package com.gempukku.lotro.logic.actions;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.decisions.MultipleChoiceAwaitingDecision;
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Iterator;
import java.util.LinkedList;
public class PreventSubAction implements Action {
private Action _action;
private Effect _effectToExecute;
private Iterator<String> _choicePlayers;
private Effect _preventionCost;
private LinkedList<Effect> _effectQueue = new LinkedList<Effect>();
public PreventSubAction(Action action, Effect effectToExecute, Iterator<String> choicePlayers, Effect preventionCost) {
_action = action;
_effectToExecute = effectToExecute;
_choicePlayers = choicePlayers;
_preventionCost = preventionCost;
_effectQueue.add(new DecideIfPossible());
}
@Override
public PhysicalCard getActionSource() {
return _action.getActionSource();
}
@Override
public PhysicalCard getActionAttachedToCard() {
return _action.getActionAttachedToCard();
}
@Override
public Phase getActionTimeword() {
return _action.getActionTimeword();
}
@Override
public void setActionTimeword(Phase phase) {
_action.setActionTimeword(phase);
}
@Override
public String getPerformingPlayer() {
return _action.getPerformingPlayer();
}
@Override
public void setPerformingPlayer(String playerId) {
_action.setPerformingPlayer(playerId);
}
@Override
public String getText(LotroGame game) {
return null;
}
@Override
public Effect nextEffect(LotroGame game) {
return _effectQueue.poll();
}
private class DecideIfPossible extends UnrespondableEffect {
@Override
protected void doPlayEffect(LotroGame game) {
if (_preventionCost.isPlayableInFull(game) && _choicePlayers.hasNext()) {
_effectQueue.add(
new PlayoutDecisionEffect(game.getUserFeedback(), _choicePlayers.next(),
new MultipleChoiceAwaitingDecision(1, "Would you like to - " + _preventionCost.getText(game) + " to prevent - " + _effectToExecute.getText(game), new String[]{"Yes", "No"}) {
@Override
protected void validDecisionMade(int index, String result) {
if (result.equals("Yes")) {
startPrevention();
} else {
_effectQueue.add(new DecideIfPossible());
}
}
}));
} else {
_effectQueue.add(_effectToExecute);
}
}
}
private void startPrevention() {
_preventionCost.reset();
_effectQueue.add(_preventionCost);
_effectQueue.add(new CheckIfPreventingCostWasSuccessful());
}
private class CheckIfPreventingCostWasSuccessful extends UnrespondableEffect {
@Override
protected void doPlayEffect(LotroGame game) {
if (!_preventionCost.wasCarriedOut())
_effectQueue.add(new DecideIfPossible());
}
}
}

View File

@@ -5,20 +5,20 @@ import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collection;
public class ChooseAndWoundCharactersEffect extends ChooseActiveCardsEffect {
private CostToEffectAction _action;
private Action _action;
private int _count;
public ChooseAndWoundCharactersEffect(CostToEffectAction action, String playerId, int minimum, int maximum, Filterable... filters) {
public ChooseAndWoundCharactersEffect(Action action, String playerId, int minimum, int maximum, Filterable... filters) {
this(action, playerId, minimum, maximum, 1, filters);
}
public ChooseAndWoundCharactersEffect(CostToEffectAction action, String playerId, int minimum, int maximum, int count, Filterable... filters) {
public ChooseAndWoundCharactersEffect(Action action, String playerId, int minimum, int maximum, int count, Filterable... filters) {
super(action.getActionSource(), playerId, "Choose characters to wound", minimum, maximum, filters);
_action = action;
_count = count;

View File

@@ -37,12 +37,6 @@ public abstract class AbstractEffect implements Effect {
return _successful;
}
@Override
public void reset() {
_carriedOut = null;
_successful = null;
}
protected final String getAppendedTextNames(Collection<PhysicalCard> cards) {
StringBuilder sb = new StringBuilder();
for (PhysicalCard card : cards)

View File

@@ -43,9 +43,4 @@ public abstract class AbstractSuccessfulEffect implements Effect {
else
return sb.substring(0, sb.length() - 2);
}
@Override
public void reset() {
}
}

View File

@@ -62,10 +62,4 @@ public interface Effect {
* @return
*/
public boolean wasCarriedOut();
/**
* Resets the history and any state this effect might have, to be able to be
* played again (for example multiple players trying to prevent the same effect.
*/
public void reset();
}