"Rest While You Can"
This commit is contained in:
@@ -8,19 +8,17 @@ import com.gempukku.lotro.logic.GameUtils;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
|
||||
public class DiscardCardFromDeckEffect extends UnrespondableEffect {
|
||||
private String _playerId;
|
||||
private PhysicalCard _card;
|
||||
|
||||
public DiscardCardFromDeckEffect(String playerId, PhysicalCard card) {
|
||||
_playerId = playerId;
|
||||
public DiscardCardFromDeckEffect(PhysicalCard card) {
|
||||
_card = card;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doPlayEffect(LotroGame game) {
|
||||
if (game.getGameState().getDeck(_playerId).contains(_card)) {
|
||||
if (game.getGameState().getDeck(_card.getOwner()).contains(_card)) {
|
||||
GameState gameState = game.getGameState();
|
||||
gameState.sendMessage(_playerId + " discards " + GameUtils.getCardLink(_card) + " from his or her deck");
|
||||
gameState.sendMessage(GameUtils.getCardLink(_card) + " gets discarded from deck");
|
||||
gameState.removeCardFromZone(_card);
|
||||
gameState.addCardToZone(_card, Zone.DISCARD);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class Card1_018 extends AbstractEvent {
|
||||
@Override
|
||||
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
|
||||
if (selectedCards.size() > 0) {
|
||||
action.appendEffect(new DiscardCardFromDeckEffect(chosenPlayerId, selectedCards.iterator().next()));
|
||||
action.appendEffect(new DiscardCardFromDeckEffect(selectedCards.iterator().next()));
|
||||
topDeckCards.removeAll(selectedCards);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Card1_028 extends AbstractEvent {
|
||||
if (card.getBlueprint().getSide() == Side.FREE_PEOPLE)
|
||||
action.appendEffect(new PutCardFromDeckIntoHandOrDiscardEffect(card));
|
||||
else
|
||||
action.appendEffect(new DiscardCardFromDeckEffect(playerId, card));
|
||||
action.appendEffect(new DiscardCardFromDeckEffect(card));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ public class Card1_055 extends AbstractPermanent {
|
||||
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
|
||||
for (PhysicalCard selectedCard : selectedCards)
|
||||
action.appendEffect(
|
||||
new DiscardCardFromDeckEffect(chosenOpponent, selectedCard));
|
||||
new DiscardCardFromDeckEffect(selectedCard));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Card1_081 extends AbstractEvent {
|
||||
}
|
||||
|
||||
for (PhysicalCard remainingCard : cards)
|
||||
action.appendEffect(new DiscardCardFromDeckEffect(playerId, remainingCard));
|
||||
action.appendEffect(new DiscardCardFromDeckEffect(remainingCard));
|
||||
}
|
||||
});
|
||||
return action;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Card1_082 extends AbstractEvent {
|
||||
}
|
||||
|
||||
for (PhysicalCard remainingCard : cards)
|
||||
action.appendEffect(new DiscardCardFromDeckEffect(playerId, remainingCard));
|
||||
action.appendEffect(new DiscardCardFromDeckEffect(remainingCard));
|
||||
}
|
||||
});
|
||||
return action;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class Card1_189 extends AbstractResponseEvent {
|
||||
for (PhysicalCard card : deck.subList(0, spotCount)) {
|
||||
if (card.getBlueprint().getSide() == Side.SHADOW)
|
||||
shadowCardsCount++;
|
||||
action.appendEffect(new DiscardCardFromDeckEffect(playerId, card));
|
||||
action.appendEffect(new DiscardCardFromDeckEffect(card));
|
||||
}
|
||||
int burdens = Math.min(3, shadowCardsCount);
|
||||
action.appendEffect(new AddBurdenEffect(self, burdens));
|
||||
|
||||
@@ -47,7 +47,7 @@ public class Card1_200 extends AbstractPermanent {
|
||||
new PutCardFromDeckIntoHandOrDiscardEffect(bottomCard));
|
||||
} else {
|
||||
action.appendEffect(
|
||||
new DiscardCardFromDeckEffect(playerId, bottomCard));
|
||||
new DiscardCardFromDeckEffect(bottomCard));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Card1_242 extends AbstractPermanent {
|
||||
new PutCardFromDeckIntoHandOrDiscardEffect(topCard));
|
||||
else {
|
||||
action.appendEffect(
|
||||
new DiscardCardFromDeckEffect(playerId, topCard));
|
||||
new DiscardCardFromDeckEffect(topCard));
|
||||
action.appendEffect(
|
||||
new ChooseAndDiscardCardsFromHandEffect(action, playerId));
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Card1_301 extends AbstractAlly {
|
||||
if (card.getBlueprint().getCulture() == Culture.SHIRE)
|
||||
action.appendEffect(new PutCardFromDeckIntoHandOrDiscardEffect(card));
|
||||
else
|
||||
action.appendEffect(new DiscardCardFromDeckEffect(playerId, card));
|
||||
action.appendEffect(new DiscardCardFromDeckEffect(card));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Card1_215 extends AbstractEvent {
|
||||
new PutCardFromDeckIntoHandOrDiscardEffect(revealedCard));
|
||||
else
|
||||
action.appendEffect(
|
||||
new DiscardCardFromDeckEffect(playerId, revealedCard));
|
||||
new DiscardCardFromDeckEffect(revealedCard));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -69,7 +69,7 @@ public class Card4_107 extends AbstractAttachable {
|
||||
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
|
||||
for (PhysicalCard selectedCard : selectedCards) {
|
||||
action.insertEffect(
|
||||
new DiscardCardFromDeckEffect(playerId, selectedCard));
|
||||
new DiscardCardFromDeckEffect(selectedCard));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -79,7 +79,7 @@ public class Card4_107 extends AbstractAttachable {
|
||||
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
|
||||
for (PhysicalCard selectedCard : selectedCards) {
|
||||
action.insertEffect(
|
||||
new DiscardCardFromDeckEffect(playerId, selectedCard));
|
||||
new DiscardCardFromDeckEffect(selectedCard));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.gempukku.lotro.cards.set4.isengard;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAttachable;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.ChooseArbitraryCardsEffect;
|
||||
import com.gempukku.lotro.cards.effects.DiscardCardFromDeckEffect;
|
||||
import com.gempukku.lotro.cards.effects.RevealTopCardsOfDrawDeckEffect;
|
||||
import com.gempukku.lotro.cards.effects.ShuffleDeckEffect;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
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.RequiredTriggerAction;
|
||||
import com.gempukku.lotro.logic.effects.KillEffect;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* Set: The Two Towers
|
||||
* Side: Shadow
|
||||
* Culture: Isengard
|
||||
* Twilight Cost: 1
|
||||
* Type: Condition
|
||||
* Game Text: Search. To play, spot an [ISENGARD] tracker. Plays on a companion. Limit 1 per companion. If bearer
|
||||
* is killed, reveal the top 10 cards of opponent's draw deck and discard 1 Shadow card and 1 Free Peoples card.
|
||||
* Your opponent reshuffles that deck.
|
||||
*/
|
||||
public class Card4_171 extends AbstractAttachable {
|
||||
public Card4_171() {
|
||||
super(Side.SHADOW, CardType.CONDITION, 1, Culture.ISENGARD, null, "Rest While You Can");
|
||||
addKeyword(Keyword.SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, Filter additionalAttachmentFilter, int twilightModifier) {
|
||||
return super.checkPlayRequirements(playerId, game, self, additionalAttachmentFilter, twilightModifier)
|
||||
&& PlayConditions.canSpot(game, Filters.culture(Culture.ISENGARD), Filters.keyword(Keyword.TRACKER));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
|
||||
return Filters.and(Filters.type(CardType.COMPANION), Filters.not(Filters.hasAttached(Filters.name("Rest While You Can"))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredBeforeTriggers(final LotroGame game, Effect effect, final PhysicalCard self) {
|
||||
if (effect.getType() == EffectResult.Type.KILL) {
|
||||
KillEffect killEffect = (KillEffect) effect;
|
||||
if (killEffect.getCharactersToBeKilled().contains(self.getAttachedTo())) {
|
||||
final RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new RevealTopCardsOfDrawDeckEffect(game.getGameState().getCurrentPlayerId(), 10) {
|
||||
@Override
|
||||
protected void cardsRevealed(final List<PhysicalCard> cards) {
|
||||
action.appendEffect(
|
||||
new ChooseArbitraryCardsEffect(self.getOwner(), "Choose shadow card", cards, Filters.side(Side.SHADOW), 1, 1) {
|
||||
@Override
|
||||
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
|
||||
for (PhysicalCard selectedCard : selectedCards) {
|
||||
action.insertEffect(
|
||||
new DiscardCardFromDeckEffect(selectedCard));
|
||||
}
|
||||
}
|
||||
});
|
||||
action.appendEffect(
|
||||
new ChooseArbitraryCardsEffect(self.getOwner(), "Choose free people card", cards, Filters.side(Side.FREE_PEOPLE), 1, 1) {
|
||||
@Override
|
||||
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
|
||||
for (PhysicalCard selectedCard : selectedCards) {
|
||||
action.insertEffect(
|
||||
new DiscardCardFromDeckEffect(selectedCard));
|
||||
}
|
||||
}
|
||||
});
|
||||
action.appendEffect(
|
||||
new ShuffleDeckEffect(game.getGameState().getCurrentPlayerId()));
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user