"Tol Brandir"
This commit is contained in:
@@ -0,0 +1,98 @@
|
|||||||
|
package com.gempukku.lotro.cards.set1.site;
|
||||||
|
|
||||||
|
import com.gempukku.lotro.cards.AbstractSite;
|
||||||
|
import com.gempukku.lotro.cards.PlayConditions;
|
||||||
|
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
|
||||||
|
import com.gempukku.lotro.common.Keyword;
|
||||||
|
import com.gempukku.lotro.common.Phase;
|
||||||
|
import com.gempukku.lotro.filters.Filter;
|
||||||
|
import com.gempukku.lotro.filters.Filters;
|
||||||
|
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.actions.CostToEffectAction;
|
||||||
|
import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect;
|
||||||
|
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
|
||||||
|
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||||
|
import com.gempukku.lotro.logic.timing.Action;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set: The Fellowship of the Ring
|
||||||
|
* Twilight Cost: 9
|
||||||
|
* Type: Site
|
||||||
|
* Site: 9
|
||||||
|
* Game Text: River. Shadow: Play up to 3 trackers from your discard pile; end your Shadow phase.
|
||||||
|
*/
|
||||||
|
public class Card1_363 extends AbstractSite {
|
||||||
|
public Card1_363() {
|
||||||
|
super("Tol Brandir", 9, 9, Direction.LEFT);
|
||||||
|
addKeyword(Keyword.RIVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends Action> getPlayablePhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
|
||||||
|
if (PlayConditions.canUseSiteDuringPhase(game.getGameState(), Phase.SHADOW, self)) {
|
||||||
|
final CostToEffectAction action = new CostToEffectAction(self, Keyword.SHADOW, "Play up to 3 trackers from your discard pile; end your Shadow phase.");
|
||||||
|
action.addEffect(
|
||||||
|
new ChooseTrackerToPlay(action, game, 1, playerId, "Choose tracker to play",
|
||||||
|
new LinkedList<PhysicalCard>(game.getGameState().getDiscard(playerId)),
|
||||||
|
Filters.and(
|
||||||
|
Filters.keyword(Keyword.TRACKER),
|
||||||
|
new Filter() {
|
||||||
|
@Override
|
||||||
|
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||||
|
List<? extends Action> playableActions = physicalCard.getBlueprint().getPlayablePhaseActions(playerId, game, physicalCard);
|
||||||
|
return (playableActions != null && playableActions.size() > 0);
|
||||||
|
}
|
||||||
|
}), 0, 1));
|
||||||
|
return Collections.singletonList(action);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ChooseTrackerToPlay extends ChooseArbitraryCardsEffect {
|
||||||
|
private CostToEffectAction _action;
|
||||||
|
private LotroGame _game;
|
||||||
|
private int _count;
|
||||||
|
private String _playerId;
|
||||||
|
private String _choiceText;
|
||||||
|
private Filter _filter;
|
||||||
|
|
||||||
|
private ChooseTrackerToPlay(CostToEffectAction action, LotroGame game, int count, String playerId, String choiceText, List<PhysicalCard> cards, Filter filter, int minimum, int maximum) {
|
||||||
|
super(playerId, choiceText, cards, filter, minimum, maximum);
|
||||||
|
_action = action;
|
||||||
|
_game = game;
|
||||||
|
_count = count;
|
||||||
|
_playerId = playerId;
|
||||||
|
_choiceText = choiceText;
|
||||||
|
_filter = filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void cardsSelected(List<PhysicalCard> selectedCards) {
|
||||||
|
if (selectedCards.size() > 0) {
|
||||||
|
PhysicalCard selectedCard = selectedCards.get(0);
|
||||||
|
_game.getActionsEnvironment().addActionToStack(selectedCard.getBlueprint().getPlayablePhaseActions(_playerId, _game, selectedCard).get(0));
|
||||||
|
|
||||||
|
LinkedList<PhysicalCard> remainingCards = new LinkedList<PhysicalCard>(_game.getGameState().getDiscard(_playerId));
|
||||||
|
remainingCards.remove(selectedCard);
|
||||||
|
if (_count < 3)
|
||||||
|
_action.addEffect(new ChooseTrackerToPlay(_action, _game, _count + 1, _playerId, _choiceText, remainingCards, _filter, 0, 1));
|
||||||
|
else
|
||||||
|
_action.addEffect(
|
||||||
|
new AddUntilEndOfPhaseModifierEffect(
|
||||||
|
new AbstractModifier(null, "End Shadow Phase", null) {
|
||||||
|
@Override
|
||||||
|
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}, Phase.SHADOW
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ public enum Keyword {
|
|||||||
|
|
||||||
RIVER("River"), PLAINS("Plains"), UNDERGROUND("Underground"), SANCTUARY("Sanctuary"), FOREST("Forest"), MARSH("Marsh"), MOUNTAIN("Mountain"),
|
RIVER("River"), PLAINS("Plains"), UNDERGROUND("Underground"), SANCTUARY("Sanctuary"), FOREST("Forest"), MARSH("Marsh"), MOUNTAIN("Mountain"),
|
||||||
|
|
||||||
DAMAGE("Damage"), DEFENDER("Defender"), FIERCE("Fierce"), ARCHER("Archer"), RANGER("Ranger"),
|
DAMAGE("Damage"), DEFENDER("Defender"), FIERCE("Fierce"), ARCHER("Archer"), RANGER("Ranger"), TRACKER("Tracker"),
|
||||||
|
|
||||||
HAND_WEAPON("Hand Weapon"), ARMOR("Armor"), HELM("Helm"), MOUNT("Mount"), RANGED_WEAPON("Ranged Weapon"), CLOAK("Cloak");
|
HAND_WEAPON("Hand Weapon"), ARMOR("Armor"), HELM("Helm"), MOUNT("Mount"), RANGED_WEAPON("Ranged Weapon"), CLOAK("Cloak");
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.gempukku.lotro.logic.effects;
|
package com.gempukku.lotro.logic.effects;
|
||||||
|
|
||||||
|
import com.gempukku.lotro.filters.Filter;
|
||||||
|
import com.gempukku.lotro.filters.Filters;
|
||||||
import com.gempukku.lotro.game.PhysicalCard;
|
import com.gempukku.lotro.game.PhysicalCard;
|
||||||
import com.gempukku.lotro.game.state.LotroGame;
|
import com.gempukku.lotro.game.state.LotroGame;
|
||||||
import com.gempukku.lotro.logic.decisions.ArbitraryCardsSelectionDecision;
|
import com.gempukku.lotro.logic.decisions.ArbitraryCardsSelectionDecision;
|
||||||
@@ -12,26 +14,32 @@ public abstract class ChooseArbitraryCardsEffect extends UnrespondableEffect {
|
|||||||
private String _playerId;
|
private String _playerId;
|
||||||
private String _choiceText;
|
private String _choiceText;
|
||||||
private List<PhysicalCard> _cards;
|
private List<PhysicalCard> _cards;
|
||||||
|
private Filter _filter;
|
||||||
private int _minimum;
|
private int _minimum;
|
||||||
private int _maximum;
|
private int _maximum;
|
||||||
|
|
||||||
public ChooseArbitraryCardsEffect(String playerId, String choiceText, List<PhysicalCard> cards, int minimum, int maximum) {
|
public ChooseArbitraryCardsEffect(String playerId, String choiceText, List<PhysicalCard> cards, int minimum, int maximum) {
|
||||||
|
this(playerId, choiceText, cards, Filters.any(), minimum, maximum);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChooseArbitraryCardsEffect(String playerId, String choiceText, List<PhysicalCard> cards, Filter filter, int minimum, int maximum) {
|
||||||
_playerId = playerId;
|
_playerId = playerId;
|
||||||
_choiceText = choiceText;
|
_choiceText = choiceText;
|
||||||
_cards = cards;
|
_cards = cards;
|
||||||
|
_filter = filter;
|
||||||
_minimum = minimum;
|
_minimum = minimum;
|
||||||
_maximum = maximum;
|
_maximum = maximum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayEffect(LotroGame game) {
|
public boolean canPlayEffect(LotroGame game) {
|
||||||
return (_cards.size() >= _minimum);
|
return (Filters.filter(_cards, game.getGameState(), game.getModifiersQuerying(), _filter).size() >= _minimum);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playEffect(LotroGame game) {
|
public void playEffect(LotroGame game) {
|
||||||
game.getUserFeedback().sendAwaitingDecision(_playerId,
|
game.getUserFeedback().sendAwaitingDecision(_playerId,
|
||||||
new ArbitraryCardsSelectionDecision(1, _choiceText, _cards, _minimum, _maximum) {
|
new ArbitraryCardsSelectionDecision(1, _choiceText, Filters.filter(_cards, game.getGameState(), game.getModifiersQuerying(), _filter), _minimum, _maximum) {
|
||||||
@Override
|
@Override
|
||||||
public void decisionMade(String result) throws DecisionResultInvalidException {
|
public void decisionMade(String result) throws DecisionResultInvalidException {
|
||||||
cardsSelected(getSelectedCardsByResponse(result));
|
cardsSelected(getSelectedCardsByResponse(result));
|
||||||
|
|||||||
Reference in New Issue
Block a user