"City of Men"
This commit is contained in:
@@ -245,6 +245,11 @@ public class PlayConditions {
|
||||
&& game.getGameState().getCurrentPhase() == phase);
|
||||
}
|
||||
|
||||
public static boolean endOfPhase(LotroGame game, EffectResult effectResult, Phase phase) {
|
||||
return (effectResult.getType() == EffectResult.Type.END_OF_PHASE
|
||||
&& game.getGameState().getCurrentPhase() == phase);
|
||||
}
|
||||
|
||||
public static boolean canExert(PhysicalCard source, GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card) {
|
||||
return canExert(source, gameState, modifiersQuerying, Filters.sameCard(card));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.gempukku.lotro.cards.set7.gollum;
|
||||
import com.gempukku.lotro.cards.AbstractEvent;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfTurnActionProxyEffect;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseActionProxyEffect;
|
||||
import com.gempukku.lotro.cards.effects.PlaySiteEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDiscardEffect;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
@@ -51,7 +51,7 @@ public class Card7_076 extends AbstractEvent {
|
||||
new PlaySiteEffect(playerId, null, game.getGameState().getCurrentSiteNumber() + 1));
|
||||
final int moveCount = game.getGameState().getMoveCount();
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfTurnActionProxyEffect(
|
||||
new AddUntilEndOfPhaseActionProxyEffect(
|
||||
new AbstractActionProxy() {
|
||||
@Override
|
||||
public List<? extends Action> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult) {
|
||||
@@ -65,7 +65,7 @@ public class Card7_076 extends AbstractEvent {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
}, Phase.REGROUP));
|
||||
return action;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.gempukku.lotro.cards.set7.gondor;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractEvent;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseActionProxyEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.AbstractActionProxy;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
|
||||
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: The Return of the King
|
||||
* Side: Free
|
||||
* Culture: Gondor
|
||||
* Twilight Cost: 1
|
||||
* Type: Event • Skirmish
|
||||
* Game Text: Make a [GONDOR] Man strength +2. If that Man is skirmishing a [SAURON] minion, discard that minion
|
||||
* at the end of the skirmish.
|
||||
*/
|
||||
public class Card7_083 extends AbstractEvent {
|
||||
public Card7_083() {
|
||||
super(Side.FREE_PEOPLE, 1, Culture.GONDOR, "City of Men", Phase.SKIRMISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayEventAction getPlayCardAction(final String playerId, LotroGame game, final PhysicalCard self, int twilightModifier) {
|
||||
final PlayEventAction action = new PlayEventAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(self, playerId, "Choose a GONDOR Man", Culture.GONDOR, Race.MAN) {
|
||||
@Override
|
||||
protected void cardSelected(LotroGame game, final PhysicalCard card) {
|
||||
game.getModifiersEnvironment().addUntilEndOfPhaseModifier(
|
||||
new StrengthModifier(self, card, 2), Phase.SKIRMISH);
|
||||
if (Filters.inSkirmishAgainst(Culture.SAURON, CardType.MINION).accepts(game.getGameState(), game.getModifiersQuerying(), card)) {
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfPhaseActionProxyEffect(
|
||||
new AbstractActionProxy() {
|
||||
@Override
|
||||
public List<? extends Action> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult) {
|
||||
if (PlayConditions.endOfPhase(game, effectResult, Phase.SKIRMISH)) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Culture.SAURON, CardType.MINION, Filters.inSkirmishAgainst(card)));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, Phase.SKIRMISH));
|
||||
}
|
||||
}
|
||||
});
|
||||
return action;
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,6 @@ public class RuleSet {
|
||||
}
|
||||
|
||||
public void applyRuleSet() {
|
||||
new EndEffectsAndActionsRule(_actionsEnvironment, _modifiersLogic).applyRule();
|
||||
|
||||
new RoamingRule(_modifiersLogic).applyRule();
|
||||
new EnduringRule(_modifiersLogic).applyRule();
|
||||
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
package com.gempukku.lotro.logic.timing.processes.turn;
|
||||
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.game.state.actions.DefaultActionsEnvironment;
|
||||
import com.gempukku.lotro.logic.actions.SystemQueueAction;
|
||||
import com.gempukku.lotro.logic.effects.TriggeringResultEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersLogic;
|
||||
import com.gempukku.lotro.logic.timing.AbstractSuccessfulEffect;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.actions.SimpleEffectAction;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.processes.GameProcess;
|
||||
import com.gempukku.lotro.logic.timing.results.EndOfTurnResult;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class EndOfTurnGameProcess implements GameProcess {
|
||||
private LotroGame _game;
|
||||
|
||||
@@ -16,7 +22,34 @@ public class EndOfTurnGameProcess implements GameProcess {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
_game.getActionsEnvironment().addActionToStack(new SimpleEffectAction(new TriggeringResultEffect(Effect.Type.END_OF_TURN, new EndOfTurnResult(), "End of turn"), "End of turn"));
|
||||
SystemQueueAction action = new SystemQueueAction() {
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "End of turn";
|
||||
}
|
||||
};
|
||||
action.appendEffect(
|
||||
new TriggeringResultEffect(Effect.Type.END_OF_TURN, new EndOfTurnResult(), "End of turn"));
|
||||
action.appendEffect(
|
||||
new AbstractSuccessfulEffect() {
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends EffectResult> playEffect(LotroGame game) {
|
||||
((ModifiersLogic) game.getModifiersEnvironment()).removeEndOfTurn();
|
||||
((DefaultActionsEnvironment) game.getActionsEnvironment()).removeEndOfTurnActionProxies();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
_game.getActionsEnvironment().addActionToStack(action);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,12 +2,18 @@ package com.gempukku.lotro.logic.timing.processes.turn.general;
|
||||
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.game.state.actions.DefaultActionsEnvironment;
|
||||
import com.gempukku.lotro.logic.actions.SystemQueueAction;
|
||||
import com.gempukku.lotro.logic.effects.TriggeringResultEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersLogic;
|
||||
import com.gempukku.lotro.logic.timing.AbstractSuccessfulEffect;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.actions.SimpleEffectAction;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.processes.GameProcess;
|
||||
import com.gempukku.lotro.logic.timing.results.EndOfPhaseResult;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class EndOfPhaseGameProcess implements GameProcess {
|
||||
private LotroGame _game;
|
||||
private Phase _phase;
|
||||
@@ -21,7 +27,34 @@ public class EndOfPhaseGameProcess implements GameProcess {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
_game.getActionsEnvironment().addActionToStack(new SimpleEffectAction(new TriggeringResultEffect(Effect.Type.END_OF_PHASE, new EndOfPhaseResult(_phase), "End of " + _phase + " phase"), "End of " + _phase + " phase"));
|
||||
SystemQueueAction action = new SystemQueueAction() {
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "End of " + _phase + " phase";
|
||||
}
|
||||
};
|
||||
action.appendEffect(
|
||||
new TriggeringResultEffect(Effect.Type.END_OF_PHASE, new EndOfPhaseResult(_phase), "End of " + _phase + " phase"));
|
||||
action.appendEffect(
|
||||
new AbstractSuccessfulEffect() {
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends EffectResult> playEffect(LotroGame game) {
|
||||
((ModifiersLogic) game.getModifiersEnvironment()).removeEndOfPhase(_phase);
|
||||
((DefaultActionsEnvironment) game.getActionsEnvironment()).removeEndOfPhaseActionProxies(_phase);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
_game.getActionsEnvironment().addActionToStack(action);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,12 +2,18 @@ package com.gempukku.lotro.logic.timing.processes.turn.general;
|
||||
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.game.state.actions.DefaultActionsEnvironment;
|
||||
import com.gempukku.lotro.logic.actions.SystemQueueAction;
|
||||
import com.gempukku.lotro.logic.effects.TriggeringResultEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersLogic;
|
||||
import com.gempukku.lotro.logic.timing.AbstractSuccessfulEffect;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.actions.SimpleEffectAction;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.processes.GameProcess;
|
||||
import com.gempukku.lotro.logic.timing.results.StartOfPhaseResult;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class StartOfPhaseGameProcess implements GameProcess {
|
||||
private LotroGame _game;
|
||||
private Phase _phase;
|
||||
@@ -22,7 +28,35 @@ public class StartOfPhaseGameProcess implements GameProcess {
|
||||
@Override
|
||||
public void process() {
|
||||
_game.getGameState().setCurrentPhase(_phase);
|
||||
_game.getActionsEnvironment().addActionToStack(new SimpleEffectAction(new TriggeringResultEffect(Effect.Type.START_OF_PHASE, new StartOfPhaseResult(_phase), "Start of " + _phase + " phase"), "Start of " + _phase + " phase"));
|
||||
SystemQueueAction action = new SystemQueueAction() {
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Start of " + _phase + " phase";
|
||||
}
|
||||
};
|
||||
action.appendEffect(
|
||||
new AbstractSuccessfulEffect() {
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends EffectResult> playEffect(LotroGame game) {
|
||||
((ModifiersLogic) game.getModifiersEnvironment()).removeStartOfPhase(_phase);
|
||||
((DefaultActionsEnvironment) game.getActionsEnvironment()).removeStartOfPhaseActionProxies(_phase);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
action.appendEffect(
|
||||
new TriggeringResultEffect(Effect.Type.START_OF_PHASE, new StartOfPhaseResult(_phase), "Start of " + _phase + " phase"));
|
||||
|
||||
_game.getActionsEnvironment().addActionToStack(action);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
package com.gempukku.lotro.logic.timing.rules;
|
||||
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.game.AbstractActionProxy;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.game.state.actions.DefaultActionsEnvironment;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersLogic;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
import com.gempukku.lotro.logic.timing.actions.SimpleEffectAction;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class EndEffectsAndActionsRule {
|
||||
private DefaultActionsEnvironment _actionsEnvironment;
|
||||
private ModifiersLogic _modifiersLogic;
|
||||
|
||||
public EndEffectsAndActionsRule(DefaultActionsEnvironment actionsEnvironment, ModifiersLogic modifiersLogic) {
|
||||
_actionsEnvironment = actionsEnvironment;
|
||||
_modifiersLogic = modifiersLogic;
|
||||
}
|
||||
|
||||
public void applyRule() {
|
||||
_actionsEnvironment.addAlwaysOnActionProxy(
|
||||
new AbstractActionProxy() {
|
||||
@Override
|
||||
public List<? extends Action> getRequiredBeforeTriggers(LotroGame game, Effect effect) {
|
||||
if (effect.getType() == Effect.Type.START_OF_PHASE)
|
||||
return Collections.<Action>singletonList(new SimpleEffectAction(
|
||||
new UnrespondableEffect() {
|
||||
@Override
|
||||
public void doPlayEffect(LotroGame game) {
|
||||
Phase phase = game.getGameState().getCurrentPhase();
|
||||
_modifiersLogic.removeStartOfPhase(phase);
|
||||
_actionsEnvironment.removeStartOfPhaseActionProxies(phase);
|
||||
}
|
||||
}, "Remove effects"
|
||||
));
|
||||
else if (effect.getType() == Effect.Type.END_OF_PHASE)
|
||||
return Collections.<Action>singletonList(new SimpleEffectAction(
|
||||
new UnrespondableEffect() {
|
||||
@Override
|
||||
public void doPlayEffect(LotroGame game) {
|
||||
Phase phase = game.getGameState().getCurrentPhase();
|
||||
_modifiersLogic.removeEndOfPhase(phase);
|
||||
_actionsEnvironment.removeEndOfPhaseActionProxies(phase);
|
||||
}
|
||||
}, "Remove effects"
|
||||
));
|
||||
else if (effect.getType() == Effect.Type.END_OF_TURN)
|
||||
return Collections.<Action>singletonList(new SimpleEffectAction(
|
||||
new UnrespondableEffect() {
|
||||
@Override
|
||||
public void doPlayEffect(LotroGame game) {
|
||||
_modifiersLogic.removeEndOfTurn();
|
||||
_actionsEnvironment.removeEndOfTurnActionProxies();
|
||||
}
|
||||
}, "Remove effects"
|
||||
));
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user