"Gladden Homestead"

This commit is contained in:
marcins78@gmail.com
2012-01-03 11:41:18 +00:00
parent 68e3dbaa32
commit 9a9cfa8ed8
6 changed files with 164 additions and 16 deletions

View File

@@ -1,12 +1,16 @@
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.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class PutCardFromPlayOnBottomOfDeckEffect extends AbstractEffect {
private PhysicalCard _physicalCard;
@@ -23,10 +27,30 @@ public class PutCardFromPlayOnBottomOfDeckEffect extends AbstractEffect {
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
if (isPlayableInFull(game)) {
final List<PhysicalCard> attachedCards = game.getGameState().getAttachedCards(_physicalCard);
final List<PhysicalCard> stackedCards = game.getGameState().getStackedCards(_physicalCard);
Set<PhysicalCard> removedFromZone = new HashSet<PhysicalCard>();
removedFromZone.add(_physicalCard);
removedFromZone.addAll(attachedCards);
removedFromZone.addAll(stackedCards);
GameState gameState = game.getGameState();
gameState.sendMessage(_physicalCard.getOwner() + " puts " + GameUtils.getCardLink(_physicalCard) + " from play on the bottom of deck");
gameState.removeCardsFromZone(_physicalCard.getOwner(), Collections.singleton(_physicalCard));
gameState.removeCardsFromZone(_physicalCard.getOwner(), removedFromZone);
gameState.putCardOnBottomOfDeck(_physicalCard);
for (PhysicalCard attachedCard : attachedCards) {
gameState.addCardToZone(game, attachedCard, Zone.DISCARD);
game.getActionsEnvironment().emitEffectResult(
new DiscardCardsFromPlayResult(attachedCard));
}
for (PhysicalCard stackedCard : stackedCards)
gameState.addCardToZone(game, stackedCard, Zone.DISCARD);
gameState.sendMessage(_physicalCard.getOwner() + " puts " + GameUtils.getCardLink(_physicalCard) + " from play on the bottom of deck");
return new FullEffectResult(true, true);
}
return new FullEffectResult(false, false);

View File

@@ -1,12 +1,16 @@
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.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class PutCardFromPlayOnTopOfDeckEffect extends AbstractEffect {
private PhysicalCard _physicalCard;
@@ -23,10 +27,30 @@ public class PutCardFromPlayOnTopOfDeckEffect extends AbstractEffect {
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
if (isPlayableInFull(game)) {
final List<PhysicalCard> attachedCards = game.getGameState().getAttachedCards(_physicalCard);
final List<PhysicalCard> stackedCards = game.getGameState().getStackedCards(_physicalCard);
Set<PhysicalCard> removedFromZone = new HashSet<PhysicalCard>();
removedFromZone.add(_physicalCard);
removedFromZone.addAll(attachedCards);
removedFromZone.addAll(stackedCards);
GameState gameState = game.getGameState();
gameState.sendMessage(_physicalCard.getOwner() + " puts " + GameUtils.getCardLink(_physicalCard) + " from play on the top of deck");
gameState.removeCardsFromZone(_physicalCard.getOwner(), Collections.singleton(_physicalCard));
gameState.removeCardsFromZone(_physicalCard.getOwner(), removedFromZone);
gameState.putCardOnTopOfDeck(_physicalCard);
for (PhysicalCard attachedCard : attachedCards) {
gameState.addCardToZone(game, attachedCard, Zone.DISCARD);
game.getActionsEnvironment().emitEffectResult(
new DiscardCardsFromPlayResult(attachedCard));
}
for (PhysicalCard stackedCard : stackedCards)
gameState.addCardToZone(game, stackedCard, Zone.DISCARD);
gameState.sendMessage(_physicalCard.getOwner() + " puts " + GameUtils.getCardLink(_physicalCard) + " from play on the top of deck");
return new FullEffectResult(true, true);
}
return new FullEffectResult(false, false);

View File

@@ -20,11 +20,6 @@ public class ChooseAndDiscardCardsFromPlayEffect extends ChooseActiveCardsEffect
_action = action;
}
@Override
public String getText(LotroGame game) {
return null;
}
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> cards) {
_resultSubAction = new SubAction(_action);

View File

@@ -0,0 +1,36 @@
package com.gempukku.lotro.cards.effects.choose;
import com.gempukku.lotro.cards.effects.PutCardFromPlayOnTopOfDeckEffect;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.Action;
public class ChooseAndPutCardFromPlayOnTopOfDeckEffect extends ChooseActiveCardEffect {
private Action _action;
private SubAction _resultSubAction;
public ChooseAndPutCardFromPlayOnTopOfDeckEffect(Action action, String playerId, Filterable... filters) {
super(action.getActionSource(), playerId, "Choose a card to put on top of deck", filters);
_action = action;
}
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
_resultSubAction = new SubAction(_action);
_resultSubAction.appendEffect(new PutCardFromPlayOnTopOfDeckEffect(card));
game.getActionsEnvironment().addActionToStack(_resultSubAction);
}
@Override
public boolean wasSuccessful() {
return _resultSubAction != null && _resultSubAction.wasSuccessful();
}
@Override
public boolean wasCarriedOut() {
return _resultSubAction != null && _resultSubAction.wasCarriedOut();
}
}

View File

@@ -0,0 +1,74 @@
package com.gempukku.lotro.cards.set13.gollum;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.AddTokenEffect;
import com.gempukku.lotro.cards.effects.ChoiceEffect;
import com.gempukku.lotro.cards.effects.RemoveTokenEffect;
import com.gempukku.lotro.cards.effects.SelfDiscardEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPutCardFromPlayOnTopOfDeckEffect;
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.actions.RequiredTriggerAction;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* Set: Bloodlines
* Side: Free
* Culture: Gollum
* Twilight Cost: 2
* Type: Condition • Support Area
* Game Text: To play, spot Smeagol. When you play this, add a [GOLLUM] token here for each [GOLLUM] card you can spot.
* Maneuver: Discard this from play or remove 2 tokens from here to spot a Shadow condition and place that condition on
* top of its owners draw deck.
*/
public class Card13_049 extends AbstractPermanent {
public Card13_049() {
super(Side.FREE_PEOPLE, 2, CardType.CONDITION, Culture.GOLLUM, Zone.SUPPORT, "Gladden Homestead", true);
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile) {
return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile)
&& PlayConditions.canSpot(game, Filters.smeagol);
}
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (TriggerConditions.played(game, effectResult, self)) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new AddTokenEffect(self, self, Token.GOLLUM, Filters.countSpottable(game.getGameState(), game.getModifiersQuerying(), Culture.GOLLUM)));
return Collections.singletonList(action);
}
return null;
}
@Override
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.MANEUVER, self)) {
ActivateCardAction action = new ActivateCardAction(self);
List<Effect> possibleCosts = new LinkedList<Effect>();
possibleCosts.add(
new RemoveTokenEffect(self, self, Token.GOLLUM, 2));
possibleCosts.add(
new SelfDiscardEffect(self));
action.appendCost(
new ChoiceEffect(action, playerId, possibleCosts));
action.appendEffect(
new ChooseAndPutCardFromPlayOnTopOfDeckEffect(action, playerId, CardType.CONDITION, Side.SHADOW));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -56,11 +56,6 @@ public class ChooseAndHealCharactersEffect extends ChooseActiveCardsEffect {
});
}
@Override
public String getText(LotroGame game) {
return null;
}
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> cards) {
SubAction subAction = new SubAction(_action);