"Goblin Swarms"
This commit is contained in:
@@ -18,7 +18,7 @@ import com.gempukku.lotro.logic.timing.results.WoundResult;
|
||||
import java.util.List;
|
||||
|
||||
public class PlayConditions {
|
||||
private static boolean nonPlayZone(Zone zone) {
|
||||
public static boolean nonPlayZone(Zone zone) {
|
||||
return zone != Zone.SHADOW_CHARACTERS && zone != Zone.SHADOW_SUPPORT
|
||||
&& zone != Zone.FREE_SUPPORT && zone != Zone.FREE_CHARACTERS
|
||||
&& zone != Zone.ATTACHED && zone != Zone.ADVENTURE_PATH;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.common.Zone;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
@@ -13,6 +14,11 @@ public class StackCardFromHandEffect extends UnrespondableEffect {
|
||||
_stackOn = stackOn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayEffect(LotroGame game) {
|
||||
return _card.getZone() == Zone.HAND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEffect(LotroGame game) {
|
||||
game.getGameState().removeCardFromZone(_card);
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.common.Zone;
|
||||
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.UnrespondableEffect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class StackCardFromPlayEffect extends UnrespondableEffect {
|
||||
private PhysicalCard _card;
|
||||
private PhysicalCard _stackOn;
|
||||
|
||||
public StackCardFromPlayEffect(PhysicalCard card, PhysicalCard stackOn) {
|
||||
_card = card;
|
||||
_stackOn = stackOn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayEffect(LotroGame game) {
|
||||
return !PlayConditions.nonPlayZone(_card.getZone());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEffect(LotroGame game) {
|
||||
game.getGameState().stopAffecting(_card);
|
||||
game.getGameState().removeCardFromZone(_card);
|
||||
|
||||
GameState gameState = game.getGameState();
|
||||
|
||||
List<PhysicalCard> attachedCards = gameState.getAttachedCards(_card);
|
||||
for (PhysicalCard attachedCard : attachedCards) {
|
||||
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);
|
||||
}
|
||||
|
||||
game.getGameState().stackCard(_card, _stackOn);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.gempukku.lotro.cards.set1.moria;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractLotroCardBlueprint;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.actions.PlayPermanentAction;
|
||||
import com.gempukku.lotro.cards.effects.ChooseArbitraryCardsEffect;
|
||||
import com.gempukku.lotro.cards.effects.StackCardFromPlayEffect;
|
||||
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.ChooseActiveCardEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: The Fellowship of the Ring
|
||||
* Side: Shadow
|
||||
* Culture: Moria
|
||||
* Twilight Cost: 1
|
||||
* Type: Condition
|
||||
* Game Text: Plays to your support area. Response: If your [MORIA] Orc wins a skirmish, discard cards and wounds on
|
||||
* that Orc and stack that Orc on this condition. Shadow: Play an Orc stacked here as if played from hand.
|
||||
*/
|
||||
public class Card1_183 extends AbstractLotroCardBlueprint {
|
||||
public Card1_183() {
|
||||
super(Side.SHADOW, CardType.CONDITION, Culture.MORIA, "Goblin Swarms");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
|
||||
return PlayConditions.canPayForShadowCard(game, self, twilightModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Action getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
|
||||
return new PlayPermanentAction(self, Zone.SHADOW_SUPPORT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTwilightCost() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getPhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
|
||||
if (PlayConditions.canPlayCardDuringPhase(game, Phase.SHADOW, self)
|
||||
&& checkPlayRequirements(playerId, game, self, 0))
|
||||
return Collections.singletonList(getPlayCardAction(playerId, game, self, 0));
|
||||
|
||||
List<PhysicalCard> stackedCards = game.getGameState().getStackedCards(self);
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.SHADOW, self, 0)
|
||||
&& Filters.filter(stackedCards, game.getGameState(), game.getModifiersQuerying(), Filters.playable(game)).size() > 0) {
|
||||
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, null, "Play an Orc stacked here as if played from hand.");
|
||||
action.addEffect(
|
||||
new ChooseArbitraryCardsEffect(playerId, "Choose an Orc to play", stackedCards, Filters.playable(game), 1, 1) {
|
||||
@Override
|
||||
protected void cardsSelected(List<PhysicalCard> stackedOrcs) {
|
||||
PhysicalCard stackedOrc = stackedOrcs.get(0);
|
||||
game.getActionsEnvironment().addActionToStack(stackedOrc.getBlueprint().getPlayCardAction(playerId, game, stackedOrc, 0));
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getOptionalAfterActions(String playerId, LotroGame game, EffectResult effectResult, final PhysicalCard self) {
|
||||
if (PlayConditions.winsSkirmish(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.and(Filters.culture(Culture.MORIA), Filters.keyword(Keyword.ORC)))) {
|
||||
List<PhysicalCard> shadowCharacters = game.getGameState().getSkirmish().getShadowCharacters();
|
||||
final DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, null, "Stack winning MORIA Orc on this condition");
|
||||
action.addEffect(
|
||||
new ChooseActiveCardEffect(playerId, "Choose a MORIA Orc", Filters.culture(Culture.MORIA), Filters.keyword(Keyword.ORC), Filters.in(shadowCharacters)) {
|
||||
@Override
|
||||
protected void cardSelected(PhysicalCard moriaOrc) {
|
||||
action.addEffect(new StackCardFromPlayEffect(moriaOrc, self));
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,12 @@ public class DiscardCardFromPlayEffect extends UnrespondableEffect {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user