"Galdor"
This commit is contained in:
@@ -21,17 +21,21 @@ public class ChooseAndHealCharactersEffect extends ChooseActiveCardsEffect {
|
||||
}
|
||||
|
||||
public ChooseAndHealCharactersEffect(CostToEffectAction action, String playerId, int minimum, int maximum, Filter... filters) {
|
||||
super(playerId, "Choose character(s) to heal", minimum, maximum, Filters.and(
|
||||
filters, new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
return modifiersQuerying.canBeHealed(gameState, physicalCard);
|
||||
}
|
||||
}));
|
||||
super(playerId, "Choose character(s) to heal", minimum, maximum, filters);
|
||||
_action = action;
|
||||
_playerId = playerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Filter getExtraFilter() {
|
||||
return new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
return modifiersQuerying.canBeHealed(gameState, physicalCard);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Choose character(s) to heal";
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.logic.actions.CostToEffectAction;
|
||||
import com.gempukku.lotro.logic.effects.ChooseActiveCardsEffect;
|
||||
import com.gempukku.lotro.logic.timing.ChooseableEffect;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class ChooseAndReturnCardsToHandEffect extends ChooseActiveCardsEffect implements ChooseableEffect {
|
||||
private CostToEffectAction _action;
|
||||
|
||||
public ChooseAndReturnCardsToHandEffect(CostToEffectAction action, String playerId, int minimum, int maximum, Filter... filters) {
|
||||
super(playerId, "Choose cards to return to hand", minimum, maximum, filters);
|
||||
_action = action;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cardsSelected(Collection<PhysicalCard> cards) {
|
||||
if (_action.getActionSource() != null)
|
||||
_action.appendEffect(new CardAffectsCardEffect(_action.getActionSource(), cards));
|
||||
_action.appendEffect(new ReturnCardsToHandEffect(_action.getActionSource(), cards.toArray(new PhysicalCard[cards.size()])));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.common.Zone;
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.DiscardCardsFromPlayResult;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ReturnCardsToHandEffect implements Effect {
|
||||
private PhysicalCard _source;
|
||||
private Filter _filter;
|
||||
|
||||
public ReturnCardsToHandEffect(PhysicalCard source, PhysicalCard... cards) {
|
||||
_source = source;
|
||||
List<PhysicalCard> affectedCards = Arrays.asList(cards);
|
||||
_filter = Filters.in(affectedCards);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Return card(s) to hand";
|
||||
}
|
||||
|
||||
@Override
|
||||
public EffectResult.Type getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EffectResult[] playEffect(LotroGame game) {
|
||||
Collection<PhysicalCard> cardsToReturnToHand = Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), _filter);
|
||||
|
||||
Set<PhysicalCard> discardedCards = new HashSet<PhysicalCard>();
|
||||
for (PhysicalCard card : cardsToReturnToHand) {
|
||||
|
||||
GameState gameState = game.getGameState();
|
||||
gameState.stopAffecting(card);
|
||||
gameState.removeCardFromZone(card);
|
||||
gameState.addCardToZone(card, Zone.HAND);
|
||||
|
||||
List<PhysicalCard> attachedCards = gameState.getAttachedCards(card);
|
||||
for (PhysicalCard attachedCard : attachedCards) {
|
||||
discardedCards.add(attachedCard);
|
||||
|
||||
gameState.stopAffecting(attachedCard);
|
||||
gameState.removeCardFromZone(attachedCard);
|
||||
gameState.addCardToZone(attachedCard, Zone.DISCARD);
|
||||
}
|
||||
|
||||
List<PhysicalCard> stackedCards = gameState.getStackedCards(card);
|
||||
for (PhysicalCard stackedCard : stackedCards) {
|
||||
gameState.removeCardFromZone(stackedCard);
|
||||
gameState.addCardToZone(stackedCard, Zone.DISCARD);
|
||||
}
|
||||
}
|
||||
|
||||
if (discardedCards.size() > 0)
|
||||
return new EffectResult[]{new DiscardCardsFromPlayResult(discardedCards)};
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.gempukku.lotro.cards.set3.elven;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAlly;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.costs.ExertCharactersCost;
|
||||
import com.gempukku.lotro.cards.effects.ChooseAndReturnCardsToHandEffect;
|
||||
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.ActivateCardAction;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: Realms of Elf-lords
|
||||
* Side: Free
|
||||
* Culture: Elven
|
||||
* Twilight Cost: 2
|
||||
* Type: Ally • Home 3 • Elf
|
||||
* Strength: 5
|
||||
* Vitality: 2
|
||||
* Site: 3
|
||||
* Game Text: To play, spot an Elf. Regroup: Exert Galdor and spot a minion to return that minion to its owner's hand.
|
||||
*/
|
||||
public class Card3_018 extends AbstractAlly {
|
||||
public Card3_018() {
|
||||
super(2, 3, 5, 2, Race.ELF, Culture.ELVEN, "Galdor", true);
|
||||
}
|
||||
|
||||
@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.race(Race.ELF));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.REGROUP, self)
|
||||
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), self)
|
||||
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.type(CardType.MINION))) {
|
||||
ActivateCardAction action = new ActivateCardAction(self, Keyword.REGROUP);
|
||||
action.appendCost(
|
||||
new ExertCharactersCost(self, self));
|
||||
action.appendEffect(
|
||||
new ChooseAndReturnCardsToHandEffect(action, playerId, 1, 1, Filters.type(CardType.MINION)));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user