"Back to the Light"
This commit is contained in:
@@ -0,0 +1,72 @@
|
|||||||
|
package com.gempukku.lotro.cards.effects;
|
||||||
|
|
||||||
|
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 java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class PutCardsFromDeckOnTopOfDrawDeckEffect extends AbstractSubActionEffect {
|
||||||
|
private Action _action;
|
||||||
|
private PhysicalCard _source;
|
||||||
|
private String _playerId;
|
||||||
|
private Set<PhysicalCard> _cards;
|
||||||
|
|
||||||
|
public PutCardsFromDeckOnTopOfDrawDeckEffect(Action action, PhysicalCard source, String playerId, Collection<? extends PhysicalCard> cards) {
|
||||||
|
_action = action;
|
||||||
|
_source = source;
|
||||||
|
_playerId = playerId;
|
||||||
|
_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) {
|
||||||
|
SubAction subAction = new SubAction(_action);
|
||||||
|
subAction.appendEffect(
|
||||||
|
new ChooseAndPutNextCardFromDeckOnTopOfDeck(subAction, _cards));
|
||||||
|
processSubAction(game, subAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ChooseAndPutNextCardFromDeckOnTopOfDeck extends ChooseArbitraryCardsEffect {
|
||||||
|
private Collection<PhysicalCard> _remainingCards;
|
||||||
|
private SubAction _subAction;
|
||||||
|
|
||||||
|
public ChooseAndPutNextCardFromDeckOnTopOfDeck(SubAction subAction, Collection<PhysicalCard> remainingCards) {
|
||||||
|
super(_playerId, "Choose a card to put on top of your deck", remainingCards, 1, 1);
|
||||||
|
_subAction = subAction;
|
||||||
|
_remainingCards = remainingCards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
|
||||||
|
for (PhysicalCard selectedCard : selectedCards) {
|
||||||
|
_subAction.appendEffect(
|
||||||
|
new PutCardFromDeckOnTopOfDeckEffect(_source, selectedCard));
|
||||||
|
_remainingCards.remove(selectedCard);
|
||||||
|
if (_remainingCards.size() > 0)
|
||||||
|
_subAction.appendEffect(
|
||||||
|
new ChooseAndPutNextCardFromDeckOnTopOfDeck(_subAction, _remainingCards));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,7 +37,7 @@ public class Card18_004 extends AbstractAttachableFPPossession {
|
|||||||
@Override
|
@Override
|
||||||
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||||
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.ARCHERY, self)
|
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.ARCHERY, self)
|
||||||
&& PlayConditions.canSpot(game, Filters.hasAttached(self), Filters.name("Arwen"))
|
&& PlayConditions.canSpot(game, Filters.hasAttached(self), Filters.arwen)
|
||||||
&& PlayConditions.canDiscardFromHand(game, playerId, 2, Culture.ELVEN)) {
|
&& PlayConditions.canDiscardFromHand(game, playerId, 2, Culture.ELVEN)) {
|
||||||
ActivateCardAction action = new ActivateCardAction(self);
|
ActivateCardAction action = new ActivateCardAction(self);
|
||||||
action.appendCost(
|
action.appendCost(
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class Card18_005 extends AbstractAttachableFPPossession {
|
|||||||
@Override
|
@Override
|
||||||
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||||
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.MANEUVER, self)
|
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.MANEUVER, self)
|
||||||
&& PlayConditions.canExert(self, game, Filters.hasAttached(self), Filters.name("Arwen"))) {
|
&& PlayConditions.canExert(self, game, Filters.hasAttached(self), Filters.arwen)) {
|
||||||
ActivateCardAction action = new ActivateCardAction(self);
|
ActivateCardAction action = new ActivateCardAction(self);
|
||||||
action.appendCost(
|
action.appendCost(
|
||||||
new ExertCharactersEffect(self, self.getAttachedTo()));
|
new ExertCharactersEffect(self, self.getAttachedTo()));
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.gempukku.lotro.cards.set18.elven;
|
||||||
|
|
||||||
|
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.PutCardsFromDeckOnTopOfDrawDeckEffect;
|
||||||
|
import com.gempukku.lotro.cards.effects.ShuffleDeckEffect;
|
||||||
|
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.LotroGame;
|
||||||
|
import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect;
|
||||||
|
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set: Treachery & Deceit
|
||||||
|
* Side: Free
|
||||||
|
* Culture: Elven
|
||||||
|
* Twilight Cost: 0
|
||||||
|
* Type: Event • Maneuver
|
||||||
|
* Game Text: To play, exert an [ELVEN] companion or spot Arwen. Examine the top 5 cards of your draw deck and place
|
||||||
|
* any number of them aside. Shuffle the remaining cards into your draw deck and place those cards set aside on top
|
||||||
|
* of your draw deck in any order.
|
||||||
|
*/
|
||||||
|
public class Card18_006 extends AbstractEvent {
|
||||||
|
public Card18_006() {
|
||||||
|
super(Side.FREE_PEOPLE, 0, Culture.ELVEN, "Back to the Light", Phase.MANEUVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile) {
|
||||||
|
return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile)
|
||||||
|
&& (PlayConditions.canExert(self, game, Culture.ELVEN, CardType.COMPANION) || PlayConditions.canSpot(game, Filters.arwen));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlayEventAction getPlayCardAction(final String playerId, LotroGame game, final PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
|
||||||
|
final PlayEventAction action = new PlayEventAction(self);
|
||||||
|
action.appendEffect(
|
||||||
|
new UnrespondableEffect() {
|
||||||
|
@Override
|
||||||
|
protected void doPlayEffect(LotroGame game) {
|
||||||
|
final List<? extends PhysicalCard> deck = game.getGameState().getDeck(playerId);
|
||||||
|
final ArrayList<PhysicalCard> cards = new ArrayList<PhysicalCard>(deck.subList(0, Math.min(5, deck.size())));
|
||||||
|
action.appendEffect(
|
||||||
|
new ChooseArbitraryCardsEffect(playerId, "Choose cards to set aside", cards, 0, 5) {
|
||||||
|
@Override
|
||||||
|
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
|
||||||
|
game.getGameState().sendMessage(playerId + " set aside " + selectedCards.size() + " cards");
|
||||||
|
if (selectedCards.size() > 0)
|
||||||
|
action.appendEffect(
|
||||||
|
new PutCardsFromDeckOnTopOfDrawDeckEffect(action, self, playerId, selectedCards));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
action.appendEffect(
|
||||||
|
new ShuffleDeckEffect(playerId));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user