"Ship of Smoke"

This commit is contained in:
marcins78@gmail.com
2012-03-06 15:58:16 +00:00
parent 83f42bfd78
commit 6f408b1a3c
2 changed files with 144 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.common.Filterable;
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.SubAction;
import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect;
import com.gempukku.lotro.logic.timing.AbstractSubActionEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
public class PutCardsFromDeckIntoHandDiscardRestEffect extends AbstractSubActionEffect {
private Action _action;
private PhysicalCard _source;
private String _playerId;
private Filterable[] _filters;
private Set<PhysicalCard> _cards;
public PutCardsFromDeckIntoHandDiscardRestEffect(Action action, PhysicalCard source, String playerId, Collection<? extends PhysicalCard> cards, Filterable... filters) {
_action = action;
_source = source;
_playerId = playerId;
_filters = filters;
_cards = new HashSet<PhysicalCard>(cards);
}
@Override
public String getText(LotroGame game) {
return null;
}
@Override
public Type getType() {
return null;
}
@Override
public boolean isPlayableInFull(LotroGame game) {
return true;
}
@Override
public void playEffect(LotroGame game) {
final SubAction subAction = new SubAction(_action);
subAction.appendEffect(
new ChooseAndPutNextCardFromDeckIntoHand(subAction, _cards));
subAction.appendEffect(
new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
for (PhysicalCard card : _cards) {
subAction.appendEffect(
new DiscardCardFromDeckEffect(card));
}
}
});
processSubAction(game, subAction);
}
private class ChooseAndPutNextCardFromDeckIntoHand extends UnrespondableEffect {
private SubAction _subAction;
private Set<PhysicalCard> _remainingCards;
private ChooseAndPutNextCardFromDeckIntoHand(SubAction subAction, Set<PhysicalCard> remainingCards) {
_subAction = subAction;
_remainingCards = remainingCards;
}
@Override
protected void doPlayEffect(LotroGame game) {
if (game.getModifiersQuerying().canDrawCardNoIncrement(game.getGameState(), _playerId)
&& Filters.filter(_remainingCards, game.getGameState(), game.getModifiersQuerying(), _filters).size() > 0) {
_subAction.insertEffect(
new ChooseArbitraryCardsEffect(_playerId, "Put next card to put into your hand", _remainingCards, Filters.and(_filters), 1, 1) {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
for (PhysicalCard selectedCard : selectedCards) {
_remainingCards.remove(selectedCard);
_subAction.insertEffect(
new ChooseAndPutNextCardFromDeckIntoHand(_subAction, _remainingCards));
_subAction.insertEffect(
new PutCardFromDeckIntoHandEffect(selectedCard));
}
}
});
}
}
}
}

View File

@@ -0,0 +1,50 @@
package com.gempukku.lotro.cards.set18.gandalf;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.PutCardsFromDeckIntoHandDiscardRestEffect;
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.OptionalTriggerAction;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Set: Treachery & Deceit
* Side: Free
* Culture: Gandalf
* Twilight Cost: 0
* Type: Condition • Support Area
* Game Text: Pipeweed. Each time you play a pipeweed card, you may spot Gandalf to reveal the top 3 cards of your draw
* deck. Take all Free Peoples cards revealed into hand and discard the remaining cards.
*/
public class Card18_027 extends AbstractPermanent {
public Card18_027() {
super(Side.FREE_PEOPLE, 0, CardType.CONDITION, Culture.GANDALF, Zone.SUPPORT, "Ship of Smoke", true);
addKeyword(Keyword.PIPEWEED);
}
@Override
public List<OptionalTriggerAction> getOptionalAfterTriggers(final String playerId, final LotroGame game, EffectResult effectResult, final PhysicalCard self) {
if (TriggerConditions.played(game, effectResult, Filters.owner(playerId), Keyword.PIPEWEED)
&& PlayConditions.canSpot(game, Filters.gandalf)) {
final OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new RevealTopCardsOfDrawDeckEffect(self, playerId, 3) {
@Override
protected void cardsRevealed(List<PhysicalCard> cards) {
action.appendEffect(
new PutCardsFromDeckIntoHandDiscardRestEffect(action, self, playerId, cards, Side.FREE_PEOPLE));
}
});
return Collections.singletonList(action);
}
return null;
}
}