"Softly Up Behind"

This commit is contained in:
marcins78@gmail.com
2012-01-03 12:28:19 +00:00
parent f8c18c1144
commit f9c8548b73
5 changed files with 101 additions and 8 deletions

View File

@@ -107,6 +107,11 @@ public abstract class AbstractLotroCardBlueprint implements LotroCardBlueprint {
return null;
}
@Override
public List<? extends Modifier> getInDiscardModifiers(LotroGame game, PhysicalCard self) {
return null;
}
public Modifier getAlwaysOnModifier(PhysicalCard self) {
return null;
}

View File

@@ -0,0 +1,54 @@
package com.gempukku.lotro.cards.set13.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.choose.ChooseAndReturnCardsToHandEffect;
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.effects.ChooseAndDiscardCardsFromHandEffect;
import com.gempukku.lotro.logic.modifiers.KeywordModifier;
import com.gempukku.lotro.logic.modifiers.Modifier;
import java.util.Collections;
import java.util.List;
/**
* Set: Bloodlines
* Side: Free
* Culture: Gollum
* Twilight Cost: 1
* Type: Event • Maneuver
* Game Text: Spot Smeagol and discard 2 [GOLLUM] cards from hand to return a minion with strength 6 or less to its
* owners hand. While this is in your discard pile, Smeagol gains muster.
*/
public class Card13_056 extends AbstractEvent {
public Card13_056() {
super(Side.FREE_PEOPLE, 1, Culture.GOLLUM, "Softly Up Behind", Phase.MANEUVER);
}
@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)
&& PlayConditions.canDiscardCardsFromHandToPlay(self, game, playerId, 2, Culture.GOLLUM);
}
@Override
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndDiscardCardsFromHandEffect(action, playerId, false, 2, Culture.GOLLUM));
action.appendEffect(
new ChooseAndReturnCardsToHandEffect(action, playerId, 1, 1, CardType.MINION, Filters.lessStrengthThan(7)));
return action;
}
@Override
public List<? extends Modifier> getInDiscardModifiers(LotroGame game, PhysicalCard self) {
return Collections.singletonList(
new KeywordModifier(self, Filters.smeagol, Keyword.MUSTER));
}
}

View File

@@ -49,6 +49,8 @@ public interface LotroCardBlueprint {
public List<? extends Modifier> getStackedOnModifiers(LotroGame game, PhysicalCard self);
public List<? extends Modifier> getInDiscardModifiers(LotroGame game, PhysicalCard self);
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile);
public CostToEffectAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty);

View File

@@ -21,6 +21,7 @@ public class PhysicalCardImpl implements PhysicalCard {
private List<ModifierHook> _modifierHooks;
private List<ModifierHook> _modifierHooksStacked;
private List<ModifierHook> _modifierHooksInDiscard;
private Object _data;
@@ -101,6 +102,23 @@ public class PhysicalCardImpl implements PhysicalCard {
}
}
public void startAffectingGameInDiscard(LotroGame game) {
List<? extends Modifier> modifiers = _blueprint.getInDiscardModifiers(game, this);
if (modifiers != null) {
_modifierHooksInDiscard = new LinkedList<ModifierHook>();
for (Modifier modifier : modifiers)
_modifierHooksInDiscard.add(game.getModifiersEnvironment().addAlwaysOnModifier(modifier));
}
}
public void stopAffectingGameInDiscard() {
if (_modifierHooksInDiscard != null) {
for (ModifierHook modifierHook : _modifierHooksInDiscard)
modifierHook.stop();
_modifierHooksInDiscard = null;
}
}
@Override
public int getCardId() {
return _cardId;

View File

@@ -355,8 +355,11 @@ public class GameState {
if (zone.isInPlay())
if (card.getBlueprint().getCardType() != CardType.SITE || (getCurrentPhase() != Phase.PLAY_STARTING_FELLOWSHIP && getCurrentSite() == card))
stopAffecting(card);
else if (zone == Zone.STACKED)
stopAffectingStacked(card);
if (zone == Zone.STACKED)
stopAffectingStacked(card);
else if (zone == Zone.DISCARD)
stopAffectingInDiscard(card);
List<PhysicalCardImpl> zoneCards = getZoneCards(card.getOwner(), card.getBlueprint().getCardType(), zone);
zoneCards.remove(card);
@@ -418,11 +421,14 @@ public class GameState {
}
if (_currentPhase != Phase.PUT_RING_BEARER) {
if (zone.isInPlay()) {
if (zone.isInPlay())
if (card.getBlueprint().getCardType() != CardType.SITE || (getCurrentPhase() != Phase.PLAY_STARTING_FELLOWSHIP && getCurrentSite() == card))
startAffecting(game, card);
} else if (zone == Zone.STACKED)
if (zone == Zone.STACKED)
startAffectingStacked(game, card);
else if (zone == Zone.DISCARD)
startAffectingInDiscard(game, card);
}
}
@@ -804,19 +810,27 @@ public class GameState {
((PhysicalCardImpl) card).startAffectingGame(game);
}
private void startAffectingStacked(LotroGame game, PhysicalCard card) {
((PhysicalCardImpl) card).startAffectingGameStacked(game);
}
private void stopAffecting(PhysicalCard card) {
card.removeData();
((PhysicalCardImpl) card).stopAffectingGame();
}
private void startAffectingStacked(LotroGame game, PhysicalCard card) {
((PhysicalCardImpl) card).startAffectingGameStacked(game);
}
private void stopAffectingStacked(PhysicalCard card) {
((PhysicalCardImpl) card).stopAffectingGameStacked();
}
private void startAffectingInDiscard(LotroGame game, PhysicalCard card) {
((PhysicalCardImpl) card).startAffectingGameInDiscard(game);
}
private void stopAffectingInDiscard(PhysicalCard card) {
((PhysicalCardImpl) card).stopAffectingGameInDiscard();
}
public void setCurrentPhase(Phase phase) {
_currentPhase = phase;
for (GameStateListener listener : getAllGameStateListeners())