"Forearmed"

This commit is contained in:
marcins78@gmail.com
2011-10-20 15:06:37 +00:00
parent 0c299c94a9
commit 4bc44aad0f
3 changed files with 68 additions and 4 deletions

View File

@@ -40,9 +40,9 @@ public class DiscardTopCardFromDeckEffect extends AbstractEffect {
if (isPlayableInFull(game)) {
GameState gameState = game.getGameState();
PhysicalCard card = gameState.removeTopDeckCard(_playerId);
cardDiscardedCallback(card);
gameState.sendMessage(_playerId + " discards top card from his or her deck - " + GameUtils.getCardLink(card));
gameState.addCardToZone(game, card, Zone.DISCARD);
cardDiscardedCallback(card);
return new FullEffectResult(null, true, true);
}

View File

@@ -3,12 +3,13 @@ package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import com.gempukku.lotro.logic.timing.AbstractEffect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.LinkedList;
import java.util.List;
public abstract class RevealTopCardsOfDrawDeckEffect extends UnrespondableEffect {
public abstract class RevealTopCardsOfDrawDeckEffect extends AbstractEffect {
private PhysicalCard _source;
private String _playerId;
private int _count;
@@ -20,13 +21,29 @@ public abstract class RevealTopCardsOfDrawDeckEffect extends UnrespondableEffect
}
@Override
public void doPlayEffect(LotroGame game) {
public boolean isPlayableInFull(LotroGame game) {
return game.getGameState().getDeck(_playerId).size() >= _count;
}
@Override
public String getText(LotroGame game) {
return null;
}
@Override
public EffectResult.Type getType() {
return null;
}
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
List<? extends PhysicalCard> deck = game.getGameState().getDeck(_playerId);
int count = Math.min(deck.size(), _count);
LinkedList<PhysicalCard> topCards = new LinkedList<PhysicalCard>(deck.subList(0, count));
if (topCards.size() > 0)
game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " revealed cards from top of " + _playerId + " deck - " + getAppendedNames(topCards));
cardsRevealed(topCards);
return new FullEffectResult(null, topCards.size() == _count, topCards.size() == _count);
}
protected abstract void cardsRevealed(List<PhysicalCard> cards);

View File

@@ -0,0 +1,47 @@
package com.gempukku.lotro.cards.set6.elven;
import com.gempukku.lotro.cards.AbstractEvent;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.RevealTopCardsOfDrawDeckEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndAddUntilEOPStrengthBonusEffect;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Race;
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 java.util.List;
/**
* Set: Ents of Fangorn
* Side: Free
* Culture: Elven
* Twilight Cost: 1
* Type: Event
* Game Text: Skirmish: Reveal the top card of your draw deck to make a minion skirmishing an Elf strength -X, where X
* is the twilight cost of the revealed card.
*/
public class Card6_016 extends AbstractEvent {
public Card6_016() {
super(Side.FREE_PEOPLE, 1, Culture.ELVEN, "Forearmed");
}
@Override
public PlayEventAction getPlayCardAction(final String playerId, LotroGame game, final PhysicalCard self, int twilightModifier) {
final PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new RevealTopCardsOfDrawDeckEffect(self, playerId, 1) {
@Override
protected void cardsRevealed(List<PhysicalCard> cards) {
for (PhysicalCard card : cards) {
int twilightCost = card.getBlueprint().getTwilightCost();
action.appendEffect(
new ChooseAndAddUntilEOPStrengthBonusEffect(action, self, playerId, -twilightCost, CardType.MINION, Filters.inSkirmishAgainst(Race.ELF)));
}
}
});
return action;
}
}