"Gandalf"

This commit is contained in:
marcins78@gmail.com
2011-09-06 15:43:14 +00:00
parent 9282ec9a4e
commit edad22cbbc
3 changed files with 57 additions and 11 deletions

View File

@@ -50,7 +50,8 @@ public class AbstractMinion extends AbstractLotroCardBlueprint {
} }
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self) { public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self) {
return PlayConditions.checkUniqueness(game.getGameState(), game.getModifiersQuerying(), self); return PlayConditions.checkUniqueness(game.getGameState(), game.getModifiersQuerying(), self)
&& game.getGameState().getTwilightPool() >= game.getModifiersQuerying().getTwilightCost(game.getGameState(), self);
} }
public Action getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) { public Action getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {

View File

@@ -7,15 +7,12 @@ import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture; import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword; import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Phase; import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters; import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame; import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.DefaultCostToEffectAction; import com.gempukku.lotro.logic.actions.DefaultCostToEffectAction;
import com.gempukku.lotro.logic.effects.ChooseCardsFromHandEffect; import com.gempukku.lotro.logic.effects.ChooseCardsFromHandEffect;
import com.gempukku.lotro.logic.effects.HealCharacterEffect; import com.gempukku.lotro.logic.effects.HealCharacterEffect;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.Action; import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult; import com.gempukku.lotro.logic.timing.EffectResult;
@@ -46,13 +43,7 @@ public class Card1_045 extends AbstractAlly {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Galadriel to play an Elf for free"); DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Galadriel to play an Elf for free");
action.addCost(new ExertCharacterEffect(self)); action.addCost(new ExertCharacterEffect(self));
action.addEffect( action.addEffect(
new ChooseCardsFromHandEffect(playerId, "Choose an Elf to play", 1, 1, Filters.keyword(Keyword.ELF), new ChooseCardsFromHandEffect(playerId, "Choose an Elf to play", 1, 1, Filters.keyword(Keyword.ELF), Filters.playable(game)) {
new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return physicalCard.getBlueprint().checkPlayRequirements(playerId, game, physicalCard);
}
}) {
@Override @Override
protected void cardsSelected(List<PhysicalCard> selectedCards) { protected void cardsSelected(List<PhysicalCard> selectedCards) {
PhysicalCard selectedCard = selectedCards.get(0); PhysicalCard selectedCard = selectedCards.get(0);

View File

@@ -0,0 +1,54 @@
package com.gempukku.lotro.cards.set1.gandalf;
import com.gempukku.lotro.cards.AbstractCompanion;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.ExertCharacterEffect;
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.DefaultCostToEffectAction;
import com.gempukku.lotro.logic.effects.ChooseCardsFromHandEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: The Fellowship of the Ring
* Side: Free
* Culture: Gandalf
* Twilight Cost: 4
* Type: Companion • Wizard
* Strength: 7
* Vitality: 4
* Resistance: 6
* Signet: Gandalf
* Game Text: Fellowship: Exert Gandalf to play a companion who has the Gandalf signet. The twilight cost of that
* companion is -2.
*/
public class Card1_364 extends AbstractCompanion {
public Card1_364() {
super(4, 7, 4, Culture.GANDALF, Keyword.WIZARD, Signet.GANDALF, "Gandalf", true);
}
@Override
protected List<? extends Action> getExtraPhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.FELLOWSHIP, "Exert Gandalf to play a companion who has the Gandalf signet. The twilight cost of that companion is -2.");
action.addCost(new ExertCharacterEffect(self));
action.addEffect(
new ChooseCardsFromHandEffect(playerId, "Choose an Elf to play", 1, 1, Filters.type(CardType.COMPANION), Filters.signet(Signet.GANDALF), Filters.playable(game)) {
@Override
protected void cardsSelected(List<PhysicalCard> selectedCards) {
PhysicalCard selectedCard = selectedCards.get(0);
game.getActionsEnvironment().addActionToStack(
selectedCard.getBlueprint().getPlayCardAction(playerId, game, selectedCard, -2));
}
});
return Collections.singletonList(action);
}
return null;
}
}