"Return to Its Master"

This commit is contained in:
marcins78@gmail.com
2011-09-10 00:24:40 +00:00
parent ffc48a755a
commit 473ffc3873
4 changed files with 97 additions and 1 deletions

View File

@@ -97,6 +97,7 @@ public class Card1_001 extends AbstractLotroCardBlueprint {
public List<? extends Action> getRequiredBeforeTriggers(LotroGame game, Effect effect, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.WOUND
&& game.getGameState().isWearingRing()
&& !game.getGameState().isCancelRingText()
&& ((WoundResult) effectResult).getWoundedCard() == self.getAttachedTo()) {
List<Action> actions = new LinkedList<Action>();
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, null, "Add 2 burdens instead of taking a wound");

View File

@@ -95,6 +95,7 @@ public class Card1_002 extends AbstractLotroCardBlueprint {
public List<? extends Action> getRequiredBeforeTriggers(LotroGame game, Effect effect, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.WOUND
&& game.getGameState().isWearingRing()
&& !game.getGameState().isCancelRingText()
&& ((WoundResult) effectResult).getWoundedCard() == self.getAttachedTo()) {
List<Action> actions = new LinkedList<Action>();
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, null, "Add a burden instead of taking a wound");

View File

@@ -0,0 +1,85 @@
package com.gempukku.lotro.cards.set1.wraith;
import com.gempukku.lotro.cards.AbstractResponseEvent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Side;
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.game.state.Skirmish;
import com.gempukku.lotro.logic.actions.DefaultCostToEffectAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* Set: The Fellowship of the Ring
* Side: Shadow
* Culture: Wraith
* Twilight Cost: 0
* Type: Event
* Game Text: Response: If the Ring-bearer wears The One Ring at the end of a skirmish phase, cancel all remaining
* assignments and assign a Nazgul to skirmish the Ring-bearer; The One Ring's game text does not apply during this skirmish.
*/
public class Card1_224 extends AbstractResponseEvent {
public Card1_224() {
super(Side.SHADOW, Culture.WRAITH, "Return to Its Master");
}
@Override
public List<? extends Action> getOptionalAfterActions(final String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.END_OF_PHASE
&& game.getGameState().getCurrentPhase() == Phase.SKIRMISH
&& game.getGameState().isWearingRing()
&& PlayConditions.canPayForShadowCard(game, self, 0)) {
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, null, "Cancel all remaining " +
"assignments and assign a Nazgul to skirmish the Ring-bearer; The One Ring's game text does not " +
"apply during this skirmish.");
action.addEffect(
new UnrespondableEffect() {
@Override
public void playEffect(final LotroGame game) {
List<Skirmish> assignments = new LinkedList<Skirmish>(game.getGameState().getAssignments());
for (Skirmish assignment : assignments)
game.getGameState().removeAssignment(assignment);
action.addEffect(
new ChooseActiveCardEffect(playerId, "Choose a Nazgul to skirmish the Ring-Bearer", Filters.keyword(Keyword.NAZGUL)) {
@Override
protected void cardSelected(PhysicalCard nazgul) {
PhysicalCard ringBearer = game.getGameState().getRingBearer(game.getGameState().getCurrentPlayerId());
game.getGameState().assignToSkirmishes(ringBearer, Collections.singletonList(nazgul));
game.getGameState().setCancelRingText(true);
game.getActionsEnvironment().addUntilStartOfPhaseActionProxy(
new AbstractActionProxy() {
@Override
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
if (effectResult.getType() == EffectResult.Type.END_OF_PHASE
&& lotroGame.getGameState().getCurrentPhase() == Phase.SKIRMISH)
game.getGameState().setCancelRingText(false);
return null;
}
}, Phase.REGROUP);
}
});
}
});
return Collections.singletonList(action);
}
return null;
}
@Override
public int getTwilightCost() {
return 0;
}
}

View File

@@ -27,6 +27,7 @@ public class GameState {
private int _moveCount;
private boolean _fierceSkirmishes;
private boolean _wearingRing;
private boolean _cancelRingText;
private Map<String, Integer> _playerPosition = new HashMap<String, Integer>();
private Map<PhysicalCard, Map<Token, Integer>> _cardTokens = new HashMap<PhysicalCard, Map<Token, Integer>>();
@@ -98,6 +99,14 @@ public class GameState {
return _wearingRing;
}
public void setCancelRingText(boolean cancelRingText) {
_cancelRingText = cancelRingText;
}
public boolean isCancelRingText() {
return _cancelRingText;
}
public PlayerOrder getPlayerOrder() {
return _playerOrder;
}
@@ -598,7 +607,7 @@ public class GameState {
listener.addAssignment(fp, minions);
}
private void removeAssignment(Skirmish skirmish) {
public void removeAssignment(Skirmish skirmish) {
_assignments.remove(skirmish);
for (GameStateListener listener : getAllGameStateListeners())
listener.removeAssignment(skirmish.getFellowshipCharacter());