"The Palantir of Orthanc"

This commit is contained in:
marcins78@gmail.com
2011-10-10 16:44:27 +00:00
parent 04bfa874ee
commit 21e777fefa
2 changed files with 111 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.common.Zone;
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.UnrespondableEffect;
public class PutCardFromDeckOnBottomOfDeckEffect extends UnrespondableEffect {
private PhysicalCard _source;
private PhysicalCard _physicalCard;
public PutCardFromDeckOnBottomOfDeckEffect(PhysicalCard source, PhysicalCard physicalCard) {
_physicalCard = physicalCard;
_source = source;
}
@Override
public boolean isPlayableInFull(LotroGame game) {
return _physicalCard.getZone() == Zone.DECK;
}
@Override
public void doPlayEffect(LotroGame game) {
if (isPlayableInFull(game)) {
GameState gameState = game.getGameState();
gameState.sendMessage(_physicalCard.getOwner() + " puts " + GameUtils.getCardLink(_physicalCard) + " from deck on the bottom of deck");
gameState.removeCardFromZone(_physicalCard);
gameState.putCardOnBottomOfDeck(_physicalCard);
}
}
}

View File

@@ -0,0 +1,78 @@
package com.gempukku.lotro.cards.set4.isengard;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.PutCardFromDeckOnBottomOfDeckEffect;
import com.gempukku.lotro.cards.effects.RemoveTwilightEffect;
import com.gempukku.lotro.cards.effects.RevealTopCardsOfDrawDeckEffect;
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.ActivateCardAction;
import com.gempukku.lotro.logic.decisions.MultipleChoiceAwaitingDecision;
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: The Two Towers
* Side: Shadow
* Culture: Isengard
* Twilight Cost: 0
* Type: Artifact
* Game Text: To play, spot an [ISENGARD] minion. Plays to your support area. Shadow: Spot an [ISENGARD] minion
* and remove (2) to reveal the top card of any draw deck. You may place that card beneath that draw deck.
*/
public class Card4_166 extends AbstractPermanent {
public Card4_166() {
super(Side.SHADOW, 0, CardType.ARTIFACT, Culture.ISENGARD, Zone.SUPPORT, "The Palantir of Orthanc", true);
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return super.checkPlayRequirements(playerId, game, self, twilightModifier)
&& PlayConditions.canSpot(game, Filters.culture(Culture.ISENGARD), Filters.type(CardType.MINION));
}
@Override
protected List<? extends Action> getExtraPhaseActions(final String playerId, final LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.SHADOW, self, 2)
&& PlayConditions.canSpot(game, Filters.culture(Culture.ISENGARD), Filters.type(CardType.MINION))) {
final ActivateCardAction action = new ActivateCardAction(self, Keyword.SHADOW);
action.appendCost(
new RemoveTwilightEffect(2));
action.appendEffect(
new PlayoutDecisionEffect(game.getUserFeedback(), playerId,
new MultipleChoiceAwaitingDecision(1, "Choose player to reveal top card", game.getGameState().getPlayerOrder().getAllPlayers().toArray(new String[0])) {
@Override
protected void validDecisionMade(int index, String deckId) {
action.insertEffect(
new RevealTopCardsOfDrawDeckEffect(deckId, 1) {
@Override
protected void cardsRevealed(List<PhysicalCard> cards) {
if (cards.size() > 0) {
final PhysicalCard card = cards.get(0);
action.appendEffect(
new PlayoutDecisionEffect(game.getUserFeedback(), playerId,
new MultipleChoiceAwaitingDecision(1, "Do you want to put " + card.getBlueprint().getName() + " on bottom of deck?", new String[]{"Yes", "No"}) {
@Override
protected void validDecisionMade(int index, String result) {
if (result.equals("Yes"))
action.insertEffect(
new PutCardFromDeckOnBottomOfDeckEffect(self, card));
}
})
);
}
}
});
}
}));
return Collections.singletonList(action);
}
return null;
}
}