This commit is contained in:
marcins78@gmail.com
2011-10-16 16:36:56 +00:00
parent d9bb3fd2ec
commit b01e559b0f
15 changed files with 71 additions and 18 deletions

View File

@@ -135,11 +135,11 @@ public class PlayConditions {
});
}
public static boolean canPlayFromHand(String playerId, LotroGame game, Filter... filters) {
public static boolean canPlayFromHand(String playerId, LotroGame game, Filterable... filters) {
return Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.and(filters, Filters.playable(game))).size() > 0;
}
public static boolean canPlayFromHand(String playerId, LotroGame game, int twilightModifier, Filter... filters) {
public static boolean canPlayFromHand(String playerId, LotroGame game, int twilightModifier, Filterable... filters) {
return Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.and(filters, Filters.playable(game, twilightModifier))).size() > 0;
}

View File

@@ -1,5 +1,6 @@
package com.gempukku.lotro.cards.effects.choose;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
@@ -18,11 +19,11 @@ public class ChooseAndPlayCardFromHandEffect extends AbstractEffect {
private Filter _filter;
private int _twilightModifier;
public ChooseAndPlayCardFromHandEffect(String playerId, List<? extends PhysicalCard> cardsInHandAtStart, Filter filter) {
this(playerId, cardsInHandAtStart, filter, 0);
public ChooseAndPlayCardFromHandEffect(String playerId, List<? extends PhysicalCard> cardsInHandAtStart, Filterable... filter) {
this(playerId, cardsInHandAtStart, 0, filter);
}
public ChooseAndPlayCardFromHandEffect(String playerId, List<? extends PhysicalCard> cardsInHandAtStart, Filter filter, int twilightModifier) {
public ChooseAndPlayCardFromHandEffect(String playerId, List<? extends PhysicalCard> cardsInHandAtStart, int twilightModifier, Filterable... filter) {
_playerId = playerId;
// Card has to be in hand when you start playing the card (we need to copy the collection)
_filter = Filters.and(filter, Filters.in(new LinkedList<PhysicalCard>(cardsInHandAtStart)));

View File

@@ -42,7 +42,7 @@ public class Card1_045 extends AbstractAlly {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(new ExertCharactersEffect(self, self));
action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.race(Race.ELF), -1000));
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -1000, Filters.race(Race.ELF)));
return Collections.singletonList(action);
}
return null;

View File

@@ -40,7 +40,7 @@ public class Card1_364 extends AbstractCompanion {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(new ExertCharactersEffect(self, self));
action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.and(Filters.type(CardType.COMPANION), Filters.signet(Signet.GANDALF)), -2));
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Filters.and(Filters.type(CardType.COMPANION), Filters.signet(Signet.GANDALF))));
return Collections.singletonList(action);
}
return null;

View File

@@ -37,7 +37,7 @@ public class Card1_326 extends AbstractSite {
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.race(Race.HOBBIT)));
action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.or(Filters.type(CardType.COMPANION), Filters.type(CardType.ALLY)), -1));
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -1, Filters.or(Filters.type(CardType.COMPANION), Filters.type(CardType.ALLY))));
return Collections.singletonList(action);
}
return null;

View File

@@ -41,7 +41,7 @@ public class Card1_349 extends AbstractSite {
if (Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.name("The Balrog"), Filters.playable(game, -6)).size() > 0) {
// Play from hand
possibleEffects.add(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.name("The Balrog"), -6));
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -6, Filters.name("The Balrog")));
}
// Play from deck

View File

@@ -34,7 +34,7 @@ public class Card1_217 extends AbstractOldEvent {
public PlayEventAction getPlayCardAction(final String playerId, final LotroGame game, PhysicalCard self, int twilightModifier) {
PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.race(Race.NAZGUL), -2));
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Filters.race(Race.NAZGUL)));
return action;
}

View File

@@ -49,7 +49,7 @@ public class Card2_070 extends AbstractOldEvent {
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
int cardsRevealed = selectedCards.size();
action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.name("The Balrog"), -2 * cardsRevealed));
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2 * cardsRevealed, Filters.name("The Balrog")));
}
});
return action;

View File

@@ -39,7 +39,7 @@ public class Card2_110 extends AbstractCompanion {
&& Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.or(Filters.name("Gandalf"), Filters.name("Aragorn")), Filters.playable(game, -2)).size() > 0) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.or(Filters.name("Gandalf"), Filters.name("Aragorn")), -2));
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Filters.or(Filters.name("Gandalf"), Filters.name("Aragorn"))));
return Collections.singletonList(action);
}
return null;

View File

@@ -41,7 +41,7 @@ public class Card4_009 extends AbstractMinion {
&& Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN), Filters.playable(game, -2)).size() > 0) {
final OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN)), -2) {
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN))) {
@Override
protected void cardChosenCallback(PhysicalCard cardChosenToPlay) {
action.appendEffect(

View File

@@ -41,7 +41,7 @@ public class Card4_023 extends AbstractMinion {
&& Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN), Filters.playable(game, -2)).size() > 0) {
final OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN)), -2) {
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN))) {
@Override
protected void cardChosenCallback(PhysicalCard cardChosenToPlay) {
action.appendEffect(

View File

@@ -41,7 +41,7 @@ public class Card4_038 extends AbstractMinion {
&& Filters.filter(game.getGameState().getHand(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN), Filters.playable(game, -2)).size() > 0) {
final OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN)), -2) {
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN))) {
@Override
protected void cardChosenCallback(PhysicalCard cardChosenToPlay) {
action.appendEffect(

View File

@@ -56,7 +56,7 @@ public class Card4_177 extends AbstractAttachable {
action.appendCost(
new ChooseAndDiscardCardsFromHandEffect(action, playerId, false, 1, Filters.type(CardType.MINION)));
action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.type(CardType.MINION), -3));
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -3, Filters.type(CardType.MINION)));
return Collections.singletonList(action);
}
return null;

View File

@@ -44,8 +44,8 @@ public class Card4_192 extends AbstractMinion {
action.appendCost(
new ExertCharactersEffect(self, self));
action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.race(Race.URUK_HAI),
-Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.race(Race.URUK_HAI), Filters.not(Filters.sameCard(self)))));
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.race(Race.URUK_HAI), Filters.not(Filters.sameCard(self))), Filters.race(Race.URUK_HAI)
));
return Collections.singletonList(action);
}
return null;

View File

@@ -0,0 +1,52 @@
package com.gempukku.lotro.cards.set4.shire;
import com.gempukku.lotro.cards.AbstractCompanion;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.RemoveBurdenEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromHandEffect;
import com.gempukku.lotro.common.*;
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.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: The Two Towers
* Side: Free
* Culture: Shire
* Twilight Cost: 0
* Type: Companion • Hobbit
* Strength: 3
* Vitality: 4
* Resistance: 10
* Signet: Gandalf
* Game Text: Ring-bearer (resistance 10). Fellowship: Play a Ring-bound companion to remove a burden.
*/
public class Card4_302 extends AbstractCompanion {
public Card4_302() {
super(0, 3, 4, Culture.SHIRE, Race.HOBBIT, Signet.GANDALF, "Frodo", true);
addKeyword(Keyword.RING_BEARER);
}
@Override
public int getResistance() {
return 10;
}
@Override
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canPlayFromHand(playerId, game, CardType.COMPANION, Keyword.RING_BOUND)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), CardType.COMPANION, Keyword.RING_BOUND));
action.appendEffect(
new RemoveBurdenEffect(self));
return Collections.singletonList(action);
}
return null;
}
}