"Sent Back"

This commit is contained in:
marcins78@gmail.com
2011-11-20 01:41:41 +00:00
parent fb1ca66da2
commit a46d22484b
4 changed files with 145 additions and 20 deletions

View File

@@ -0,0 +1,82 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.timing.AbstractEffect;
import com.gempukku.lotro.logic.timing.results.DiscardCardsFromPlayResult;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class PutCharacterFromPlayInDeadPileEffect extends AbstractEffect {
private PhysicalCard _card;
public PutCharacterFromPlayInDeadPileEffect(PhysicalCard card) {
_card = card;
}
@Override
public String getText(LotroGame game) {
return null;
}
@Override
public Type getType() {
return null;
}
@Override
public boolean isPlayableInFull(LotroGame game) {
return _card.getZone() != null && _card.getZone().isInPlay();
}
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
if (isPlayableInFull(game)) {
GameState gameState = game.getGameState();
gameState.sendMessage(GameUtils.getCardLink(_card) + " is put into dead pile");
// For result
Set<PhysicalCard> discardedCards = new HashSet<PhysicalCard>();
// Prepare the moves
Set<PhysicalCard> toRemoveFromZone = new HashSet<PhysicalCard>();
Set<PhysicalCard> toAddToDeadPile = new HashSet<PhysicalCard>();
Set<PhysicalCard> toAddToDiscard = new HashSet<PhysicalCard>();
toRemoveFromZone.add(_card);
toAddToDeadPile.add(_card);
List<PhysicalCard> attachedCards = gameState.getAttachedCards(_card);
discardedCards.addAll(attachedCards);
toRemoveFromZone.addAll(attachedCards);
toAddToDiscard.addAll(attachedCards);
List<PhysicalCard> stackedCards = gameState.getStackedCards(_card);
toRemoveFromZone.addAll(stackedCards);
toAddToDiscard.addAll(stackedCards);
gameState.removeCardsFromZone(null, toRemoveFromZone);
for (PhysicalCard deadCard : toAddToDeadPile)
gameState.addCardToZone(game, deadCard, Zone.DEAD);
for (PhysicalCard discardedCard : toAddToDiscard)
gameState.addCardToZone(game, discardedCard, Zone.DISCARD);
if (discardedCards.size() > 0) {
return new FullEffectResult(Arrays.asList(new DiscardCardsFromPlayResult(discardedCards)), true, true);
} else {
return new FullEffectResult(null, true, true);
}
}
return new FullEffectResult(null, false, false);
}
}

View File

@@ -3,14 +3,12 @@ package com.gempukku.lotro.cards.set7.sauron;
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.PutCharacterFromPlayInDeadPileEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.RemoveThreatsEffect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Collections;
/**
* Set: The Return of the King
@@ -43,13 +41,7 @@ public class Card7_266 extends AbstractEvent {
@Override
protected void cardSelected(LotroGame game, final PhysicalCard card) {
action.insertEffect(
new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
game.getGameState().removeCardsFromZone(game.getGameState().getCurrentPlayerId(), Collections.singleton(card));
game.getGameState().addCardToZone(game, card, Zone.DEAD);
}
});
new PutCharacterFromPlayInDeadPileEffect(card));
}
});
return action;

View File

@@ -4,17 +4,19 @@ 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.PutCardFromDeckIntoHandOrDiscardEffect;
import com.gempukku.lotro.cards.effects.PutCharacterFromPlayInDeadPileEffect;
import com.gempukku.lotro.cards.effects.ShuffleDeckEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseArbitraryCardsEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Side;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Collection;
import java.util.Collections;
/**
* Set: Siege of Gondor
@@ -44,13 +46,7 @@ public class Card8_020 extends AbstractEvent {
@Override
protected void cardSelected(LotroGame game, final PhysicalCard card) {
action.insertCost(
new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
game.getGameState().removeCardsFromZone(playerId, Collections.singleton(card));
game.getGameState().addCardToZone(game, card, Zone.DEAD);
}
});
new PutCharacterFromPlayInDeadPileEffect(card));
action.appendEffect(
new ChooseArbitraryCardsEffect(playerId, "Choose cards to put in your hand", game.getGameState().getDeck(playerId), 0, 3) {
@Override

View File

@@ -0,0 +1,55 @@
package com.gempukku.lotro.cards.set9.gandalf;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.PutCharacterFromPlayInDeadPileEffect;
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.actions.ActivateCardAction;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Collections;
import java.util.List;
/**
* Set: Reflections
* Side: Free
* Culture: Gandalf
* Twilight Cost: 2
* Type: Condition • Support Area
* Game Text: Skirmish: Discard this condition to discard each minion skirmishing a Wizard. Place that Wizard in your
* dead pile. Fellowship or Regroup: Play a Wizard (even if another copy of that Wizard is in your dead pile).
*/
public class Card9_027 extends AbstractPermanent {
public Card9_027() {
super(Side.FREE_PEOPLE, 2, CardType.CONDITION, Culture.GANDALF, Zone.SUPPORT, "Sent Back");
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.SKIRMISH, self)
&& PlayConditions.canSelfDiscard(self, game)) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new DiscardCardsFromPlayEffect(self, self));
action.appendEffect(
new DiscardCardsFromPlayEffect(self, CardType.MINION, Filters.inSkirmishAgainst(Race.WIZARD)));
action.appendEffect(
new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
PhysicalCard wizard = Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Race.WIZARD, Filters.inSkirmish);
if (wizard != null)
action.appendEffect(
new PutCharacterFromPlayInDeadPileEffect(wizard));
}
});
return Collections.singletonList(action);
}
return null;
}
}