That should be enough for now...
This commit is contained in:
@@ -3,14 +3,16 @@ package com.gempukku.lotro.cards.effects;
|
||||
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.timing.AbstractEffect;
|
||||
import com.gempukku.lotro.logic.timing.AbstractSubActionEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ChoiceEffect extends AbstractEffect {
|
||||
public class ChoiceEffect extends AbstractSubActionEffect {
|
||||
private Action _action;
|
||||
private String _choicePlayerId;
|
||||
private List<Effect> _possibleEffects;
|
||||
@@ -41,7 +43,7 @@ public class ChoiceEffect extends AbstractEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(final LotroGame game) {
|
||||
public Collection<? extends EffectResult> playEffect(final LotroGame game) {
|
||||
final List<Effect> possibleEffects = new LinkedList<Effect>();
|
||||
for (Effect effect : _possibleEffects) {
|
||||
if (effect.isPlayableInFull(game))
|
||||
@@ -51,20 +53,19 @@ public class ChoiceEffect extends AbstractEffect {
|
||||
if (possibleEffects.size() == 1) {
|
||||
SubAction subAction = new SubAction(_action);
|
||||
subAction.appendEffect(possibleEffects.get(0));
|
||||
game.getActionsEnvironment().addActionToStack(subAction);
|
||||
} else {
|
||||
processSubAction(game, subAction);
|
||||
} else if (possibleEffects.size() > 0) {
|
||||
game.getUserFeedback().sendAwaitingDecision(_choicePlayerId,
|
||||
new MultipleChoiceAwaitingDecision(1, "Choose effect to use", getEffectsText(possibleEffects, game)) {
|
||||
@Override
|
||||
protected void validDecisionMade(int index, String result) {
|
||||
SubAction subAction = new SubAction(_action);
|
||||
subAction.appendEffect(possibleEffects.get(index));
|
||||
game.getActionsEnvironment().addActionToStack(subAction);
|
||||
processSubAction(game, subAction);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return new FullEffectResult(null, possibleEffects.size() > 0, possibleEffects.size() > 0);
|
||||
return null;
|
||||
}
|
||||
|
||||
private String[] getEffectsText(List<Effect> possibleEffects, LotroGame game) {
|
||||
|
||||
@@ -6,14 +6,14 @@ 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.AbstractEffect;
|
||||
import com.gempukku.lotro.logic.timing.AbstractSubActionEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class ExhaustCharacterEffect extends AbstractEffect {
|
||||
public class ExhaustCharacterEffect extends AbstractSubActionEffect {
|
||||
private PhysicalCard _source;
|
||||
private Action _action;
|
||||
private Filterable[] _filters;
|
||||
@@ -35,7 +35,7 @@ public class ExhaustCharacterEffect extends AbstractEffect {
|
||||
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Exhaust " + getAppendedNames(Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), _filters));
|
||||
return "Exhaust " + GameUtils.getAppendedNames(Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), _filters));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,15 +44,15 @@ public class ExhaustCharacterEffect extends AbstractEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
public Collection<? extends EffectResult> playEffect(LotroGame game) {
|
||||
SubAction subAction = new SubAction(_action);
|
||||
subAction.appendEffect(new InfiniteExertionEffect(_source, subAction, _filters));
|
||||
game.getActionsEnvironment().addActionToStack(subAction);
|
||||
processSubAction(game, subAction);
|
||||
final Collection<PhysicalCard> cards = Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), _filters);
|
||||
if (cards.size() > 0)
|
||||
game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " exhausts " + getAppendedNames(cards));
|
||||
game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " exhausts " + GameUtils.getAppendedNames(cards));
|
||||
|
||||
return new FullEffectResult(null, false, false);
|
||||
return null;
|
||||
}
|
||||
|
||||
private class InfiniteExertionEffect extends ExertCharactersEffect {
|
||||
|
||||
@@ -4,15 +4,13 @@ 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.SubAction;
|
||||
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||
import com.gempukku.lotro.logic.timing.AbstractSubActionEffect;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class PreventableEffect extends AbstractEffect {
|
||||
public class PreventableEffect extends AbstractSubActionEffect {
|
||||
private CostToEffectAction _action;
|
||||
private Effect _effectToExecute;
|
||||
private Iterator<String> _choicePlayers;
|
||||
@@ -49,9 +47,10 @@ public class PreventableEffect extends AbstractEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
game.getActionsEnvironment().addActionToStack(new PreventSubAction(_action, _effectToExecute, _choicePlayers, _preventionCost));
|
||||
return new FullEffectResult(null, true, true);
|
||||
public Collection<? extends EffectResult> playEffect(LotroGame game) {
|
||||
final PreventSubAction subAction = new PreventSubAction(_action, _effectToExecute, _choicePlayers, _preventionCost);
|
||||
processSubAction(game, subAction);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static interface PreventionCost {
|
||||
|
||||
@@ -7,15 +7,16 @@ import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.SubAction;
|
||||
import com.gempukku.lotro.logic.decisions.ArbitraryCardsSelectionDecision;
|
||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||
import com.gempukku.lotro.logic.timing.AbstractSubActionEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class RevealAndChooseCardsFromOpponentHandEffect extends AbstractEffect {
|
||||
public abstract class RevealAndChooseCardsFromOpponentHandEffect extends AbstractSubActionEffect {
|
||||
private Action _action;
|
||||
private String _playerId;
|
||||
private String _opponentId;
|
||||
@@ -43,14 +44,14 @@ public abstract class RevealAndChooseCardsFromOpponentHandEffect extends Abstrac
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
public Collection<? extends EffectResult> playEffect(LotroGame game) {
|
||||
if (game.getModifiersQuerying().canLookOrRevealCardsInHand(game.getGameState(), _opponentId)) {
|
||||
List<PhysicalCard> opponentHand = new LinkedList<PhysicalCard>(game.getGameState().getHand(_opponentId));
|
||||
|
||||
SubAction subAction = new SubAction(_action);
|
||||
subAction.appendEffect(
|
||||
new RevealCardsFromHandEffect(_source, _opponentId, opponentHand));
|
||||
game.getActionsEnvironment().addActionToStack(subAction);
|
||||
processSubAction(game, subAction);
|
||||
|
||||
Collection<PhysicalCard> selectable = Filters.filter(opponentHand, game.getGameState(), game.getModifiersQuerying(), _selectionFilter);
|
||||
|
||||
@@ -62,9 +63,8 @@ public abstract class RevealAndChooseCardsFromOpponentHandEffect extends Abstrac
|
||||
cardsSelected(selectedCards);
|
||||
}
|
||||
});
|
||||
return new FullEffectResult(null, true, true);
|
||||
}
|
||||
return new FullEffectResult(null, false, false);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.gempukku.lotro.cards.effects.choose;
|
||||
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
|
||||
import com.gempukku.lotro.common.Filterable;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
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.effects.ChooseActiveCardEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
|
||||
import com.gempukku.lotro.logic.modifiers.evaluator.ConstantEvaluator;
|
||||
@@ -30,10 +28,10 @@ public class ChooseAndAddUntilEOPStrengthBonusEffect extends ChooseActiveCardEff
|
||||
|
||||
@Override
|
||||
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
||||
SubAction action = new SubAction(_action);
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new StrengthModifier(_source, Filters.sameCard(card), null, _bonusEvaluator.evaluateExpression(game.getGameState(), game.getModifiersQuerying(), card)), game.getGameState().getCurrentPhase()));
|
||||
game.getActionsEnvironment().addActionToStack(action);
|
||||
final int bonus = _bonusEvaluator.evaluateExpression(game.getGameState(), game.getModifiersQuerying(), card);
|
||||
final StrengthModifier modifier = new StrengthModifier(_source, card, null, bonus);
|
||||
final Phase phase = game.getGameState().getCurrentPhase();
|
||||
|
||||
game.getModifiersEnvironment().addUntilEndOfPhaseModifier(modifier, phase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,16 +7,19 @@ import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.decisions.ArbitraryCardsSelectionDecision;
|
||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ChooseAndPlayCardFromDeadPileEffect extends AbstractEffect {
|
||||
public class ChooseAndPlayCardFromDeadPileEffect implements Effect {
|
||||
private String _playerId;
|
||||
private Filter _filter;
|
||||
private int _twilightModifier;
|
||||
private Action _playCardAction;
|
||||
|
||||
public ChooseAndPlayCardFromDeadPileEffect(String playerId, List<? extends PhysicalCard> cardsInDeadPileAtStart, Filterable... filter) {
|
||||
this(playerId, cardsInDeadPileAtStart, 0, filter);
|
||||
@@ -44,8 +47,12 @@ public class ChooseAndPlayCardFromDeadPileEffect extends AbstractEffect {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Collection<PhysicalCard> getPlayableInDeadPile(LotroGame game) {
|
||||
return Filters.filter(game.getGameState().getDiscard(_playerId), game.getGameState(), game.getModifiersQuerying(), _filter, Filters.playable(game, _twilightModifier));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(final LotroGame game) {
|
||||
public Collection<? extends EffectResult> playEffect(final LotroGame game) {
|
||||
Collection<PhysicalCard> deadPile = getPlayableInDeadPile(game);
|
||||
if (deadPile.size() > 0) {
|
||||
game.getUserFeedback().sendAwaitingDecision(_playerId,
|
||||
@@ -55,16 +62,22 @@ public class ChooseAndPlayCardFromDeadPileEffect extends AbstractEffect {
|
||||
List<PhysicalCard> selectedCards = getSelectedCardsByResponse(result);
|
||||
if (selectedCards.size() > 0) {
|
||||
PhysicalCard selectedCard = selectedCards.get(0);
|
||||
game.getActionsEnvironment().addActionToStack(selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier));
|
||||
_playCardAction = selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier);
|
||||
game.getActionsEnvironment().addActionToStack(_playCardAction);
|
||||
}
|
||||
}
|
||||
});
|
||||
return new FullEffectResult(null, true, true);
|
||||
}
|
||||
return new FullEffectResult(null, false, false);
|
||||
return null;
|
||||
}
|
||||
|
||||
private Collection<PhysicalCard> getPlayableInDeadPile(LotroGame game) {
|
||||
return Filters.filter(game.getGameState().getDiscard(_playerId), game.getGameState(), game.getModifiersQuerying(), _filter, Filters.playable(game, _twilightModifier));
|
||||
@Override
|
||||
public boolean wasSuccessful() {
|
||||
return _playCardAction != null && _playCardAction.wasSuccessful();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wasCarriedOut() {
|
||||
return _playCardAction != null && _playCardAction.wasCarriedOut();
|
||||
}
|
||||
}
|
||||
@@ -6,17 +6,19 @@ import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.decisions.ArbitraryCardsSelectionDecision;
|
||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ChooseAndPlayCardFromDeckEffect extends AbstractEffect {
|
||||
public class ChooseAndPlayCardFromDeckEffect implements Effect {
|
||||
private String _playerId;
|
||||
private Filterable[] _filter;
|
||||
private int _twilightModifier;
|
||||
private Action _playCardAction;
|
||||
|
||||
public ChooseAndPlayCardFromDeckEffect(String playerId, Filterable... filter) {
|
||||
this(playerId, 0, filter);
|
||||
@@ -44,7 +46,7 @@ public class ChooseAndPlayCardFromDeckEffect extends AbstractEffect {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(final LotroGame game) {
|
||||
public Collection<? extends EffectResult> playEffect(final LotroGame game) {
|
||||
Collection<PhysicalCard> deck = Filters.filter(game.getGameState().getDeck(_playerId), game.getGameState(), game.getModifiersQuerying(), Filters.and(_filter, Filters.playable(game, _twilightModifier)));
|
||||
game.getUserFeedback().sendAwaitingDecision(_playerId,
|
||||
new ArbitraryCardsSelectionDecision(1, "Choose a card to play", new LinkedList<PhysicalCard>(deck), 0, 1) {
|
||||
@@ -53,10 +55,21 @@ public class ChooseAndPlayCardFromDeckEffect extends AbstractEffect {
|
||||
List<PhysicalCard> selectedCards = getSelectedCardsByResponse(result);
|
||||
if (selectedCards.size() > 0) {
|
||||
PhysicalCard selectedCard = selectedCards.get(0);
|
||||
game.getActionsEnvironment().addActionToStack(selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier));
|
||||
_playCardAction = selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier);
|
||||
game.getActionsEnvironment().addActionToStack(_playCardAction);
|
||||
}
|
||||
}
|
||||
});
|
||||
return new FullEffectResult(null, true, true);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wasSuccessful() {
|
||||
return _playCardAction != null && _playCardAction.wasSuccessful();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wasCarriedOut() {
|
||||
return _playCardAction != null && _playCardAction.wasCarriedOut();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,17 +7,19 @@ import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.decisions.ArbitraryCardsSelectionDecision;
|
||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ChooseAndPlayCardFromDiscardEffect extends AbstractEffect {
|
||||
public class ChooseAndPlayCardFromDiscardEffect implements Effect {
|
||||
private String _playerId;
|
||||
private Filter _filter;
|
||||
private int _twilightModifier;
|
||||
private Action _playCardAction;
|
||||
|
||||
public ChooseAndPlayCardFromDiscardEffect(String playerId, List<? extends PhysicalCard> cardsInDiscardAtStart, Filterable... filter) {
|
||||
this(playerId, cardsInDiscardAtStart, 0, filter);
|
||||
@@ -45,8 +47,12 @@ public class ChooseAndPlayCardFromDiscardEffect extends AbstractEffect {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Collection<PhysicalCard> getPlayableInDiscard(LotroGame game) {
|
||||
return Filters.filter(game.getGameState().getDiscard(_playerId), game.getGameState(), game.getModifiersQuerying(), _filter, Filters.playable(game, _twilightModifier));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(final LotroGame game) {
|
||||
public Collection<? extends EffectResult> playEffect(final LotroGame game) {
|
||||
Collection<PhysicalCard> discard = getPlayableInDiscard(game);
|
||||
if (discard.size() > 0) {
|
||||
game.getUserFeedback().sendAwaitingDecision(_playerId,
|
||||
@@ -56,16 +62,22 @@ public class ChooseAndPlayCardFromDiscardEffect extends AbstractEffect {
|
||||
List<PhysicalCard> selectedCards = getSelectedCardsByResponse(result);
|
||||
if (selectedCards.size() > 0) {
|
||||
PhysicalCard selectedCard = selectedCards.get(0);
|
||||
game.getActionsEnvironment().addActionToStack(selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier));
|
||||
_playCardAction = selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier);
|
||||
game.getActionsEnvironment().addActionToStack(_playCardAction);
|
||||
}
|
||||
}
|
||||
});
|
||||
return new FullEffectResult(null, true, true);
|
||||
}
|
||||
return new FullEffectResult(null, false, false);
|
||||
return null;
|
||||
}
|
||||
|
||||
private Collection<PhysicalCard> getPlayableInDiscard(LotroGame game) {
|
||||
return Filters.filter(game.getGameState().getDiscard(_playerId), game.getGameState(), game.getModifiersQuerying(), _filter, Filters.playable(game, _twilightModifier));
|
||||
@Override
|
||||
public boolean wasSuccessful() {
|
||||
return _playCardAction != null && _playCardAction.wasSuccessful();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wasCarriedOut() {
|
||||
return _playCardAction != null && _playCardAction.wasCarriedOut();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,17 +7,19 @@ import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.decisions.CardsSelectionDecision;
|
||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ChooseAndPlayCardFromHandEffect extends AbstractEffect {
|
||||
public class ChooseAndPlayCardFromHandEffect implements Effect {
|
||||
private String _playerId;
|
||||
private Filter _filter;
|
||||
private int _twilightModifier;
|
||||
private Action _playCardAction;
|
||||
|
||||
public ChooseAndPlayCardFromHandEffect(String playerId, List<? extends PhysicalCard> cardsInHandAtStart, Filterable... filter) {
|
||||
this(playerId, cardsInHandAtStart, 0, filter);
|
||||
@@ -49,8 +51,11 @@ public class ChooseAndPlayCardFromHandEffect extends AbstractEffect {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void cardChosenCallback(PhysicalCard cardChosenToPlay) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(final LotroGame game) {
|
||||
public Collection<? extends EffectResult> playEffect(final LotroGame game) {
|
||||
Collection<PhysicalCard> playableInHand = getPlayableInHandCards(game);
|
||||
if (playableInHand.size() > 0) {
|
||||
game.getUserFeedback().sendAwaitingDecision(_playerId,
|
||||
@@ -58,15 +63,22 @@ public class ChooseAndPlayCardFromHandEffect extends AbstractEffect {
|
||||
@Override
|
||||
public void decisionMade(String result) throws DecisionResultInvalidException {
|
||||
final PhysicalCard selectedCard = getSelectedCardsByResponse(result).iterator().next();
|
||||
game.getActionsEnvironment().addActionToStack(selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier));
|
||||
_playCardAction = selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier);
|
||||
game.getActionsEnvironment().addActionToStack(_playCardAction);
|
||||
cardChosenCallback(selectedCard);
|
||||
}
|
||||
});
|
||||
return new FullEffectResult(null, true, true);
|
||||
}
|
||||
return new FullEffectResult(null, false, false);
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void cardChosenCallback(PhysicalCard cardChosenToPlay) {
|
||||
@Override
|
||||
public boolean wasSuccessful() {
|
||||
return _playCardAction != null && _playCardAction.wasSuccessful();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wasCarriedOut() {
|
||||
return _playCardAction != null && _playCardAction.wasCarriedOut();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.ChoiceEffect;
|
||||
import com.gempukku.lotro.cards.effects.StackCardFromHandEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseArbitraryCardsEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseCardsFromHandEffect;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
@@ -42,15 +43,11 @@ public class Card1_073 extends AbstractPermanent {
|
||||
|
||||
List<Effect> possibleChoices = new LinkedList<Effect>();
|
||||
possibleChoices.add(
|
||||
new ChooseArbitraryCardsEffect(playerId, "Choose Free Peoples artifact or possession", game.getGameState().getHand(playerId), Filters.and(Filters.side(Side.FREE_PEOPLE), Filters.or(Filters.type(CardType.ARTIFACT), Filters.type(CardType.POSSESSION))), 1, 1) {
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Stack a Free Peoples artifact or possession";
|
||||
}
|
||||
|
||||
new ChooseCardsFromHandEffect(playerId, 1, 1, Side.FREE_PEOPLE, Filters.or(CardType.ARTIFACT, CardType.POSSESSION)) {
|
||||
@Override
|
||||
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
|
||||
action.appendEffect(new StackCardFromHandEffect(selectedCards.iterator().next(), self));
|
||||
for (PhysicalCard card : selectedCards)
|
||||
action.appendEffect(new StackCardFromHandEffect(card, self));
|
||||
}
|
||||
});
|
||||
possibleChoices.add(
|
||||
|
||||
@@ -38,4 +38,26 @@ public class GameUtils {
|
||||
public static String getCardLink(PhysicalCard card) {
|
||||
return "<div class='cardHint' value='" + card.getBlueprintId() + "'>" + card.getBlueprint().getName() + "</div>";
|
||||
}
|
||||
|
||||
public static String getAppendedTextNames(Collection<PhysicalCard> cards) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (PhysicalCard card : cards)
|
||||
sb.append(card.getBlueprint().getName() + ", ");
|
||||
|
||||
if (sb.length() == 0)
|
||||
return "none";
|
||||
else
|
||||
return sb.substring(0, sb.length() - 2);
|
||||
}
|
||||
|
||||
public static final String getAppendedNames(Collection<PhysicalCard> cards) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (PhysicalCard card : cards)
|
||||
sb.append(GameUtils.getCardLink(card) + ", ");
|
||||
|
||||
if (sb.length() == 0)
|
||||
return "none";
|
||||
else
|
||||
return sb.substring(0, sb.length() - 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,25 +38,11 @@ public abstract class AbstractEffect implements Effect {
|
||||
}
|
||||
|
||||
protected final String getAppendedTextNames(Collection<PhysicalCard> cards) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (PhysicalCard card : cards)
|
||||
sb.append(card.getBlueprint().getName() + ", ");
|
||||
|
||||
if (sb.length() == 0)
|
||||
return "none";
|
||||
else
|
||||
return sb.substring(0, sb.length() - 2);
|
||||
return GameUtils.getAppendedTextNames(cards);
|
||||
}
|
||||
|
||||
protected final String getAppendedNames(Collection<PhysicalCard> cards) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (PhysicalCard card : cards)
|
||||
sb.append(GameUtils.getCardLink(card) + ", ");
|
||||
|
||||
if (sb.length() == 0)
|
||||
return "none";
|
||||
else
|
||||
return sb.substring(0, sb.length() - 2);
|
||||
return GameUtils.getAppendedNames(cards);
|
||||
}
|
||||
|
||||
protected static class FullEffectResult {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.gempukku.lotro.logic.timing;
|
||||
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.SubAction;
|
||||
|
||||
public abstract class AbstractSubActionEffect implements Effect {
|
||||
private SubAction _subAction;
|
||||
|
||||
protected void processSubAction(LotroGame game, SubAction subAction) {
|
||||
_subAction = subAction;
|
||||
game.getActionsEnvironment().addActionToStack(_subAction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wasSuccessful() {
|
||||
return _subAction != null && _subAction.wasSuccessful();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wasCarriedOut() {
|
||||
return _subAction != null && _subAction.wasCarriedOut();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user