"No Retreat"

This commit is contained in:
marcins78@gmail.com
2011-10-06 08:51:13 +00:00
parent b4f6325fcf
commit 2cbabf7f69
7 changed files with 105 additions and 13 deletions

View File

@@ -0,0 +1,16 @@
package com.gempukku.lotro.cards.modifiers;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
import com.gempukku.lotro.logic.modifiers.ModifierEffect;
public class HasToMoveIfPossibleModifier extends AbstractModifier {
public HasToMoveIfPossibleModifier(PhysicalCard source) {
super(source, "Has to move if possible", null, new ModifierEffect[]{ModifierEffect.MOVE_LIMIT_MODIFIER});
}
@Override
public boolean hasToMoveIfPossible() {
return true;
}
}

View File

@@ -0,0 +1,52 @@
package com.gempukku.lotro.cards.set4.dunland;
import com.gempukku.lotro.cards.AbstractAttachable;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.cards.modifiers.HasToMoveIfPossibleModifier;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filter;
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.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: The Two Towers
* Side: Shadow
* Culture: Dunland
* Twilight Cost: 0
* Type: Condition
* Game Text: Plays on a site you control. Regroup: Spot 2 [DUNLAND] Men and discard this condition to make
* the Free Peoples player choose to move again this turn (if the move limit allows).
*/
public class Card4_030 extends AbstractAttachable {
public Card4_030() {
super(Side.SHADOW, CardType.CONDITION, 0, Culture.DUNLAND, null, "No Retreat");
}
@Override
protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.siteControlled(playerId);
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.REGROUP, self, 0)
&& Filters.countSpottable(game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN)) >= 2) {
ActivateCardAction action = new ActivateCardAction(self, Keyword.REGROUP);
action.appendCost(
new DiscardCardsFromPlayEffect(self, self));
action.appendEffect(
new AddUntilEndOfPhaseModifierEffect(
new HasToMoveIfPossibleModifier(self), Phase.REGROUP));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -184,4 +184,9 @@ public abstract class AbstractModifier implements Modifier {
public int getSpotCount(GameState gameState, ModifiersQuerying modifiersQuerying, Filter filter, int result) {
return result;
}
@Override
public boolean hasToMoveIfPossible() {
return false;
}
}

View File

@@ -73,4 +73,6 @@ public interface Modifier {
public boolean canLookOrRevealCardsInHand(GameState gameState, ModifiersQuerying modifiersQuerying, String playerId);
public int getSpotCount(GameState gameState, ModifiersQuerying modifiersQuerying, Filter filter, int result);
public boolean hasToMoveIfPossible();
}

View File

@@ -434,6 +434,15 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
return Math.max(0, result);
}
@Override
public boolean hasToMoveIfPossible() {
for (Modifier modifier : getModifiers(ModifierEffect.MOVE_LIMIT_MODIFIER))
if (modifier.hasToMoveIfPossible())
return true;
return false;
}
private class ModifierHookImpl implements ModifierHook {
private Modifier _modifier;

View File

@@ -62,4 +62,6 @@ public interface ModifiersQuerying {
public boolean canLookOrRevealCardsInHand(GameState gameState, String playerId);
public int getSpotCount(GameState gameState, Filter filter, int inPlayCount);
public boolean hasToMoveIfPossible();
}

View File

@@ -22,20 +22,26 @@ public class FellowshipPlayerChoosesToMoveOrStayGameProcess implements GameProce
public void process() {
final GameState gameState = _game.getGameState();
if (gameState.getMoveCount() < _game.getModifiersQuerying().getMoveLimit(gameState, 2)) {
_game.getUserFeedback().sendAwaitingDecision(gameState.getCurrentPlayerId(),
new MultipleChoiceAwaitingDecision(1, "Do you want to make another move?", new String[]{"Yes", "No"}) {
@Override
protected void validDecisionMade(int index, String result) {
if (result.equals("Yes"))
_nextProcess = new MovementGameProcess(_game,
new EndOfPhaseGameProcess(_game, Phase.REGROUP,
new ShadowPhasesGameProcess(_game)));
else {
_nextProcess = new PlayerReconcilesGameProcess(_game, gameState.getCurrentPlayerId(),
new DiscardAllMinionsGameProcess(_game));
if (_game.getModifiersQuerying().hasToMoveIfPossible()) {
_nextProcess = new MovementGameProcess(_game,
new EndOfPhaseGameProcess(_game, Phase.REGROUP,
new ShadowPhasesGameProcess(_game)));
} else {
_game.getUserFeedback().sendAwaitingDecision(gameState.getCurrentPlayerId(),
new MultipleChoiceAwaitingDecision(1, "Do you want to make another move?", new String[]{"Yes", "No"}) {
@Override
protected void validDecisionMade(int index, String result) {
if (result.equals("Yes"))
_nextProcess = new MovementGameProcess(_game,
new EndOfPhaseGameProcess(_game, Phase.REGROUP,
new ShadowPhasesGameProcess(_game)));
else {
_nextProcess = new PlayerReconcilesGameProcess(_game, gameState.getCurrentPlayerId(),
new DiscardAllMinionsGameProcess(_game));
}
}
}
});
});
}
} else {
_nextProcess = new PlayerReconcilesGameProcess(_game, gameState.getCurrentPlayerId(),
new DiscardAllMinionsGameProcess(_game));