"No Retreat"
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -184,4 +184,9 @@ public abstract class AbstractModifier implements Modifier {
|
|||||||
public int getSpotCount(GameState gameState, ModifiersQuerying modifiersQuerying, Filter filter, int result) {
|
public int getSpotCount(GameState gameState, ModifiersQuerying modifiersQuerying, Filter filter, int result) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasToMoveIfPossible() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,4 +73,6 @@ public interface Modifier {
|
|||||||
public boolean canLookOrRevealCardsInHand(GameState gameState, ModifiersQuerying modifiersQuerying, String playerId);
|
public boolean canLookOrRevealCardsInHand(GameState gameState, ModifiersQuerying modifiersQuerying, String playerId);
|
||||||
|
|
||||||
public int getSpotCount(GameState gameState, ModifiersQuerying modifiersQuerying, Filter filter, int result);
|
public int getSpotCount(GameState gameState, ModifiersQuerying modifiersQuerying, Filter filter, int result);
|
||||||
|
|
||||||
|
public boolean hasToMoveIfPossible();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -434,6 +434,15 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
|||||||
return Math.max(0, result);
|
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 class ModifierHookImpl implements ModifierHook {
|
||||||
private Modifier _modifier;
|
private Modifier _modifier;
|
||||||
|
|
||||||
|
|||||||
@@ -62,4 +62,6 @@ public interface ModifiersQuerying {
|
|||||||
public boolean canLookOrRevealCardsInHand(GameState gameState, String playerId);
|
public boolean canLookOrRevealCardsInHand(GameState gameState, String playerId);
|
||||||
|
|
||||||
public int getSpotCount(GameState gameState, Filter filter, int inPlayCount);
|
public int getSpotCount(GameState gameState, Filter filter, int inPlayCount);
|
||||||
|
|
||||||
|
public boolean hasToMoveIfPossible();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,20 +22,26 @@ public class FellowshipPlayerChoosesToMoveOrStayGameProcess implements GameProce
|
|||||||
public void process() {
|
public void process() {
|
||||||
final GameState gameState = _game.getGameState();
|
final GameState gameState = _game.getGameState();
|
||||||
if (gameState.getMoveCount() < _game.getModifiersQuerying().getMoveLimit(gameState, 2)) {
|
if (gameState.getMoveCount() < _game.getModifiersQuerying().getMoveLimit(gameState, 2)) {
|
||||||
_game.getUserFeedback().sendAwaitingDecision(gameState.getCurrentPlayerId(),
|
if (_game.getModifiersQuerying().hasToMoveIfPossible()) {
|
||||||
new MultipleChoiceAwaitingDecision(1, "Do you want to make another move?", new String[]{"Yes", "No"}) {
|
_nextProcess = new MovementGameProcess(_game,
|
||||||
@Override
|
new EndOfPhaseGameProcess(_game, Phase.REGROUP,
|
||||||
protected void validDecisionMade(int index, String result) {
|
new ShadowPhasesGameProcess(_game)));
|
||||||
if (result.equals("Yes"))
|
} else {
|
||||||
_nextProcess = new MovementGameProcess(_game,
|
_game.getUserFeedback().sendAwaitingDecision(gameState.getCurrentPlayerId(),
|
||||||
new EndOfPhaseGameProcess(_game, Phase.REGROUP,
|
new MultipleChoiceAwaitingDecision(1, "Do you want to make another move?", new String[]{"Yes", "No"}) {
|
||||||
new ShadowPhasesGameProcess(_game)));
|
@Override
|
||||||
else {
|
protected void validDecisionMade(int index, String result) {
|
||||||
_nextProcess = new PlayerReconcilesGameProcess(_game, gameState.getCurrentPlayerId(),
|
if (result.equals("Yes"))
|
||||||
new DiscardAllMinionsGameProcess(_game));
|
_nextProcess = new MovementGameProcess(_game,
|
||||||
|
new EndOfPhaseGameProcess(_game, Phase.REGROUP,
|
||||||
|
new ShadowPhasesGameProcess(_game)));
|
||||||
|
else {
|
||||||
|
_nextProcess = new PlayerReconcilesGameProcess(_game, gameState.getCurrentPlayerId(),
|
||||||
|
new DiscardAllMinionsGameProcess(_game));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
} else {
|
} else {
|
||||||
_nextProcess = new PlayerReconcilesGameProcess(_game, gameState.getCurrentPlayerId(),
|
_nextProcess = new PlayerReconcilesGameProcess(_game, gameState.getCurrentPlayerId(),
|
||||||
new DiscardAllMinionsGameProcess(_game));
|
new DiscardAllMinionsGameProcess(_game));
|
||||||
|
|||||||
Reference in New Issue
Block a user