"Foul Creation"

This commit is contained in:
marcins78@gmail.com
2011-08-31 17:20:48 +00:00
parent c31aab5d62
commit 03aef68dd6
2 changed files with 63 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package com.gempukku.lotro.cards.set1.elven;
import com.gempukku.lotro.cards.AbstractLotroCardBlueprint;
import com.gempukku.lotro.cards.GameUtils;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.ExertCharacterEffect;
@@ -8,7 +9,8 @@ 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.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.decisions.MultipleChoiceAwaitingDecision;
import com.gempukku.lotro.logic.effects.*;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
@@ -35,7 +37,7 @@ public class Card1_044 extends AbstractLotroCardBlueprint {
}
@Override
public List<? extends Action> getPlayablePhaseActions(String playerId, LotroGame game, PhysicalCard self) {
public List<? extends Action> getPlayablePhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
if (PlayConditions.canPlayFPCardDuringPhase(game, Phase.FELLOWSHIP, self)
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.ELF), Filters.canExert())) {
final PlayEventAction action = new PlayEventAction(self);
@@ -44,9 +46,27 @@ public class Card1_044 extends AbstractLotroCardBlueprint {
@Override
protected void cardSelected(LotroGame game, PhysicalCard elf) {
action.addCost(new ExertCharacterEffect(elf));
// TODO
}
});
action.addCost(new PlayoutDecisionEffect(game.getUserFeedback(), playerId,
new MultipleChoiceAwaitingDecision(1, "Choose an opponent", GameUtils.getOpponents(game, playerId)) {
@Override
protected void validDecisionMade(int index, String chosenOpponent) {
List<? extends PhysicalCard> hand = game.getGameState().getHand(chosenOpponent);
List<PhysicalCard> isengardMinions = Filters.filter(hand, game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.ISENGARD), Filters.type(CardType.MINION));
action.addCost(
new ChooseArbitraryCardEffect(playerId, "Choose ISENGARD minion to discard", isengardMinions) {
@Override
protected void cardSelected(PhysicalCard card) {
action.addEffect(new DiscardCardFromHandEffect(card));
action.addEffect(new DrawCardEffect(playerId));
action.addEffect(new DrawCardEffect(playerId));
}
}
);
}
})
);
return Collections.singletonList(action);
}

View File

@@ -0,0 +1,40 @@
package com.gempukku.lotro.logic.effects;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.decisions.ArbitraryCardsSelectionDecision;
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.List;
public abstract class ChooseArbitraryCardEffect extends UnrespondableEffect {
private String _playerId;
private String _choiceText;
private List<PhysicalCard> _cards;
public ChooseArbitraryCardEffect(String playerId, String choiceText, List<PhysicalCard> cards) {
_playerId = playerId;
_choiceText = choiceText;
_cards = cards;
}
@Override
public boolean canPlayEffect(LotroGame game) {
return (_cards.size() > 0);
}
@Override
public void playEffect(LotroGame game) {
game.getUserFeedback().sendAwaitingDecision(_playerId,
new ArbitraryCardsSelectionDecision(1, _choiceText, _cards, 1, 1) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
PhysicalCard selectedCard = getSelectedCardsByResponse(result).get(0);
cardSelected(selectedCard);
}
});
}
protected abstract void cardSelected(PhysicalCard card);
}