"Into Dark Tunnels"

This commit is contained in:
marcins78@gmail.com
2011-10-07 14:22:22 +00:00
parent 4cd0106310
commit 8ebac1176b
4 changed files with 102 additions and 7 deletions

View File

@@ -1,7 +1,6 @@
package com.gempukku.lotro.cards.actions;
import com.gempukku.lotro.cards.effects.PayTwilightCostEffect;
import com.gempukku.lotro.cards.effects.PutCardIntoDiscardEffect;
import com.gempukku.lotro.cards.effects.RemoveCardFromZoneEffect;
import com.gempukku.lotro.cards.effects.ShuffleDeckEffect;
import com.gempukku.lotro.common.Keyword;
@@ -12,7 +11,9 @@ import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.actions.AbstractCostToEffectAction;
import com.gempukku.lotro.logic.effects.PlayEventEffect;
import com.gempukku.lotro.logic.effects.SendMessageEffect;
import com.gempukku.lotro.logic.timing.AbstractSuccessfulEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Iterator;
import java.util.LinkedList;
@@ -26,7 +27,6 @@ public class PlayEventAction extends AbstractCostToEffectAction {
private PlayEventEffect _playCardEffect;
private boolean _cardPlayed;
private Effect _discardCardEffect;
private boolean _cardDiscarded;
public PlayEventAction(PhysicalCard card) {
@@ -48,8 +48,6 @@ public class PlayEventAction extends AbstractCostToEffectAction {
_playCardEffect = new PlayEventEffect(card);
if (requiresRanger)
_playCardEffect.setRequiresRanger(true);
_discardCardEffect = new PutCardIntoDiscardEffect(card);
}
@Override
@@ -91,7 +89,23 @@ public class PlayEventAction extends AbstractCostToEffectAction {
if (!_cardDiscarded) {
_cardDiscarded = true;
return _discardCardEffect;
return new AbstractSuccessfulEffect() {
@Override
public String getText(LotroGame game) {
return null;
}
@Override
public EffectResult.Type getType() {
return null;
}
@Override
public EffectResult[] playEffect(LotroGame game) {
game.getGameState().addCardToZone(_source, _playCardEffect.getTargetZone());
return null;
}
};
}
return null;

View File

@@ -0,0 +1,71 @@
package com.gempukku.lotro.cards.set4.gandalf;
import com.gempukku.lotro.cards.AbstractResponseEvent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.ChooseAndExertCharactersEffect;
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.PlayEventEffect;
import com.gempukku.lotro.logic.timing.AbstractSuccessfulEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Set: The Two Towers
* Side: Free
* Culture: Gandalf
* Twilight Cost: 3
* Type: Event
* Game Text: Spell.
* Response: If you play a [GANDALF] event, exert Gandalf twice to place that event in your hand instead of your
* discard pile.
*/
public class Card4_095 extends AbstractResponseEvent {
public Card4_095() {
super(Side.FREE_PEOPLE, Culture.GANDALF, "Into Dark Tunnels");
addKeyword(Keyword.SPELL);
}
@Override
public int getTwilightCost() {
return 3;
}
@Override
public List<PlayEventAction> getOptionalBeforeActions(String playerId, LotroGame game, final Effect effect, PhysicalCard self) {
if (PlayConditions.canPlayCardDuringPhase(game, (Phase) null, self)
&& PlayConditions.played(game.getGameState(), game.getModifiersQuerying(), effect, Filters.and(Filters.culture(Culture.GANDALF), Filters.type(CardType.EVENT)))
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), 2, Filters.name("Gandalf"))) {
PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, 2, Filters.name("Gandalf")));
action.appendEffect(
new AbstractSuccessfulEffect() {
@Override
public String getText(LotroGame game) {
return null;
}
@Override
public EffectResult.Type getType() {
return null;
}
@Override
public EffectResult[] playEffect(LotroGame game) {
((PlayEventEffect) effect).setTargetZone(Zone.HAND);
return null;
}
}
);
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,10 +1,12 @@
package com.gempukku.lotro.logic.effects;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.game.PhysicalCard;
public class PlayEventEffect extends PlayCardEffect {
private boolean _cancelled;
private boolean _requiresRanger;
private Zone _targetZone = Zone.DISCARD;
public PlayEventEffect(PhysicalCard cardPlayed) {
super(cardPlayed);
@@ -25,4 +27,12 @@ public class PlayEventEffect extends PlayCardEffect {
public boolean isCancelled() {
return _cancelled;
}
public void setTargetZone(Zone zone) {
_targetZone = zone;
}
public Zone getTargetZone() {
return _targetZone;
}
}

View File

@@ -18,8 +18,8 @@ public abstract class AbstractEffect implements Effect {
@Override
public final EffectResult[] playEffect(LotroGame game) {
FullEffectResult fullEffectResult = playEffectReturningResult(game);
_carriedOut = fullEffectResult._carriedOut;
_successful = fullEffectResult._successful;
_carriedOut = fullEffectResult.isCarriedOut();
_successful = fullEffectResult.isSuccessful();
return fullEffectResult._results;
}