"Have Patience"

This commit is contained in:
marcins78@gmail.com
2011-10-07 13:38:49 +00:00
parent 4f68bfa07e
commit 480f850ba1
4 changed files with 65 additions and 14 deletions

View File

@@ -9,9 +9,8 @@ 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.actions.OptionalTriggerAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.effects.WoundCharactersEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult;
@@ -47,16 +46,10 @@ public class Card4_088 extends AbstractPermanent {
protected List<? extends Action> getExtraPhaseActions(String playerId, final LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)) {
final ActivateCardAction action = new ActivateCardAction(self, Keyword.SKIRMISH);
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a minion", Filters.type(CardType.MINION), Filters.inSkirmishAgainst(Filters.name("Gandalf"))) {
@Override
protected void cardSelected(PhysicalCard card) {
int tokenCount = game.getGameState().getTokenCount(self, Token.GANDALF);
for (int i = 0; i < tokenCount; i++)
action.insertEffect(
new WoundCharactersEffect(self, card));
}
});
int tokenCount = game.getGameState().getTokenCount(self, Token.GANDALF);
if (tokenCount > 0)
action.appendEffect(
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, tokenCount, Filters.type(CardType.MINION), Filters.inSkirmishAgainst(Filters.name("Gandalf"))));
action.appendEffect(
new DiscardCardsFromPlayEffect(self, self));
return Collections.singletonList(action);

View File

@@ -0,0 +1,44 @@
package com.gempukku.lotro.cards.set4.gandalf;
import com.gempukku.lotro.cards.AbstractEvent;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Side;
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.ChooseAndHealCharactersEffect;
/**
* Set: The Two Towers
* Side: Free
* Culture: Gandalf
* Twilight Cost: 3
* Type: Event
* Game Text: Fellowship: Spot Gandalf to heal an unbound companion twice.
*/
public class Card4_093 extends AbstractEvent {
public Card4_093() {
super(Side.FREE_PEOPLE, Culture.GANDALF, "Have Patience", Phase.FELLOWSHIP);
}
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
return super.checkPlayRequirements(playerId, game, self, twilightModifier)
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.name("Gandalf"));
}
@Override
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new ChooseAndHealCharactersEffect(action, playerId, 1, 1, 2, Filters.unboundCompanion()));
return action;
}
@Override
public int getTwilightCost() {
return 3;
}
}

View File

@@ -14,15 +14,21 @@ import java.util.Collection;
public class ChooseAndHealCharactersEffect extends ChooseActiveCardsEffect {
private Action _action;
private String _playerId;
private int _count;
public ChooseAndHealCharactersEffect(Action action, String playerId, Filter... filters) {
this(action, playerId, 1, 1, filters);
}
public ChooseAndHealCharactersEffect(Action action, String playerId, int minimum, int maximum, Filter... filters) {
this(action, playerId, minimum, maximum, 1, filters);
}
public ChooseAndHealCharactersEffect(Action action, String playerId, int minimum, int maximum, int count, Filter... filters) {
super(action.getActionSource(), playerId, "Choose character(s) to heal", minimum, maximum, filters);
_action = action;
_playerId = playerId;
_count = count;
}
@Override
@@ -43,7 +49,8 @@ public class ChooseAndHealCharactersEffect extends ChooseActiveCardsEffect {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> cards) {
SubAction subAction = new SubAction(_action.getActionSource(), _action.getType());
subAction.appendEffect(new HealCharactersEffect(_playerId, Filters.in(cards)));
for (int i = 0; i < _count; i++)
subAction.appendEffect(new HealCharactersEffect(_playerId, Filters.in(cards)));
game.getActionsEnvironment().addActionToStack(subAction);
}
}

View File

@@ -13,10 +13,16 @@ import java.util.Collection;
public class ChooseAndWoundCharactersEffect extends ChooseActiveCardsEffect {
private CostToEffectAction _action;
private int _count;
public ChooseAndWoundCharactersEffect(CostToEffectAction action, String playerId, int minimum, int maximum, Filter... filters) {
this(action, playerId, minimum, maximum, 1, filters);
}
public ChooseAndWoundCharactersEffect(CostToEffectAction action, String playerId, int minimum, int maximum, int count, Filter... filters) {
super(action.getActionSource(), playerId, "Choose characters to wound", minimum, maximum, filters);
_action = action;
_count = count;
}
@Override
@@ -32,7 +38,8 @@ public class ChooseAndWoundCharactersEffect extends ChooseActiveCardsEffect {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> cards) {
SubAction subAction = new SubAction(_action.getActionSource(), _action.getType());
subAction.appendEffect(new WoundCharactersEffect(_action.getActionSource(), Filters.in(cards)));
for (int i = 0; i < _count; i++)
subAction.appendEffect(new WoundCharactersEffect(_action.getActionSource(), Filters.in(cards)));
game.getActionsEnvironment().addActionToStack(subAction);
}
}