From b404adf75b52ffffdc1bc8c2064355fb86831fcf Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Mon, 10 Oct 2011 16:30:02 +0000 Subject: [PATCH] "Othanc Champion" --- .../lotro/cards/set4/isengard/Card4_164.java | 60 +++++++++++++++++++ .../actions/DefaultActionsEnvironment.java | 18 +++++- 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/isengard/Card4_164.java diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/isengard/Card4_164.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/isengard/Card4_164.java new file mode 100644 index 000000000..c44d0fcda --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/isengard/Card4_164.java @@ -0,0 +1,60 @@ +package com.gempukku.lotro.cards.set4.isengard; + +import com.gempukku.lotro.cards.AbstractMinion; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.effects.ExertCharactersEffect; +import com.gempukku.lotro.cards.effects.PreventableEffect; +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.ActivateCardAction; +import com.gempukku.lotro.logic.effects.AssignmentEffect; +import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect; +import com.gempukku.lotro.logic.timing.Action; + +import java.util.Collections; +import java.util.List; + +/** + * Set: The Two Towers + * Side: Shadow + * Culture: Isengard + * Twilight Cost: 5 + * Type: Minion • Uruk-Hai + * Strength: 12 + * Vitality: 2 + * Site: 5 + * Game Text: Damage +1. Assignment: Exert Orthanc Champion to assign it to an unbound companion. That companion + * may exert to prevent this. + */ +public class Card4_164 extends AbstractMinion { + public Card4_164() { + super(5, 12, 2, 5, Race.URUK_HAI, Culture.ISENGARD, "Othanc Champion", true); + addKeyword(Keyword.DAMAGE); + } + + @Override + protected List getExtraPhaseActions(final String playerId, final LotroGame game, final PhysicalCard self) { + if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.ASSIGNMENT, self, 0) + && PlayConditions.canExert(self, game, Filters.sameCard(self)) + && Filters.canBeAssignedToSkirmish(Side.SHADOW).accepts(game.getGameState(), game.getModifiersQuerying(), self)) { + final ActivateCardAction action = new ActivateCardAction(self, Keyword.ASSIGNMENT); + action.appendCost( + new ExertCharactersEffect(self, self)); + action.appendEffect( + new ChooseActiveCardEffect(self, playerId, "Choose unbound companion", Filters.unboundCompanion(), Filters.canBeAssignedToSkirmish(Side.SHADOW)) { + @Override + protected void cardSelected(PhysicalCard companion) { + action.insertEffect( + new PreventableEffect(action, + new AssignmentEffect(playerId, companion, Collections.singletonList(self), "assigned by card effect"), + game.getGameState().getCurrentPlayerId(), + new ExertCharactersEffect(self, companion))); + } + }); + return Collections.singletonList(action); + } + return null; + } +} diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/actions/DefaultActionsEnvironment.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/actions/DefaultActionsEnvironment.java index 76a4af25b..71184b6b3 100644 --- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/actions/DefaultActionsEnvironment.java +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/actions/DefaultActionsEnvironment.java @@ -102,7 +102,14 @@ public class DefaultActionsEnvironment implements ActionsEnvironment { _lotroGame.getGameState().iterateActivableCards(playerId, gatherActions); - return gatherActions.getActions(); + List result = new LinkedList(); + + for (Action action : gatherActions.getActions()) { + if (_lotroGame.getModifiersQuerying().canPlayAction(_lotroGame.getGameState(), playerId, action)) + result.add(action); + } + + return result; } @Override @@ -139,7 +146,14 @@ public class DefaultActionsEnvironment implements ActionsEnvironment { _lotroGame.getGameState().iterateActivableCards(playerId, gatherAfterActions); - return gatherAfterActions.getActions(); + List result = new LinkedList(); + + for (Action action : gatherAfterActions.getActions()) { + if (_lotroGame.getModifiersQuerying().canPlayAction(_lotroGame.getGameState(), playerId, action)) + result.add(action); + } + + return result; } @Override