This commit is contained in:
marcins78@gmail.com
2011-08-31 21:30:45 +00:00
parent 058d0e35be
commit fc619aa1d6
3 changed files with 59 additions and 23 deletions

View File

@@ -1,8 +1,10 @@
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.PlayPermanentAction;
import com.gempukku.lotro.cards.effects.DiscardCardFromDeckEffect;
import com.gempukku.lotro.cards.effects.ExertCharacterEffect;
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
import com.gempukku.lotro.common.*;
@@ -11,6 +13,7 @@ import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.decisions.MultipleChoiceAwaitingDecision;
import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect;
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.timing.Action;
@@ -38,7 +41,7 @@ public class Card1_055 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) {
List<Action> actions = new LinkedList<Action>();
if (PlayConditions.canPlayFPCardDuringPhase(game, Phase.FELLOWSHIP, self))
@@ -46,17 +49,25 @@ public class Card1_055 extends AbstractLotroCardBlueprint {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.MANEUVER, self)
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.name("Galadriel"), Filters.canExert())
&& opponentsHavingAtLeast7Cards(game, playerId).size() > 0) {
CostToEffectAction action = new CostToEffectAction(self, "Exert Galadriel to look at 2 random cards, discard one");
&& opponentsHavingAtLeast7Cards(game, playerId).length > 0) {
final CostToEffectAction action = new CostToEffectAction(self, "Exert Galadriel to look at 2 random cards, discard one");
PhysicalCard galadriel = Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.name("Galadriel"));
action.addCost(new ExertCharacterEffect(galadriel));
action.addEffect(
new PlayoutDecisionEffect(game.getUserFeedback(), "playerId",
new MultipleChoiceAwaitingDecision(1, "Choose opponent with at least 7 cards in hand", opponentsHavingAtLeast7Cards(game, playerId).toArray(new String[0])) {
new PlayoutDecisionEffect(game.getUserFeedback(), playerId,
new MultipleChoiceAwaitingDecision(1, "Choose opponent with at least 7 cards in hand", opponentsHavingAtLeast7Cards(game, playerId)) {
@Override
protected void validDecisionMade(int index, String result) {
// TODO
protected void validDecisionMade(int index, final String chosenOpponent) {
List<? extends PhysicalCard> hand = game.getGameState().getHand(chosenOpponent);
List<PhysicalCard> randomCardsFromHand = GameUtils.getRandomCards(hand, 2);
action.addEffect(
new ChooseArbitraryCardsEffect(playerId, "Choose card to discard", randomCardsFromHand, 1, 1) {
@Override
protected void cardsSelected(List<PhysicalCard> selectedCards) {
action.addEffect(
new DiscardCardFromDeckEffect(chosenOpponent, selectedCards.get(0)));
}
});
}
}));
@@ -70,16 +81,14 @@ public class Card1_055 extends AbstractLotroCardBlueprint {
return new StrengthModifier(self, Filters.and(Filters.type(CardType.ALLY), Filters.siteNumber(6)), 1);
}
private List<String> opponentsHavingAtLeast7Cards(LotroGame game, String currentPlayer) {
List<String> shadowPlayers = new LinkedList<String>(game.getGameState().getPlayerOrder().getAllPlayers());
shadowPlayers.remove(currentPlayer);
private String[] opponentsHavingAtLeast7Cards(LotroGame game, String currentPlayer) {
String[] opponents = GameUtils.getOpponents(game, currentPlayer);
List<String> result = new LinkedList<String>();
for (String shadowPlayer : shadowPlayers)
for (String shadowPlayer : opponents)
if (game.getGameState().getHand(shadowPlayer).size() > 6)
result.add(shadowPlayer);
return result;
return result.toArray(new String[result.size()]);
}
}

View File

@@ -1,11 +1,15 @@
package com.gempukku.lotro.cards.set1.shire;
import com.gempukku.lotro.cards.AbstractCompanion;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Signet;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.ExertCharacterEffect;
import com.gempukku.lotro.cards.effects.HealCharacterEffect;
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.CostToEffectAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.LinkedList;
@@ -32,14 +36,28 @@ public class Card1_290 extends AbstractCompanion {
}
@Override
public List<? extends Action> getPlayablePhaseActions(String playerId, LotroGame lotroGame, PhysicalCard self) {
LinkedList<Action> result = new LinkedList<Action>();
public List<? extends Action> getPlayablePhaseActions(String playerId, LotroGame game, PhysicalCard self) {
LinkedList<Action> actions = new LinkedList<Action>();
appendPlayCompanionActions(result, lotroGame, self);
appendHealCompanionActions(result, lotroGame, self);
appendPlayCompanionActions(actions, game, self);
appendHealCompanionActions(actions, game, self);
// TODO Fellowship action
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.type(CardType.COMPANION), Filters.signet(Signet.FRODO), Filters.canExert())) {
final CostToEffectAction action = new CostToEffectAction(self, "Exert another companion who has the Frodo signet to heal Frodo.");
action.addCost(
new ChooseActiveCardEffect(playerId, "Choose another companion who has the Frodo signet", Filters.type(CardType.COMPANION), Filters.signet(Signet.FRODO), Filters.canExert()) {
@Override
protected void cardSelected(PhysicalCard card) {
action.addCost(new ExertCharacterEffect(card));
}
});
action.addEffect(
new HealCharacterEffect(self));
return result;
actions.add(action);
}
return actions;
}
}

View File

@@ -69,6 +69,15 @@ public class Filters {
};
}
public static Filter signet(final Signet signet) {
return new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return (physicalCard.getBlueprint().getSignet() == signet);
}
};
}
public static Filter side(final Side side) {
return new Filter() {
@Override