"Beren and Luthien"

This commit is contained in:
marcins78@gmail.com
2011-09-30 08:57:31 +00:00
parent a96f187801
commit 085b29db9a
3 changed files with 121 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
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.timing.Cost;
import com.gempukku.lotro.logic.timing.CostResolution;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
public class DiscardBottomCardFromDeckEffect extends UnrespondableEffect implements Cost {
private String _playerId;
public DiscardBottomCardFromDeckEffect(String playerId) {
_playerId = playerId;
}
@Override
public CostResolution playCost(LotroGame game) {
boolean success = game.getGameState().getDeck(_playerId).size() > 0;
if (success) {
GameState gameState = game.getGameState();
PhysicalCard card = gameState.removeBottomDeckCard(_playerId);
gameState.sendMessage(_playerId + " discards bottom card from his or her deck - " + card.getBlueprint().getName());
gameState.addCardToZone(card, Zone.DISCARD);
discardedCard(card);
return new CostResolution(null, true);
}
return new CostResolution(null, false);
}
@Override
public void doPlayEffect(LotroGame game) {
if (game.getGameState().getDeck(_playerId).size() > 0) {
GameState gameState = game.getGameState();
PhysicalCard card = gameState.removeBottomDeckCard(_playerId);
gameState.sendMessage(_playerId + " discards bottom card from his or her deck - " + card.getBlueprint().getName());
gameState.addCardToZone(card, Zone.DISCARD);
discardedCard(card);
}
}
protected void discardedCard(PhysicalCard card) {
}
}

View File

@@ -0,0 +1,63 @@
package com.gempukku.lotro.cards.set3.elven;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.costs.ChooseAndExertCharactersCost;
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.cards.effects.DiscardBottomCardFromDeckEffect;
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
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.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: Realms of Elf-lords
* Side: Free
* Culture: Elven
* Twilight Cost: 1
* Type: Condition
* Game Text: Tale. Plays to your support area. Skirmish: Exert an [ELVEN] ally to discard the bottom card of your
* draw deck. If that card is an [ELVEN] card, make a minion skirmishing an Elf strength -1.
*/
public class Card3_009 extends AbstractPermanent {
public Card3_009() {
super(Side.FREE_PEOPLE, 1, CardType.CONDITION, Culture.ELVEN, Zone.FREE_SUPPORT, "Beren and Luthien");
addKeyword(Keyword.TALE);
}
@Override
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.ELVEN), Filters.type(CardType.ALLY))) {
final ActivateCardAction action = new ActivateCardAction(self, Keyword.SKIRMISH);
action.appendCost(
new ChooseAndExertCharactersCost(action, playerId, 1, 1, Filters.culture(Culture.ELVEN), Filters.type(CardType.ALLY)));
action.appendEffect(
new DiscardBottomCardFromDeckEffect(playerId) {
@Override
protected void discardedCard(PhysicalCard card) {
if (card.getBlueprint().getCulture() == Culture.ELVEN) {
action.appendEffect(
new ChooseActiveCardEffect(playerId, "Choose a minion", Filters.type(CardType.MINION), Filters.inSkirmishAgainst(Filters.race(Race.ELF))) {
@Override
protected void cardSelected(PhysicalCard minion) {
action.insertEffect(
new AddUntilEndOfPhaseModifierEffect(
new StrengthModifier(self, Filters.sameCard(minion), -1), Phase.SKIRMISH));
}
});
}
}
});
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -681,6 +681,15 @@ public class GameState {
}
}
public PhysicalCard removeBottomDeckCard(String player) {
List<PhysicalCardImpl> deck = _decks.get(player);
if (deck.size() > 0) {
return deck.remove(deck.size() - 1);
} else {
return null;
}
}
public void playerDrawsCard(String player) {
List<PhysicalCardImpl> deck = _decks.get(player);
if (deck.size() > 0) {