"Mirkwood Bowman"

This commit is contained in:
marcins78@gmail.com
2011-10-28 09:53:14 +00:00
parent a590165694
commit 90d76373b7
6 changed files with 115 additions and 36 deletions

View File

@@ -4,18 +4,27 @@ 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.Effect;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
public class DiscardTopCardFromDeckEffect extends AbstractEffect {
private PhysicalCard _source;
private String _playerId;
private int _count;
private boolean _forced;
public DiscardTopCardFromDeckEffect(PhysicalCard source, String playerId, boolean forced) {
this(source, playerId, 1, forced);
}
public DiscardTopCardFromDeckEffect(PhysicalCard source, String playerId, int count, boolean forced) {
_source = source;
_playerId = playerId;
_count = count;
_forced = forced;
}
@@ -31,25 +40,33 @@ public class DiscardTopCardFromDeckEffect extends AbstractEffect {
@Override
public boolean isPlayableInFull(LotroGame game) {
return game.getGameState().getDeck(_playerId).size() > 0
return game.getGameState().getDeck(_playerId).size() >= _count
&& (!_forced || game.getModifiersQuerying().canDiscardCardsFromTopOfDeck(game.getGameState(), _playerId, _source));
}
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
if (isPlayableInFull(game)) {
if (!_forced || game.getModifiersQuerying().canDiscardCardsFromTopOfDeck(game.getGameState(), _playerId, _source)) {
GameState gameState = game.getGameState();
PhysicalCard card = gameState.removeTopDeckCard(_playerId);
gameState.sendMessage(_playerId + " discards top card from his or her deck - " + GameUtils.getCardLink(card));
gameState.addCardToZone(game, card, Zone.DISCARD);
cardDiscardedCallback(card);
List<PhysicalCard> cardsDiscarded = new LinkedList<PhysicalCard>();
for (int i = 0; i < _count; i++) {
PhysicalCard card = gameState.removeTopDeckCard(_playerId);
if (card != null) {
cardsDiscarded.add(card);
gameState.addCardToZone(game, card, Zone.DISCARD);
}
}
if (cardsDiscarded.size() > 0) {
gameState.sendMessage(_playerId + " discards top cards from his or her deck - " + getAppendedNames(cardsDiscarded));
cardsDiscardedCallback(cardsDiscarded);
}
return new FullEffectResult(null, true, true);
return new FullEffectResult(null, _count == cardsDiscarded.size(), _count == cardsDiscarded.size());
}
return new FullEffectResult(null, false, false);
}
protected void cardDiscardedCallback(PhysicalCard card) {
protected void cardsDiscardedCallback(Collection<PhysicalCard> cards) {
}
}

View File

@@ -18,6 +18,7 @@ import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -59,22 +60,23 @@ public class Card6_015 extends AbstractAlly {
action.appendEffect(
new DiscardTopCardFromDeckEffect(self, playerId, false) {
@Override
protected void cardDiscardedCallback(final PhysicalCard card) {
if (card.getBlueprint().getCulture() == Culture.ELVEN) {
action.appendEffect(
new PlayoutDecisionEffect(game.getUserFeedback(), playerId,
new MultipleChoiceAwaitingDecision(1, "do you want to take " + GameUtils.getCardLink(card) + " into hand and heal an Elf companion?", new String[]{"Yes", "No"}) {
@Override
protected void validDecisionMade(int index, String result) {
if (result.equals("Yes")) {
action.appendEffect(
new PutCardFromDiscardIntoHandEffect(card));
action.appendEffect(
new ChooseAndHealCharactersEffect(action, playerId, Race.ELF, CardType.COMPANION));
protected void cardsDiscardedCallback(Collection<PhysicalCard> cards) {
for (final PhysicalCard card : cards)
if (card.getBlueprint().getCulture() == Culture.ELVEN) {
action.appendEffect(
new PlayoutDecisionEffect(game.getUserFeedback(), playerId,
new MultipleChoiceAwaitingDecision(1, "do you want to take " + GameUtils.getCardLink(card) + " into hand and heal an Elf companion?", new String[]{"Yes", "No"}) {
@Override
protected void validDecisionMade(int index, String result) {
if (result.equals("Yes")) {
action.appendEffect(
new PutCardFromDiscardIntoHandEffect(card));
action.appendEffect(
new ChooseAndHealCharactersEffect(action, playerId, Race.ELF, CardType.COMPANION));
}
}
}
}));
}
}));
}
}
});
return Collections.singletonList(action);

View File

@@ -15,6 +15,7 @@ import com.gempukku.lotro.logic.effects.HealCharactersEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -56,10 +57,11 @@ public class Card6_018 extends AbstractAlly {
action.appendEffect(
new DiscardTopCardFromDeckEffect(self, playerId, false) {
@Override
protected void cardDiscardedCallback(PhysicalCard card) {
if (card.getBlueprint().getSide() == Side.SHADOW)
action.appendEffect(
new ChooseAndAddUntilEOPStrengthBonusEffect(action, self, playerId, -3, CardType.MINION, Filters.inSkirmishAgainst(Race.ELF)));
protected void cardsDiscardedCallback(Collection<PhysicalCard> cards) {
for (PhysicalCard card : cards)
if (card.getBlueprint().getSide() == Side.SHADOW)
action.appendEffect(
new ChooseAndAddUntilEOPStrengthBonusEffect(action, self, playerId, -3, CardType.MINION, Filters.inSkirmishAgainst(Race.ELF)));
}
});
return Collections.singletonList(action);

View File

@@ -12,6 +12,7 @@ import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -45,10 +46,11 @@ public class Card6_021 extends AbstractAttachableFPPossession {
action.appendEffect(
new DiscardTopCardFromDeckEffect(self, playerId, false) {
@Override
protected void cardDiscardedCallback(PhysicalCard card) {
if (card.getBlueprint().getCulture() == Culture.ELVEN)
action.appendEffect(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, CardType.MINION));
protected void cardsDiscardedCallback(Collection<PhysicalCard> cards) {
for (PhysicalCard card : cards)
if (card.getBlueprint().getCulture() == Culture.ELVEN)
action.appendEffect(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, CardType.MINION));
}
});
return Collections.singletonList(action);

View File

@@ -15,6 +15,7 @@ import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -51,10 +52,11 @@ public class Card6_022 extends AbstractCompanion {
action.appendEffect(
new DiscardTopCardFromDeckEffect(self, playerId, false) {
@Override
protected void cardDiscardedCallback(PhysicalCard card) {
if (card.getBlueprint().getCulture() == Culture.ELVEN)
action.appendEffect(
new ChooseAndAddUntilEOPStrengthBonusEffect(action, self, playerId, -2, CardType.MINION, Filters.inSkirmishAgainst(self)));
protected void cardsDiscardedCallback(Collection<PhysicalCard> cards) {
for (PhysicalCard card : cards)
if (card.getBlueprint().getCulture() == Culture.ELVEN)
action.appendEffect(
new ChooseAndAddUntilEOPStrengthBonusEffect(action, self, playerId, -2, CardType.MINION, Filters.inSkirmishAgainst(self)));
}
});
return Collections.singletonList(action);

View File

@@ -0,0 +1,54 @@
package com.gempukku.lotro.cards.set7.elven;
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.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.cards.effects.DiscardTopCardFromDeckEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.cards.modifiers.ArcheryTotalModifier;
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 java.util.Collection;
/**
* Set: The Return of the King
* Side: Free
* Culture: Elven
* Twilight Cost: 1
* Type: Event • Archery
* Game Text: Exert 2 [ELVEN] companions to discard the top 3 cards of your draw deck. Make the fellowship archery
* total +1 for each [ELVEN] card discarded.
*/
public class Card7_027 extends AbstractEvent {
public Card7_027() {
super(Side.FREE_PEOPLE, 1, Culture.ELVEN, "Mirkwood Bowman", Phase.ARCHERY);
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return super.checkPlayRequirements(playerId, game, self, twilightModifier)
&& PlayConditions.canExertMultiple(self, game, 1, 2, Race.ELF, CardType.COMPANION);
}
@Override
public PlayEventAction getPlayCardAction(String playerId, final LotroGame game, final PhysicalCard self, int twilightModifier) {
final PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 2, 2, Race.ELF, CardType.COMPANION));
action.appendEffect(
new DiscardTopCardFromDeckEffect(self, playerId, 3, false) {
@Override
protected void cardsDiscardedCallback(Collection<PhysicalCard> cards) {
int elvenCount = Filters.filter(cards, game.getGameState(), game.getModifiersQuerying(), Culture.ELVEN).size();
action.appendEffect(
new AddUntilEndOfPhaseModifierEffect(
new ArcheryTotalModifier(self, Side.FREE_PEOPLE, elvenCount), Phase.ARCHERY));
}
});
return action;
}
}