"Spies of Saruman"

This commit is contained in:
marcins78@gmail.com
2011-08-31 09:38:35 +00:00
parent 6692beb311
commit 40d7ba8a39
10 changed files with 150 additions and 7 deletions

View File

@@ -1,10 +1,12 @@
package com.gempukku.lotro.cards;
import com.gempukku.lotro.cards.actions.AttachPermanentAction;
import com.gempukku.lotro.common.*;
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.Filter;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.LotroCardBlueprint;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame;
@@ -32,11 +34,12 @@ public class AbstractAttachable extends AbstractLotroCardBlueprint {
protected void appendAttachCardAction(List<Action> actions, LotroGame game, PhysicalCard self, Filter validTargetFilter, Map<Filter, Integer> playCostModifiers) {
GameState gameState = game.getGameState();
LotroCardBlueprint blueprint = self.getBlueprint();
if (gameState.getCurrentPhase() == ((getSide() == Side.FREE_PEOPLE) ? Phase.FELLOWSHIP : Phase.SHADOW)
&& (self.getZone() == Zone.HAND || self.getZone() == Zone.DECK)
&& (!blueprint.isUnique() || !Filters.canSpot(gameState, game.getModifiersQuerying(), Filters.name(blueprint.getName())))
&& Filters.canSpot(gameState, game.getModifiersQuerying(), validTargetFilter)) {
if (Filters.canSpot(gameState, game.getModifiersQuerying(), validTargetFilter)
&&
((getSide() == Side.FREE_PEOPLE && PlayConditions.canPlayFPCardDuringPhase(game, Phase.FELLOWSHIP, self))
||
(getSide() == Side.SHADOW && PlayConditions.canPlayShadowCardDuringPhase(game, Phase.SHADOW, self)))
) {
actions.add(new AttachPermanentAction(self, validTargetFilter, playCostModifiers));
}

View File

@@ -156,4 +156,12 @@ public class ProxyingModifier implements Modifier {
return modifier.canPlayPhaseActions(gameState, modifiersQuerying, phase, result);
return result;
}
@Override
public boolean shouldSkipPhase(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result) {
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
if (modifier != null)
return modifier.shouldSkipPhase(gameState, modifiersQuerying, phase, result);
return result;
}
}

View File

@@ -10,11 +10,14 @@ 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.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.DiscardCardFromPlayEffect;
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
@@ -72,4 +75,16 @@ public class Card1_138 extends AbstractLotroCardBlueprint {
}
};
}
@Override
public List<? extends Action> getRequiredWhenActions(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.END_OF_TURN) {
CostToEffectAction action = new CostToEffectAction(self, "Discard at the end of the turn");
action.addEffect(new DiscardCardFromPlayEffect(self));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -0,0 +1,89 @@
package com.gempukku.lotro.cards.set1.isengard;
import com.gempukku.lotro.cards.AbstractLotroCardBlueprint;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.AttachPermanentAction;
import com.gempukku.lotro.cards.effects.ExertCharacterEffect;
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.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.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.DiscardCardFromPlayEffect;
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Set: The Fellowship of the Ring
* Side: Shadow
* Culture: Isengard
* Twilight Cost: 2
* Type: Condition
* Game Text: To play, exert a [ISENGARD] minion. Plays on a site. While the fellowship is at this site, skip the
* archery phase. Discard this condition at the end of the turn.
*/
public class Card1_140 extends AbstractLotroCardBlueprint {
public Card1_140() {
super(Side.SHADOW, CardType.CONDITION, Culture.ISENGARD, "Spies of Saruman", "1_140");
}
@Override
public int getTwilightCost() {
return 2;
}
@Override
public List<? extends Action> getPlayablePhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canPlayShadowCardDuringPhase(game, Phase.SHADOW, self)
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.ISENGARD), Filters.type(CardType.MINION), Filters.canExert())) {
final AttachPermanentAction action = new AttachPermanentAction(self, Filters.type(CardType.SITE), Collections.<Filter, Integer>emptyMap());
action.addCost(
new ChooseActiveCardEffect(playerId, "Choose an ISENGARD minion", Filters.culture(Culture.ISENGARD), Filters.type(CardType.MINION), Filters.canExert()) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard isengardMinion) {
action.addCost(new ExertCharacterEffect(isengardMinion));
}
}
);
return Collections.singletonList(action);
}
return null;
}
@Override
public Modifier getAlwaysOnEffect(final PhysicalCard self) {
return new AbstractModifier(self, "Skip archery phase", null) {
@Override
public boolean shouldSkipPhase(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result) {
if (phase == Phase.ARCHERY
&& gameState.getCurrentSite() == self.getAttachedTo())
return true;
return result;
}
};
}
@Override
public List<? extends Action> getRequiredWhenActions(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.END_OF_TURN) {
CostToEffectAction action = new CostToEffectAction(self, "Discard at the end of the turn");
action.addEffect(new DiscardCardFromPlayEffect(self));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -100,4 +100,9 @@ public abstract class AbstractModifier implements Modifier {
public boolean canPlayPhaseActions(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result) {
return result;
}
@Override
public boolean shouldSkipPhase(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result) {
return result;
}
}

View File

@@ -155,4 +155,12 @@ public class CompositeModifier implements Modifier {
return result;
}
@Override
public boolean shouldSkipPhase(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result) {
for (Modifier modifier : _modifiers)
result = modifier.shouldSkipPhase(gameState, modifiersQuerying, phase, result);
return result;
}
}

View File

@@ -40,4 +40,6 @@ public interface Modifier {
public boolean addsToArcheryTotal(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result);
public boolean canPlayPhaseActions(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result);
public boolean shouldSkipPhase(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, boolean result);
}

View File

@@ -231,6 +231,14 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
return result;
}
@Override
public boolean shouldSkipPhase(GameState gameState, Phase phase) {
boolean result = false;
for (Modifier modifier : _modifiers)
result = modifier.shouldSkipPhase(gameState, this, phase, result);
return result;
}
private class ModifierHookImpl implements ModifierHook {
private Modifier _modifier;

View File

@@ -36,4 +36,6 @@ public interface ModifiersQuerying {
public boolean addsToArcheryTotal(GameState gameState, PhysicalCard card);
public boolean canPlayPhaseActions(GameState gameState, Phase phase);
public boolean shouldSkipPhase(GameState gameState, Phase phase);
}

View File

@@ -25,6 +25,9 @@ public class ArcheryGameProcess implements GameProcess {
@Override
public GameProcess getNextProcess() {
if (_game.getModifiersQuerying().shouldSkipPhase(_game.getGameState(), Phase.ARCHERY))
new CanSpotGameProcess(_game, Filters.type(CardType.MINION), new AssignmentGameProcess(_game), new RegroupGameProcess(_game));
return new StartOfPhaseGameProcess(_game, Phase.ARCHERY,
new PlayersPlayPhaseActionsInOrderGameProcess(_game, _game.getGameState().getPlayerOrder().getCounterClockwisePlayOrder(_game.getGameState().getCurrentPlayerId(), true), 0,
new ArcheryFireGameProcess(_game,