"Covering Fire"

This commit is contained in:
marcins78@gmail.com
2011-10-10 12:54:47 +00:00
parent d7e2305b3c
commit d13f3ab4a1
16 changed files with 94 additions and 20 deletions

View File

@@ -64,7 +64,7 @@ public class Card1_138 extends AbstractAttachable {
public Modifier getAlwaysOnModifier(final PhysicalCard self) {
return new AbstractModifier(self, "Can't play Skirmish actions", null, new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
@Override
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result) {
PhysicalCard actionSource = action.getActionSource();
if ((action.getType() == Keyword.SKIRMISH
|| (actionSource != null && actionSource.getBlueprint().getCardType() == CardType.EVENT && modifiersQuerying.hasKeyword(gameState, actionSource, Keyword.SKIRMISH)))

View File

@@ -29,7 +29,7 @@ public class Card1_329 extends AbstractSite {
public Modifier getAlwaysOnModifier(PhysicalCard self) {
return new AbstractModifier(self, "Stealth events may not be played", null, new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
@Override
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result) {
PhysicalCard actionSourceCard = action.getActionSource();
if (actionSourceCard != null && actionSourceCard.getBlueprint().getCardType() == CardType.EVENT && modifiersQuerying.hasKeyword(gameState, actionSourceCard, Keyword.STEALTH))
return false;

View File

@@ -89,7 +89,7 @@ public class Card1_363 extends AbstractSite {
new AddUntilEndOfPhaseModifierEffect(
new AbstractModifier(null, "End Shadow Phase", null, new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
@Override
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result) {
return false;
}
}, Phase.SHADOW
@@ -99,7 +99,7 @@ public class Card1_363 extends AbstractSite {
new AddUntilEndOfPhaseModifierEffect(
new AbstractModifier(null, "End Shadow Phase", null, new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
@Override
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result) {
return false;
}
}, Phase.SHADOW

View File

@@ -49,7 +49,7 @@ public class Card2_076 extends AbstractAttachable {
return Collections.singletonList(
new AbstractModifier(self, "Sam's game text does not apply", Filters.name("Sam"), new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
@Override
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result) {
PhysicalCard actionSource = action.getActionSource();
if (actionSource != null
&& actionSource.getBlueprint().getName().equals("Sam"))

View File

@@ -45,7 +45,7 @@ public class Card2_085 extends AbstractMinion {
return Collections.singletonList(
new AbstractModifier(self, "Return to Its Master may not be played", Filters.name("Return to Its Master"), new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
@Override
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result) {
PhysicalCard actionSource = action.getActionSource();
if (actionSource != null && actionSource.getBlueprint().getName().equals("Return to Its Master"))
return false;

View File

@@ -40,7 +40,7 @@ public class Card3_061 extends AbstractMinion {
return Collections.singletonList(
new AbstractModifier(self, "While you can spot another [ISENGARD] Orc, no player may use archery special abilities.", null, new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
@Override
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result) {
if (Filters.canSpot(gameState, modifiersQuerying, Filters.not(Filters.sameCard(self)), Filters.culture(Culture.ISENGARD), Filters.race(Race.ORC))) {
PhysicalCard actionSource = action.getActionSource();
if (actionSource != null

View File

@@ -33,7 +33,7 @@ public class Card3_117 extends AbstractSite {
return Collections.singletonList(
new AbstractModifier(self, "Maneuver events may not be played", null, new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
@Override
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result) {
PhysicalCard source = action.getActionSource();
if (source != null && source.getBlueprint().getCardType() == CardType.EVENT
&& modifiersQuerying.hasKeyword(gameState, source, Keyword.MANEUVER))

View File

@@ -34,7 +34,7 @@ public class Card3_118 extends AbstractSite {
return Collections.singletonList(
new AbstractModifier(self, "Cards may not be played from draw decks or discard piles", null, new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
@Override
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result) {
PhysicalCard source = action.getActionSource();
if (source != null && (source.getZone() == Zone.DECK || source.getZone() == Zone.DISCARD))
return false;

View File

@@ -39,10 +39,10 @@ public class Card4_117 extends AbstractCompanion {
return Collections.singletonList(
new AbstractModifier(self, "Can't play skimirhs events or skirmish special abilities", null, new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
@Override
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result) {
if (!Filters.inSkirmish().accepts(gameState, modifiersQuerying, self))
return result;
if (action.getActionSource() != null && action.getActionSource().getBlueprint().getSide() != Side.SHADOW)
if (performingPlayer != null && performingPlayer.equals(self.getOwner()))
return result;
if (action.getType() == Keyword.SKIRMISH)
return false;

View File

@@ -0,0 +1,74 @@
package com.gempukku.lotro.cards.set4.isengard;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.common.*;
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.RequiredTriggerAction;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.ModifierEffect;
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 Two Towers
* Side: Shadow
* Culture: Isengard
* Twilight Cost: 0
* Type: Condition
* Game Text: To play, spot 2 [ISENGARD] archers. Plays to your support area. The Free Peoples player may not play
* archery events or use archery special abilities. Discard this condition during the regroup phase.
*/
public class Card4_147 extends AbstractPermanent {
public Card4_147() {
super(Side.SHADOW, 0, CardType.CONDITION, Culture.ISENGARD, Zone.SUPPORT, "Covering Fire");
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return super.checkPlayRequirements(playerId, game, self, twilightModifier)
&& PlayConditions.canSpot(game, 2, Filters.culture(Culture.ISENGARD), Filters.keyword(Keyword.ARCHER));
}
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (game.getGameState().getCurrentPhase() == Phase.REGROUP) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new DiscardCardsFromPlayEffect(self, self));
return Collections.singletonList(action);
}
return null;
}
@Override
public List<? extends Modifier> getAlwaysOnModifiers(PhysicalCard self) {
return Collections.singletonList(
new AbstractModifier(self, null, null, new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
@Override
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result) {
if (!performingPlayer.equals(gameState.getCurrentPlayerId()))
return result;
if (gameState.getCurrentPhase() != Phase.ARCHERY)
return result;
if (action.getType() == Keyword.ARCHERY)
return false;
final PhysicalCard actionSource = action.getActionSource();
if (actionSource != null && actionSource.getBlueprint().getCardType() == CardType.EVENT && modifiersQuerying.hasKeyword(gameState, actionSource, Keyword.ARCHERY))
return false;
return result;
}
}
)
}
}

View File

@@ -146,7 +146,7 @@ public abstract class AbstractModifier implements Modifier {
}
@Override
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result) {
return result;
}

View File

@@ -60,7 +60,7 @@ public interface Modifier {
public boolean addsToArcheryTotal(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result);
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result);
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, Action action, boolean result);
public boolean canHavePlayedOn(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard playedCard, PhysicalCard target);

View File

@@ -358,10 +358,10 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
}
@Override
public boolean canPlayAction(GameState gameState, Action action) {
public boolean canPlayAction(GameState gameState, String performingPlayer, Action action) {
boolean result = true;
for (Modifier modifier : getModifiers(ModifierEffect.ACTION_MODIFIER))
result = modifier.canPlayAction(gameState, this, action, result);
result = modifier.canPlayAction(gameState, this, performingPlayer, action, result);
return result;
}

View File

@@ -63,7 +63,7 @@ public interface ModifiersQuerying {
public boolean isValidAssignments(GameState gameState, Side side, Map<PhysicalCard, List<PhysicalCard>> assignments);
// Playing actions
public boolean canPlayAction(GameState gameState, Action action);
public boolean canPlayAction(GameState gameState, String performingPlayer, Action action);
public boolean canHavePlayedOn(GameState gameState, PhysicalCard playedCard, PhysicalCard target);

View File

@@ -35,11 +35,11 @@ public class PlayerPlaysPhaseActionsUntilPassesGameProcess implements GameProces
List<Action> playableActions = new LinkedList<Action>();
for (Action action : visitor.getActions())
if (_game.getModifiersQuerying().canPlayAction(_game.getGameState(), action))
if (_game.getModifiersQuerying().canPlayAction(_game.getGameState(), _playerId, action))
playableActions.add(action);
for (Action action : stackedVisitor.getActions())
if (_game.getModifiersQuerying().canPlayAction(_game.getGameState(), action))
if (_game.getModifiersQuerying().canPlayAction(_game.getGameState(), _playerId, action))
playableActions.add(action);
_game.getUserFeedback().sendAwaitingDecision(_playerId,

View File

@@ -50,11 +50,11 @@ public class PlayersPlayPhaseActionsInOrderGameProcess implements GameProcess {
List<Action> playableActions = new LinkedList<Action>();
for (Action action : actions)
if (_game.getModifiersQuerying().canPlayAction(_game.getGameState(), action))
if (_game.getModifiersQuerying().canPlayAction(_game.getGameState(), playerId, action))
playableActions.add(action);
for (Action action : stackedVisitor.getActions())
if (_game.getModifiersQuerying().canPlayAction(_game.getGameState(), action))
if (_game.getModifiersQuerying().canPlayAction(_game.getGameState(), playerId, action))
playableActions.add(action);
_game.getUserFeedback().sendAwaitingDecision(playerId,