From 457159bed8162b5111d09e993ad0e93a84262a12 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Wed, 7 Mar 2012 14:35:22 +0000 Subject: [PATCH] "Ted Sandyman" --- .../gempukku/lotro/cards/PlayConditions.java | 4 + .../cards/effects/LiberateASiteEffect.java | 17 ++++- .../lotro/cards/set18/men/Card18_075.java | 76 +++++++++++++++++++ 3 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set18/men/Card18_075.java diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java index 9fc1e6695..7f2fef68e 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java @@ -41,6 +41,10 @@ public class PlayConditions { return PlayConditions.canSpot(game, Filters.siteControlledByShadowPlayer(game.getGameState().getCurrentPlayerId())); } + public static boolean canLiberateASite(LotroGame game, String playerId) { + return PlayConditions.canSpot(game, Filters.siteControlled(playerId)); + } + public static boolean canDiscardFromHand(LotroGame game, String playerId, int count, Filterable... cardFilter) { return Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), cardFilter).size() >= count; } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/LiberateASiteEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/LiberateASiteEffect.java index afc69fc70..8b7526ae3 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/LiberateASiteEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/LiberateASiteEffect.java @@ -14,11 +14,17 @@ import java.util.Set; public class LiberateASiteEffect extends AbstractEffect { private PhysicalCard _source; + private String _playerId; public LiberateASiteEffect(PhysicalCard source) { _source = source; } + public LiberateASiteEffect(PhysicalCard source, String playerId) { + _source = source; + _playerId = playerId; + } + @Override public boolean isPlayableInFull(LotroGame game) { return Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.siteControlledByShadowPlayer(game.getGameState().getCurrentPlayerId())) > 0; @@ -41,9 +47,14 @@ public class LiberateASiteEffect extends AbstractEffect { for (int i = maxUnoccupiedSite; i >= 1; i--) { PhysicalCard site = game.getGameState().getSite(i); - if (site != null && site.getCardController() != null - && !site.getCardController().equals(game.getGameState().getCurrentPlayerId())) - return site; + if (_playerId == null) { + if (site != null && site.getCardController() != null + && !site.getCardController().equals(game.getGameState().getCurrentPlayerId())) + return site; + } else { + if (site != null && site.getCardController() != null && site.getCardController().equals(_playerId)) + return site; + } } return null; diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set18/men/Card18_075.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set18/men/Card18_075.java new file mode 100644 index 000000000..f2810f635 --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set18/men/Card18_075.java @@ -0,0 +1,76 @@ +package com.gempukku.lotro.cards.set18.men; + +import com.gempukku.lotro.cards.AbstractMinion; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.effects.AddUntilStartOfPhaseModifierEffect; +import com.gempukku.lotro.cards.effects.LiberateASiteEffect; +import com.gempukku.lotro.cards.effects.SelfExertEffect; +import com.gempukku.lotro.cards.effects.StackCardFromPlayEffect; +import com.gempukku.lotro.common.CardType; +import com.gempukku.lotro.common.Culture; +import com.gempukku.lotro.common.Phase; +import com.gempukku.lotro.common.Race; +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.effects.ChooseActiveCardEffect; +import com.gempukku.lotro.logic.modifiers.StrengthModifier; +import com.gempukku.lotro.logic.timing.Action; + +import java.util.Collections; +import java.util.List; + +/** + * Set: Treachery & Deceit + * Side: Shadow + * Culture: Men + * Twilight Cost: 1 + * Type: Minion • Hobbit + * Strength: 3 + * Vitality: 4 + * Site: 2 + * Game Text: Maneuver: Liberate a site you control to make each [MEN] minion strength +2 until the regroup phase. + * Regroup: Exert Ted Sandyman to stack a [MEN] Man in play on a possession. + */ +public class Card18_075 extends AbstractMinion { + public Card18_075() { + super(1, 3, 4, 2, Race.HOBBIT, Culture.MEN, "Ted Sandyman", true); + } + + @Override + protected List getExtraPhaseActions(final String playerId, LotroGame game, final PhysicalCard self) { + if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.MANEUVER, self, 0) + && PlayConditions.canLiberateASite(game, playerId)) { + ActivateCardAction action = new ActivateCardAction(self); + action.appendCost( + new LiberateASiteEffect(self, playerId)); + action.appendEffect( + new AddUntilStartOfPhaseModifierEffect( + new StrengthModifier(self, Filters.and(Culture.MEN, CardType.MINION), 2), Phase.REGROUP)); + return Collections.singletonList(action); + } + if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.REGROUP, self, 0) + && PlayConditions.canSelfExert(self, game)) { + final ActivateCardAction action = new ActivateCardAction(self); + action.appendCost( + new SelfExertEffect(self)); + action.appendEffect( + new ChooseActiveCardEffect(self, playerId, "Choose a MEN minion", Culture.MEN, CardType.MINION) { + @Override + protected void cardSelected(LotroGame game, final PhysicalCard minion) { + action.appendEffect( + new ChooseActiveCardEffect(self, playerId, "Choose a possession", CardType.POSSESSION) { + @Override + protected void cardSelected(LotroGame game, PhysicalCard possession) { + action.appendEffect( + new StackCardFromPlayEffect(minion, possession)); + } + }); + } + }); + return Collections.singletonList(action); + } + return null; + } +}