"Attunement"
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 PutCardsFromDeckBeneathDrawDeckEffect extends AbstractSubActionEffect {
|
||||
private Action _action;
|
||||
private PhysicalCard _source;
|
||||
private String _playerId;
|
||||
private Set<PhysicalCard> _cards;
|
||||
|
||||
public PutCardsFromDeckBeneathDrawDeckEffect(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 ChooseAndPutNextCardFromDeckOnBottomOfDeck(subAction, _cards));
|
||||
processSubAction(game, subAction);
|
||||
}
|
||||
|
||||
private class ChooseAndPutNextCardFromDeckOnBottomOfDeck extends ChooseArbitraryCardsEffect {
|
||||
private Collection<PhysicalCard> _remainingCards;
|
||||
private SubAction _subAction;
|
||||
|
||||
public ChooseAndPutNextCardFromDeckOnBottomOfDeck(SubAction subAction, Collection<PhysicalCard> remainingCards) {
|
||||
super(_playerId, "Choose a card to put on bottom 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 PutCardFromDeckOnBottomOfDeckEffect(_source, selectedCard));
|
||||
_remainingCards.remove(selectedCard);
|
||||
if (_remainingCards.size() > 0)
|
||||
_subAction.appendEffect(
|
||||
new ChooseAndPutNextCardFromDeckOnBottomOfDeck(_subAction, _remainingCards));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.gempukku.lotro.cards.set12.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.AddUntilEndOfPhaseModifierEffect;
|
||||
import com.gempukku.lotro.cards.effects.PutCardsFromDeckBeneathDrawDeckEffect;
|
||||
import com.gempukku.lotro.cards.effects.RevealTopCardsOfDrawDeckEffect;
|
||||
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.effects.ChooseActiveCardEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: Black Rider
|
||||
* Side: Free
|
||||
* Culture: Elven
|
||||
* Twilight Cost: 2
|
||||
* Type: Event • Skirmish
|
||||
* Game Text: Spot an Elf to reveal cards from the top of your draw deck until you reveal a Shadow card. Make an Elf
|
||||
* strength +2 for each card revealed. Place the revealed cards in any order on the bottom of your draw deck.
|
||||
*/
|
||||
public class Card12_016 extends AbstractEvent {
|
||||
public Card12_016() {
|
||||
super(Side.FREE_PEOPLE, 2, Culture.ELVEN, "Attunement", Phase.SKIRMISH);
|
||||
}
|
||||
|
||||
@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.canSpot(game, Race.ELF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayEventAction getPlayCardAction(final String playerId, LotroGame game, final PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
|
||||
final PlayEventAction action = new PlayEventAction(self);
|
||||
action.appendCost(
|
||||
new ChooseActiveCardEffect(self, playerId, "Choose an Elf", Race.ELF) {
|
||||
@Override
|
||||
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
||||
final int count = getCardsToRevealCount(playerId, game);
|
||||
action.appendEffect(
|
||||
new RevealTopCardsOfDrawDeckEffect(self, playerId, count) {
|
||||
@Override
|
||||
protected void cardsRevealed(List<PhysicalCard> cards) {
|
||||
}
|
||||
});
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new StrengthModifier(self, card, count * 2), Phase.SKIRMISH));
|
||||
action.appendEffect(
|
||||
new PutCardsFromDeckBeneathDrawDeckEffect(action, self, playerId, game.getGameState().getDeck(playerId).subList(0, count)));
|
||||
}
|
||||
});
|
||||
return action;
|
||||
}
|
||||
|
||||
private int getCardsToRevealCount(String playerId, LotroGame game) {
|
||||
int count = 0;
|
||||
for (PhysicalCard physicalCard : game.getGameState().getDeck(playerId)) {
|
||||
count++;
|
||||
if (physicalCard.getBlueprint().getSide() == Side.SHADOW)
|
||||
break;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.gempukku.lotro.cards.AbstractCompanion;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.actions.PlayPermanentAction;
|
||||
import com.gempukku.lotro.cards.effects.AddBurdenEffect;
|
||||
import com.gempukku.lotro.cards.effects.PutCardsFromDeckBeneathDrawDeckEffect;
|
||||
import com.gempukku.lotro.cards.effects.RevealTopCardsOfDrawDeckEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
|
||||
import com.gempukku.lotro.common.*;
|
||||
@@ -11,12 +12,7 @@ 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.actions.SubAction;
|
||||
import com.gempukku.lotro.logic.decisions.ArbitraryCardsSelectionDecision;
|
||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
|
||||
import com.gempukku.lotro.logic.timing.AbstractSuccessfulEffect;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -49,7 +45,7 @@ public class Card5_028 extends AbstractCompanion {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ActivateCardAction> getExtraInPlayPhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
|
||||
protected List<ActivateCardAction> getExtraInPlayPhaseActions(final String playerId, final LotroGame game, final PhysicalCard self) {
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.REGROUP, self)
|
||||
&& PlayConditions.canExert(self, game, 2, Filters.gollumOrSmeagol)) {
|
||||
final ActivateCardAction action = new ActivateCardAction(self);
|
||||
@@ -60,11 +56,8 @@ public class Card5_028 extends AbstractCompanion {
|
||||
@Override
|
||||
protected void cardsRevealed(List<PhysicalCard> cards) {
|
||||
int shadowCards = Filters.filter(cards, game.getGameState(), game.getModifiersQuerying(), Side.SHADOW).size();
|
||||
SubAction subAction = new SubAction(action);
|
||||
for (int i = 0; i < cards.size(); i++)
|
||||
action.appendEffect(
|
||||
new PutCardsOnBottomInAnyOrderEffect(game, playerId, cards));
|
||||
game.getActionsEnvironment().addActionToStack(subAction);
|
||||
action.appendEffect(
|
||||
new PutCardsFromDeckBeneathDrawDeckEffect(action, self, playerId, cards));
|
||||
for (int i = 0; i < shadowCards; i++)
|
||||
action.appendEffect(
|
||||
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, CardType.MINION));
|
||||
@@ -74,49 +67,4 @@ public class Card5_028 extends AbstractCompanion {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private class PutCardsOnBottomInAnyOrderEffect extends AbstractSuccessfulEffect {
|
||||
private LotroGame _game;
|
||||
private String _playerId;
|
||||
private List<PhysicalCard> _cards;
|
||||
|
||||
public PutCardsOnBottomInAnyOrderEffect(LotroGame game, String playerId, List<PhysicalCard> cards) {
|
||||
_game = game;
|
||||
_playerId = playerId;
|
||||
_cards = cards;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect.Type getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEffect(final LotroGame game) {
|
||||
if (_cards.size() == 1) {
|
||||
final PhysicalCard card = _cards.get(0);
|
||||
game.getGameState().removeCardsFromZone(_playerId, Collections.singleton(card));
|
||||
game.getGameState().putCardOnBottomOfDeck(card);
|
||||
} else if (_cards.size() > 1) {
|
||||
game.getUserFeedback().sendAwaitingDecision(
|
||||
_playerId, new ArbitraryCardsSelectionDecision(1, "Choose card to put on bottom of deck", _cards, 1, 1) {
|
||||
@Override
|
||||
public void decisionMade(String result) throws DecisionResultInvalidException {
|
||||
final List<PhysicalCard> selectedCards = getSelectedCardsByResponse(result);
|
||||
if (selectedCards.size() == 1) {
|
||||
PhysicalCard card = selectedCards.iterator().next();
|
||||
_cards.remove(card);
|
||||
game.getGameState().removeCardsFromZone(_playerId, Collections.singleton(card));
|
||||
game.getGameState().putCardOnBottomOfDeck(card);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user