diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/actions/PlayEventAction.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/actions/PlayEventAction.java index d5a05f6ec..ca825f197 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/actions/PlayEventAction.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/actions/PlayEventAction.java @@ -30,6 +30,8 @@ public class PlayEventAction extends AbstractCostToEffectAction { private boolean _cardDiscarded; + private boolean _skipDiscardCard; + public PlayEventAction(PhysicalCard card) { this(card, false); } @@ -56,6 +58,10 @@ public class PlayEventAction extends AbstractCostToEffectAction { return _requiresRanger; } + public void skipDiscardPart() { + _skipDiscardCard = true; + } + @Override public PhysicalCard getActionSource() { return _eventPlayed; @@ -93,7 +99,7 @@ public class PlayEventAction extends AbstractCostToEffectAction { } } - if (!_cardDiscarded) { + if (!_cardDiscarded && !_skipDiscardCard) { _cardDiscarded = true; final Zone targetZone = _playCardEffect.getTargetZone(); if (targetZone != null) diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set6/dwarven/Card6_011.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set6/dwarven/Card6_011.java index 5aec5e260..7fd2e2b47 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set6/dwarven/Card6_011.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set6/dwarven/Card6_011.java @@ -2,11 +2,32 @@ package com.gempukku.lotro.cards.set6.dwarven; import com.gempukku.lotro.cards.AbstractEvent; import com.gempukku.lotro.cards.actions.PlayEventAction; +import com.gempukku.lotro.cards.effects.ChoiceEffect; +import com.gempukku.lotro.cards.effects.PutCardFromHandOnBottomOfDeckEffect; +import com.gempukku.lotro.cards.effects.PutCardFromHandOnTopOfDeckEffect; +import com.gempukku.lotro.cards.effects.choose.ChooseCardsFromHandEffect; +import com.gempukku.lotro.cards.modifiers.StrengthModifier; +import com.gempukku.lotro.common.CardType; import com.gempukku.lotro.common.Culture; import com.gempukku.lotro.common.Phase; import com.gempukku.lotro.common.Side; +import com.gempukku.lotro.filters.Filters; 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.decisions.MultipleChoiceAwaitingDecision; +import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect; +import com.gempukku.lotro.logic.modifiers.Condition; +import com.gempukku.lotro.logic.modifiers.Modifier; +import com.gempukku.lotro.logic.modifiers.ModifiersQuerying; +import com.gempukku.lotro.logic.timing.AbstractSuccessfulEffect; +import com.gempukku.lotro.logic.timing.Effect; +import com.gempukku.lotro.logic.timing.EffectResult; + +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; /** * Set: Ents of Fangorn @@ -23,7 +44,103 @@ public class Card6_011 extends AbstractEvent { } @Override - public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) { - return null; + public List getStackedOnModifiers(LotroGame game, final PhysicalCard self) { + return Collections.singletonList( + new StrengthModifier(self, Filters.name("Gimli"), + new Condition() { + @Override + public boolean isFullfilled(GameState gameState, ModifiersQuerying modifiersQuerying) { + return Filters.and(Culture.DWARVEN, CardType.CONDITION).accepts(gameState, modifiersQuerying, self.getStackedOn()); + } + }, 1)); + } + + @Override + public PlayEventAction getPlayCardAction(final String playerId, LotroGame game, final PhysicalCard self, int twilightModifier) { + final PlayEventAction action = new PlayEventAction(self); + List possibleEffects = new LinkedList(); + possibleEffects.add( + new PlayoutDecisionEffect(game.getUserFeedback(), playerId, + new MultipleChoiceAwaitingDecision(1, "Where to put \"Toss Me\"?", new String[]{"Top of deck", "Bottom of deck"}) { + @Override + protected void validDecisionMade(int index, String result) { + action.skipDiscardPart(); + if (index == 0) + action.insertEffect( + new AbstractSuccessfulEffect() { + @Override + public String getText(LotroGame game) { + return null; + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + public EffectResult[] playEffect(LotroGame game) { + game.getGameState().putCardOnTopOfDeck(self); + return null; + } + }); + else + action.insertEffect( + new AbstractSuccessfulEffect() { + @Override + public String getText(LotroGame game) { + return null; + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + public EffectResult[] playEffect(LotroGame game) { + game.getGameState().putCardOnBottomOfDeck(self); + return null; + } + }); + } + }) { + @Override + public String getText(LotroGame game) { + return "Place played \"Toss Me\" on top or bottom of deck"; + } + }); + possibleEffects.add( + new ChooseCardsFromHandEffect(playerId, 1, 1, Culture.DWARVEN) { + @Override + public String getText(LotroGame game) { + return "Place other DWARVEN card from hand on top or bottom of deck"; + } + + @Override + protected void cardsSelected(LotroGame game, final Collection selectedCards) { + action.insertEffect( + new PlayoutDecisionEffect(game.getUserFeedback(), playerId, + new MultipleChoiceAwaitingDecision(1, "Where to put selected card?", new String[]{"Top of deck", "Bottom of deck"}) { + @Override + protected void validDecisionMade(int index, String result) { + + if (index == 0) + for (PhysicalCard selectedCard : selectedCards) + action.insertEffect( + new PutCardFromHandOnTopOfDeckEffect(selectedCard)); + else + for (PhysicalCard selectedCard : selectedCards) + action.insertEffect( + new PutCardFromHandOnBottomOfDeckEffect(selectedCard)); + } + }) + ); + } + }); + action.appendEffect( + new ChoiceEffect(action, playerId, possibleEffects)); + + return action; } }