"Trollshaw Forest"
This commit is contained in:
@@ -6,34 +6,33 @@ import com.gempukku.lotro.filters.Filter;
|
||||
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.ChooseActiveCardsEffect;
|
||||
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
|
||||
import com.gempukku.lotro.logic.effects.TriggeringEffect;
|
||||
import com.gempukku.lotro.logic.timing.results.PlayCardResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AttachPermanentAction extends CostToEffectAction {
|
||||
public AttachPermanentAction(final LotroGame game, final PhysicalCard card, Filter filter, final Map<Filter, Integer> attachCostModifiers) {
|
||||
super(card, null, "Attach " + card.getBlueprint().getName() + " from hand");
|
||||
|
||||
addCost(new ChooseActiveCardsEffect(card.getOwner(), "Choose target to attach to", 1, 1, filter) {
|
||||
addCost(new ChooseActiveCardEffect(card.getOwner(), "Choose target to attach to", filter) {
|
||||
@Override
|
||||
protected void cardsSelected(List<PhysicalCard> target) {
|
||||
protected void cardSelected(PhysicalCard target) {
|
||||
addCost(new RemoveCardFromZoneEffect(card));
|
||||
|
||||
int modifier = 0;
|
||||
for (Map.Entry<Filter, Integer> filterIntegerEntry : attachCostModifiers.entrySet())
|
||||
if (filterIntegerEntry.getKey().accepts(game.getGameState(), game.getModifiersQuerying(), target.get(0)))
|
||||
if (filterIntegerEntry.getKey().accepts(game.getGameState(), game.getModifiersQuerying(), target))
|
||||
modifier += filterIntegerEntry.getValue();
|
||||
|
||||
addCost(new PayPlayOnTwilightCostEffect(card, target.get(0), modifier));
|
||||
addCost(new PayPlayOnTwilightCostEffect(card, target, modifier));
|
||||
|
||||
addEffect(new AttachCardFromHandEffect(card, target.get(0)));
|
||||
addEffect(new AttachCardFromHandEffect(card, target));
|
||||
if (card.getZone() == Zone.DECK)
|
||||
addEffect(new ShuffleDeckEffect(card.getOwner()));
|
||||
addEffect(new CardAffectingGameEffect(card));
|
||||
addEffect(new TriggeringEffect(new PlayCardResult(card)));
|
||||
addEffect(new TriggeringEffect(new PlayCardResult(card, target)));
|
||||
|
||||
addFailedCostEffect(new PutCardIntoDiscardEffect(card));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gempukku.lotro.cards.set1.site;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractSite;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
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.DrawCardEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.PlayCardResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: The Fellowship of the Ring
|
||||
* Twilight Cost: 1
|
||||
* Type: Site
|
||||
* Site: 2
|
||||
* Game Text: Forest. Each time you play a possession or artifact on your companion, draw a card.
|
||||
*/
|
||||
public class Card1_338 extends AbstractSite {
|
||||
public Card1_338() {
|
||||
super("Trollshaw Forest", 2, 1, Direction.LEFT);
|
||||
addKeyword(Keyword.FOREST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getRequiredWhenActions(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (PlayConditions.played(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.or(Filters.type(CardType.POSSESSION), Filters.type(CardType.ARTIFACT)))) {
|
||||
PlayCardResult playCardResult = (PlayCardResult) effectResult;
|
||||
PhysicalCard attachedTo = playCardResult.getAttachedTo();
|
||||
if (attachedTo != null && attachedTo.getBlueprint().getCardType() == CardType.COMPANION) {
|
||||
CostToEffectAction action = new CostToEffectAction(self, null, "Draw a card");
|
||||
action.addEffect(new DrawCardEffect(game.getGameState().getCurrentPlayerId()));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,23 @@ import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
public class PlayCardResult extends EffectResult {
|
||||
private PhysicalCard _playedCard;
|
||||
private PhysicalCard _attachedTo;
|
||||
|
||||
public PlayCardResult(PhysicalCard playedCard) {
|
||||
this(playedCard, null);
|
||||
}
|
||||
|
||||
public PlayCardResult(PhysicalCard playedCard, PhysicalCard attachedTo) {
|
||||
super(EffectResult.Type.PLAY);
|
||||
_playedCard = playedCard;
|
||||
_attachedTo = attachedTo;
|
||||
}
|
||||
|
||||
public PhysicalCard getPlayedCard() {
|
||||
return _playedCard;
|
||||
}
|
||||
|
||||
public PhysicalCard getAttachedTo() {
|
||||
return _attachedTo;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user