From 4e9628c3d1a130000a4cdaa4d626c81e54ad79b0 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Mon, 7 Nov 2011 10:39:01 +0000 Subject: [PATCH] "His Golden Shield" --- ...andomCardFromHandOnBottomOfDeckEffect.java | 49 +++++++++++++++ .../lotro/cards/set7/rohan/Card7_237.java | 62 +++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutRandomCardFromHandOnBottomOfDeckEffect.java create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set7/rohan/Card7_237.java diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutRandomCardFromHandOnBottomOfDeckEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutRandomCardFromHandOnBottomOfDeckEffect.java new file mode 100644 index 000000000..b83df69be --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutRandomCardFromHandOnBottomOfDeckEffect.java @@ -0,0 +1,49 @@ +package com.gempukku.lotro.cards.effects; + +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.GameUtils; +import com.gempukku.lotro.logic.timing.AbstractEffect; + +import java.util.Collections; +import java.util.List; + +public class PutRandomCardFromHandOnBottomOfDeckEffect extends AbstractEffect { + private String _playerId; + + public PutRandomCardFromHandOnBottomOfDeckEffect(String playerId) { + _playerId = playerId; + } + + @Override + public boolean isPlayableInFull(LotroGame game) { + return game.getGameState().getHand(_playerId).size() > 0; + } + + @Override + public String getText(LotroGame game) { + return "Put random card from hand on bottom of deck"; + } + + @Override + public Type getType() { + return null; + } + + @Override + protected FullEffectResult playEffectReturningResult(LotroGame game) { + if (isPlayableInFull(game)) { + GameState gameState = game.getGameState(); + final List randomCards = GameUtils.getRandomCards(gameState.getHand(_playerId), 1); + for (PhysicalCard randomCard : randomCards) { + gameState.sendMessage(randomCard.getOwner() + " puts a card at random from hand on bottom of his or her deck"); + gameState.removeCardsFromZone(randomCard.getOwner(), Collections.singleton(randomCard)); + gameState.putCardOnBottomOfDeck(randomCard); + } + + return new FullEffectResult(null, true, true); + } + return new FullEffectResult(null, false, false); + } +} diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set7/rohan/Card7_237.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set7/rohan/Card7_237.java new file mode 100644 index 000000000..716c425cc --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set7/rohan/Card7_237.java @@ -0,0 +1,62 @@ +package com.gempukku.lotro.cards.set7.rohan; + +import com.gempukku.lotro.cards.AbstractEvent; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.actions.PlayEventAction; +import com.gempukku.lotro.cards.effects.ChoiceEffect; +import com.gempukku.lotro.cards.effects.PutRandomCardFromHandOnBottomOfDeckEffect; +import com.gempukku.lotro.cards.effects.RemoveTwilightEffect; +import com.gempukku.lotro.cards.effects.choose.ChooseOpponentEffect; +import com.gempukku.lotro.common.Culture; +import com.gempukku.lotro.common.Phase; +import com.gempukku.lotro.common.Race; +import com.gempukku.lotro.common.Side; +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.timing.Effect; + +import java.util.LinkedList; +import java.util.List; + +/** + * Set: The Return of the King + * Side: Free + * Culture: Rohan + * Twilight Cost: 0 + * Type: Event • Regroup + * Game Text: Spot 3 [ROHAN] Men to make an opponent remove (1) or place a random card from hand beneath his or her draw + * deck. Do this once for each card in that player's hand when you play this event. + */ +public class Card7_237 extends AbstractEvent { + public Card7_237() { + super(Side.FREE_PEOPLE, 0, Culture.ROHAN, "His Golden Shield", Phase.REGROUP); + } + + @Override + public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) { + return super.checkPlayRequirements(playerId, game, self, twilightModifier) + && PlayConditions.canSpot(game, 3, Culture.ROHAN, Race.MAN); + } + + @Override + public PlayEventAction getPlayCardAction(String playerId, final LotroGame game, PhysicalCard self, int twilightModifier) { + final PlayEventAction action = new PlayEventAction(self); + action.appendEffect( + new ChooseOpponentEffect(playerId) { + @Override + protected void opponentChosen(String opponentId) { + int cardCount = game.getGameState().getHand(opponentId).size(); + for (int i = 0; i < cardCount; i++) { + List possibleEffects = new LinkedList(); + possibleEffects.add( + new RemoveTwilightEffect(1)); + possibleEffects.add( + new PutRandomCardFromHandOnBottomOfDeckEffect(opponentId)); + action.appendEffect( + new ChoiceEffect(action, opponentId, possibleEffects)); + } + } + }); + return action; + } +}