Putting played event on top or bottom of deck.

This commit is contained in:
marcins78@gmail.com
2011-11-21 21:59:22 +00:00
parent 60bbbcc4f1
commit 131a5bf022
7 changed files with 95 additions and 66 deletions

View File

@@ -0,0 +1,40 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.timing.AbstractEffect;
public class PutPlayedEventOnBottomOfDeckEffect extends AbstractEffect {
private PlayEventAction _action;
public PutPlayedEventOnBottomOfDeckEffect(PlayEventAction action) {
_action = action;
}
@Override
public String getText(LotroGame game) {
return "Put " + GameUtils.getCardLink(_action.getActionSource()) + " on bottom of your deck";
}
@Override
public Type getType() {
return null;
}
@Override
public boolean isPlayableInFull(LotroGame game) {
return true;
}
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
if (isPlayableInFull(game)) {
game.getGameState().sendMessage(_action.getPerformingPlayer() + " puts " + GameUtils.getCardLink(_action.getActionSource()) + " on bottom of his/her deck");
_action.skipDiscardPart();
game.getGameState().putCardOnBottomOfDeck(_action.getActionSource());
return new FullEffectResult(null, true, true);
}
return new FullEffectResult(null, false, false);
}
}

View File

@@ -0,0 +1,40 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.timing.AbstractEffect;
public class PutPlayedEventOnTopOfDeckEffect extends AbstractEffect {
private PlayEventAction _action;
public PutPlayedEventOnTopOfDeckEffect(PlayEventAction action) {
_action = action;
}
@Override
public String getText(LotroGame game) {
return "Put " + GameUtils.getCardLink(_action.getActionSource()) + " on top of your deck";
}
@Override
public Type getType() {
return null;
}
@Override
public boolean isPlayableInFull(LotroGame game) {
return true;
}
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
if (isPlayableInFull(game)) {
game.getGameState().sendMessage(_action.getPerformingPlayer() + " puts " + GameUtils.getCardLink(_action.getActionSource()) + " on top of his/her deck");
_action.skipDiscardPart();
game.getGameState().putCardOnTopOfDeck(_action.getActionSource());
return new FullEffectResult(null, true, true);
}
return new FullEffectResult(null, false, false);
}
}

View File

@@ -3,12 +3,12 @@ package com.gempukku.lotro.cards.set10.elven;
import com.gempukku.lotro.cards.AbstractEvent;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.OptionalEffect;
import com.gempukku.lotro.cards.effects.PutPlayedEventOnTopOfDeckEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndAddUntilEOPStrengthBonusEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
/**
* Set: Mount Doom
@@ -32,18 +32,7 @@ public class Card10_010 extends AbstractEvent {
if (Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), CardType.SITE, Zone.SUPPORT))
action.appendEffect(
new OptionalEffect(action, playerId,
new UnrespondableEffect() {
@Override
public String getText(LotroGame game) {
return "Place this event on top of your draw deck";
}
@Override
protected void doPlayEffect(LotroGame game) {
action.skipDiscardPart();
game.getGameState().putCardOnTopOfDeck(self);
}
}));
new PutPlayedEventOnTopOfDeckEffect(action)));
return action;
}
}

View File

@@ -2,9 +2,7 @@ package com.gempukku.lotro.cards.set6.dwarven;
import com.gempukku.lotro.cards.AbstractEvent;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.ChoiceEffect;
import com.gempukku.lotro.cards.effects.PutCardFromHandOnBottomOfDeckEffect;
import com.gempukku.lotro.cards.effects.PutCardFromHandOnTopOfDeckEffect;
import com.gempukku.lotro.cards.effects.*;
import com.gempukku.lotro.cards.effects.choose.ChooseCardsFromHandEffect;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
@@ -62,11 +60,12 @@ public class Card6_011 extends AbstractEvent {
new MultipleChoiceAwaitingDecision(1, "Where to put \"Toss Me\"?", new String[]{"Top of deck", "Bottom of deck"}) {
@Override
protected void validDecisionMade(int index, String result) {
action.skipDiscardPart();
if (index == 0)
game.getGameState().putCardOnTopOfDeck(self);
action.insertEffect(
new PutPlayedEventOnTopOfDeckEffect(action));
else
game.getGameState().putCardOnBottomOfDeck(self);
action.insertEffect(
new PutPlayedEventOnBottomOfDeckEffect(action));
}
}) {
@Override

View File

@@ -2,6 +2,8 @@ package com.gempukku.lotro.cards.set7.elven;
import com.gempukku.lotro.cards.AbstractEvent;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.OptionalEffect;
import com.gempukku.lotro.cards.effects.PutPlayedEventOnTopOfDeckEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndAddUntilEOPStrengthBonusEffect;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
@@ -9,8 +11,6 @@ import com.gempukku.lotro.common.Race;
import com.gempukku.lotro.common.Side;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.decisions.MultipleChoiceAwaitingDecision;
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
/**
* Set: The Return of the King
@@ -31,16 +31,8 @@ public class Card7_029 extends AbstractEvent {
action.appendEffect(
new ChooseAndAddUntilEOPStrengthBonusEffect(action, self, playerId, 2, Race.ELF));
action.appendEffect(
new PlayoutDecisionEffect(playerId,
new MultipleChoiceAwaitingDecision(1, "Do you want to place this even on top of your draw deck?", new String[]{"Yes", "No"}) {
@Override
protected void validDecisionMade(int index, String result) {
if (index == 0) {
action.skipDiscardPart();
game.getGameState().putCardOnTopOfDeck(self);
}
}
}));
new OptionalEffect(action, playerId,
new PutPlayedEventOnTopOfDeckEffect(action)));
return action;
}
}

View File

@@ -3,16 +3,14 @@ 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.PutPlayedEventOnBottomOfDeckEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndAddUntilEOPStrengthBonusEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.timing.AbstractSuccessfulEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -52,25 +50,7 @@ public class Card7_061 extends AbstractEvent {
&& checkPlayRequirements(playerId, game, self, 0, false)) {
final PlayEventAction playCardAction = getPlayCardAction(playerId, game, self, 0, false);
playCardAction.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) {
playCardAction.skipDiscardPart();
game.getGameState().putCardOnBottomOfDeck(self);
return null;
}
}
);
new PutPlayedEventOnBottomOfDeckEffect(playCardAction));
return Collections.singletonList(playCardAction);
}
return null;

View File

@@ -5,6 +5,7 @@ import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.cards.effects.OptionalEffect;
import com.gempukku.lotro.cards.effects.PutPlayedEventOnTopOfDeckEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
@@ -14,7 +15,6 @@ import com.gempukku.lotro.logic.decisions.IntegerAwaitingDecision;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
/**
* Set: Siege of Gondor
@@ -49,18 +49,7 @@ public class Card8_066 extends AbstractEvent {
if (PlayConditions.hasInitiative(game, Side.SHADOW))
action.appendEffect(
new OptionalEffect(action, playerId,
new UnrespondableEffect() {
@Override
public String getText(LotroGame game) {
return "Place this event on top of your draw deck";
}
@Override
protected void doPlayEffect(LotroGame game) {
action.skipDiscardPart();
game.getGameState().putCardOnTopOfDeck(self);
}
}));
new PutPlayedEventOnTopOfDeckEffect(action)));
}
};
spotDecision.setDefaultValue(count);