"Plundered Armories"
This commit is contained in:
@@ -0,0 +1,75 @@
|
|||||||
|
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.ChooseAndPlayCardFromDiscardEffect;
|
||||||
|
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.timing.Action;
|
||||||
|
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||||
|
import com.gempukku.lotro.logic.timing.results.DiscardCardsFromPlayResult;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set: The Fellowship of the Ring
|
||||||
|
* Side: Shadow
|
||||||
|
* Culture: Moria
|
||||||
|
* Twilight Cost: 2
|
||||||
|
* Type: Condition
|
||||||
|
* Game Text: Plays to your support area. Response: If your [MORIA] weapon is discarded, play it from your discard pile
|
||||||
|
* (that weapon's twilight cost is -1).
|
||||||
|
*/
|
||||||
|
public class Card1_193 extends AbstractLotroCardBlueprint {
|
||||||
|
public Card1_193() {
|
||||||
|
super(Side.SHADOW, CardType.CONDITION, Culture.MORIA, "Plundered Armories");
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||||
|
if (PlayConditions.canPlayCardDuringPhase(game, Phase.SHADOW, self)
|
||||||
|
&& checkPlayRequirements(playerId, game, self, 0))
|
||||||
|
return Collections.singletonList(getPlayCardAction(playerId, game, self, 0));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends Action> getOptionalAfterActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||||
|
if (effectResult.getType() == EffectResult.Type.DISCARD_FROM_PLAY) {
|
||||||
|
DiscardCardsFromPlayResult discardResult = (DiscardCardsFromPlayResult) effectResult;
|
||||||
|
List<PhysicalCard> discardedCards = discardResult.getDiscardedCards();
|
||||||
|
if (Filters.filter(discardedCards, game.getGameState(), game.getModifiersQuerying(), Filters.zone(Zone.DISCARD), Filters.culture(Culture.MORIA), Filters.or(Filters.keyword(Keyword.HAND_WEAPON), Filters.keyword(Keyword.RANGED_WEAPON)), Filters.playable(game, -1)).size() > 0) {
|
||||||
|
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, null, "Play your discarded weapon from your discard pile (twilight cost -1).");
|
||||||
|
action.addEffect(
|
||||||
|
new ChooseAndPlayCardFromDiscardEffect(playerId,
|
||||||
|
Filters.and(
|
||||||
|
Filters.culture(Culture.MORIA),
|
||||||
|
Filters.or(Filters.keyword(Keyword.HAND_WEAPON), Filters.keyword(Keyword.RANGED_WEAPON)),
|
||||||
|
Filters.in(discardedCards)), -1));
|
||||||
|
return Collections.singletonList(action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.gempukku.lotro.logic.actions;
|
||||||
|
|
||||||
|
import com.gempukku.lotro.game.PhysicalCard;
|
||||||
|
import com.gempukku.lotro.logic.effects.DiscardCardFromPlayEffect;
|
||||||
|
|
||||||
|
public class DiscardMinionFromPlayAction extends DefaultCostToEffectAction {
|
||||||
|
public DiscardMinionFromPlayAction(PhysicalCard card) {
|
||||||
|
super(null, null, "Discard the minion");
|
||||||
|
|
||||||
|
addEffect(new DiscardCardFromPlayEffect(null, card));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,19 +4,34 @@ import com.gempukku.lotro.common.Zone;
|
|||||||
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.GameState;
|
||||||
import com.gempukku.lotro.game.state.LotroGame;
|
import com.gempukku.lotro.game.state.LotroGame;
|
||||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||||
|
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||||
|
import com.gempukku.lotro.logic.timing.results.DiscardCardsFromPlayResult;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DiscardCardFromPlayEffect extends UnrespondableEffect {
|
public class DiscardCardFromPlayEffect extends AbstractEffect {
|
||||||
private PhysicalCard _source;
|
private PhysicalCard _source;
|
||||||
private PhysicalCard _card;
|
private PhysicalCard _card;
|
||||||
|
|
||||||
|
private List<PhysicalCard> _discardedCards;
|
||||||
|
|
||||||
public DiscardCardFromPlayEffect(PhysicalCard source, PhysicalCard card) {
|
public DiscardCardFromPlayEffect(PhysicalCard source, PhysicalCard card) {
|
||||||
_source = source;
|
_source = source;
|
||||||
_card = card;
|
_card = card;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EffectResult getRespondableResult() {
|
||||||
|
return new DiscardCardsFromPlayResult(_discardedCards);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText() {
|
||||||
|
return "Discard " + _card.getBlueprint().getName() + " from play";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayEffect(LotroGame game) {
|
public boolean canPlayEffect(LotroGame game) {
|
||||||
Zone zone = _card.getZone();
|
Zone zone = _card.getZone();
|
||||||
@@ -25,7 +40,11 @@ public class DiscardCardFromPlayEffect extends UnrespondableEffect {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playEffect(LotroGame game) {
|
public void playEffect(LotroGame game) {
|
||||||
|
_discardedCards = new LinkedList<PhysicalCard>();
|
||||||
|
|
||||||
if (game.getModifiersQuerying().canBeDiscardedFromPlay(game.getGameState(), _card, _source)) {
|
if (game.getModifiersQuerying().canBeDiscardedFromPlay(game.getGameState(), _card, _source)) {
|
||||||
|
_discardedCards.add(_card);
|
||||||
|
|
||||||
GameState gameState = game.getGameState();
|
GameState gameState = game.getGameState();
|
||||||
gameState.stopAffecting(_card);
|
gameState.stopAffecting(_card);
|
||||||
gameState.removeCardFromZone(_card);
|
gameState.removeCardFromZone(_card);
|
||||||
@@ -33,6 +52,8 @@ public class DiscardCardFromPlayEffect extends UnrespondableEffect {
|
|||||||
|
|
||||||
List<PhysicalCard> attachedCards = gameState.getAttachedCards(_card);
|
List<PhysicalCard> attachedCards = gameState.getAttachedCards(_card);
|
||||||
for (PhysicalCard attachedCard : attachedCards) {
|
for (PhysicalCard attachedCard : attachedCards) {
|
||||||
|
_discardedCards.add(attachedCard);
|
||||||
|
|
||||||
gameState.stopAffecting(attachedCard);
|
gameState.stopAffecting(attachedCard);
|
||||||
gameState.removeCardFromZone(attachedCard);
|
gameState.removeCardFromZone(attachedCard);
|
||||||
gameState.addCardToZone(attachedCard, Zone.DISCARD);
|
gameState.addCardToZone(attachedCard, Zone.DISCARD);
|
||||||
|
|||||||
@@ -6,19 +6,33 @@ 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.GameState;
|
||||||
import com.gempukku.lotro.game.state.LotroGame;
|
import com.gempukku.lotro.game.state.LotroGame;
|
||||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||||
|
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||||
|
import com.gempukku.lotro.logic.timing.results.DiscardCardsFromPlayResult;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DiscardCardsFromPlayEffect extends UnrespondableEffect {
|
public class DiscardCardsFromPlayEffect extends AbstractEffect {
|
||||||
private PhysicalCard _source;
|
private PhysicalCard _source;
|
||||||
private Filter _filter;
|
private Filter _filter;
|
||||||
|
private List<PhysicalCard> _discardedCards;
|
||||||
|
|
||||||
public DiscardCardsFromPlayEffect(PhysicalCard source, Filter filter) {
|
public DiscardCardsFromPlayEffect(PhysicalCard source, Filter filter) {
|
||||||
_source = source;
|
_source = source;
|
||||||
_filter = filter;
|
_filter = filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EffectResult getRespondableResult() {
|
||||||
|
return new DiscardCardsFromPlayResult(_discardedCards);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText() {
|
||||||
|
return "Discard multiple cards from play";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayEffect(LotroGame game) {
|
public boolean canPlayEffect(LotroGame game) {
|
||||||
return Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), _filter);
|
return Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), _filter);
|
||||||
@@ -27,8 +41,11 @@ public class DiscardCardsFromPlayEffect extends UnrespondableEffect {
|
|||||||
@Override
|
@Override
|
||||||
public void playEffect(LotroGame game) {
|
public void playEffect(LotroGame game) {
|
||||||
List<PhysicalCard> cardsToDiscard = Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), _filter);
|
List<PhysicalCard> cardsToDiscard = Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), _filter);
|
||||||
|
_discardedCards = new LinkedList<PhysicalCard>();
|
||||||
for (PhysicalCard card : cardsToDiscard) {
|
for (PhysicalCard card : cardsToDiscard) {
|
||||||
if (game.getModifiersQuerying().canBeDiscardedFromPlay(game.getGameState(), card, _source)) {
|
if (game.getModifiersQuerying().canBeDiscardedFromPlay(game.getGameState(), card, _source)) {
|
||||||
|
_discardedCards.add(card);
|
||||||
|
|
||||||
GameState gameState = game.getGameState();
|
GameState gameState = game.getGameState();
|
||||||
gameState.stopAffecting(card);
|
gameState.stopAffecting(card);
|
||||||
gameState.removeCardFromZone(card);
|
gameState.removeCardFromZone(card);
|
||||||
@@ -36,6 +53,8 @@ public class DiscardCardsFromPlayEffect extends UnrespondableEffect {
|
|||||||
|
|
||||||
List<PhysicalCard> attachedCards = gameState.getAttachedCards(card);
|
List<PhysicalCard> attachedCards = gameState.getAttachedCards(card);
|
||||||
for (PhysicalCard attachedCard : attachedCards) {
|
for (PhysicalCard attachedCard : attachedCards) {
|
||||||
|
_discardedCards.add(attachedCard);
|
||||||
|
|
||||||
gameState.stopAffecting(attachedCard);
|
gameState.stopAffecting(attachedCard);
|
||||||
gameState.removeCardFromZone(attachedCard);
|
gameState.removeCardFromZone(attachedCard);
|
||||||
gameState.addCardToZone(attachedCard, Zone.DISCARD);
|
gameState.addCardToZone(attachedCard, Zone.DISCARD);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.gempukku.lotro.logic.timing;
|
|||||||
|
|
||||||
public abstract class EffectResult {
|
public abstract class EffectResult {
|
||||||
public enum Type {
|
public enum Type {
|
||||||
WOUND, KILL, HEAL, EXERT,
|
WOUND, KILL, HEAL, EXERT, DISCARD_FROM_PLAY,
|
||||||
|
|
||||||
OVERWHELM_IN_SKIRMISH, RESOLVE_SKIRMISH,
|
OVERWHELM_IN_SKIRMISH, RESOLVE_SKIRMISH,
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.gempukku.lotro.logic.timing.results;
|
||||||
|
|
||||||
|
import com.gempukku.lotro.game.PhysicalCard;
|
||||||
|
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DiscardCardsFromPlayResult extends EffectResult {
|
||||||
|
private List<PhysicalCard> _cards;
|
||||||
|
|
||||||
|
public DiscardCardsFromPlayResult(List<PhysicalCard> cards) {
|
||||||
|
super(EffectResult.Type.DISCARD_FROM_PLAY);
|
||||||
|
_cards = cards;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PhysicalCard> getDiscardedCards() {
|
||||||
|
return _cards;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
package com.gempukku.lotro.logic.timing.rules;
|
package com.gempukku.lotro.logic.timing.rules;
|
||||||
|
|
||||||
import com.gempukku.lotro.common.CardType;
|
import com.gempukku.lotro.common.CardType;
|
||||||
|
import com.gempukku.lotro.common.Side;
|
||||||
import com.gempukku.lotro.filters.Filters;
|
import com.gempukku.lotro.filters.Filters;
|
||||||
import com.gempukku.lotro.game.AbstractActionProxy;
|
import com.gempukku.lotro.game.AbstractActionProxy;
|
||||||
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.GameState;
|
||||||
import com.gempukku.lotro.game.state.LotroGame;
|
import com.gempukku.lotro.game.state.LotroGame;
|
||||||
import com.gempukku.lotro.game.state.actions.DefaultActionsEnvironment;
|
import com.gempukku.lotro.game.state.actions.DefaultActionsEnvironment;
|
||||||
|
import com.gempukku.lotro.logic.actions.DiscardMinionFromPlayAction;
|
||||||
import com.gempukku.lotro.logic.actions.KillAction;
|
import com.gempukku.lotro.logic.actions.KillAction;
|
||||||
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;
|
||||||
@@ -34,7 +36,11 @@ public class CharacterDeathRule {
|
|||||||
Filters.or(Filters.type(CardType.ALLY), Filters.type(CardType.COMPANION), Filters.type(CardType.MINION)));
|
Filters.or(Filters.type(CardType.ALLY), Filters.type(CardType.COMPANION), Filters.type(CardType.MINION)));
|
||||||
for (PhysicalCard character : characters)
|
for (PhysicalCard character : characters)
|
||||||
if (gameState.getWounds(character) >= game.getModifiersQuerying().getVitality(gameState, character))
|
if (gameState.getWounds(character) >= game.getModifiersQuerying().getVitality(gameState, character))
|
||||||
actions.add(new KillAction(character));
|
if (character.getBlueprint().getSide() == Side.FREE_PEOPLE) {
|
||||||
|
actions.add(new KillAction(character));
|
||||||
|
} else {
|
||||||
|
actions.add(new DiscardMinionFromPlayAction(character));
|
||||||
|
}
|
||||||
|
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user