diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/AbstractPermanent.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/AbstractPermanent.java index bdf988a2a..7e22289ea 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/AbstractPermanent.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/AbstractPermanent.java @@ -59,7 +59,7 @@ public class AbstractPermanent extends AbstractLotroCardBlueprint { return 0; } - protected DiscountEffect getDiscountEffect(Action action, String playerId, LotroGame game, PhysicalCard self) { + protected DiscountEffect getDiscountEffect(PlayPermanentAction action, String playerId, LotroGame game, PhysicalCard self) { return null; } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/discount/OptionalDiscardDiscountEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/discount/OptionalDiscardDiscountEffect.java new file mode 100644 index 000000000..94cebf29a --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/discount/OptionalDiscardDiscountEffect.java @@ -0,0 +1,82 @@ +package com.gempukku.lotro.cards.effects.discount; + +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.effects.DiscountEffect; +import com.gempukku.lotro.cards.effects.OptionalEffect; +import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect; +import com.gempukku.lotro.common.Filterable; +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.actions.SubAction; +import com.gempukku.lotro.logic.timing.AbstractSubActionEffect; +import com.gempukku.lotro.logic.timing.Action; + +import java.util.Collection; + +public class OptionalDiscardDiscountEffect extends AbstractSubActionEffect implements DiscountEffect { + private int _discount; + private boolean _paid; + private int _minimalDiscount; + private String _playerId; + private int _discardCount; + private Filterable[] _discardFilters; + private Action _action; + + public OptionalDiscardDiscountEffect(Action action, int discount, String playerId, int discardCount, Filterable... discardFilters) { + _action = action; + _discount = discount; + _playerId = playerId; + _discardCount = discardCount; + _discardFilters = discardFilters; + } + + @Override + public int getDiscountPaidFor() { + return _paid ? _discount : 0; + } + + @Override + public void setMinimalRequiredDiscount(int minimalDiscount) { + _minimalDiscount = minimalDiscount; + } + + @Override + public String getText(LotroGame game) { + return null; + } + + @Override + public Type getType() { + return null; + } + + @Override + public boolean isPlayableInFull(LotroGame game) { + if (PlayConditions.canDiscardFromPlay(_action.getActionSource(), game, _discardCount, _discardFilters)) + return _minimalDiscount <= _discount; + return _minimalDiscount == 0; + } + + @Override + public void playEffect(LotroGame game) { + if (isPlayableInFull(game)) { + SubAction subAction = new SubAction(_action); + if (PlayConditions.canDiscardFromPlay(_action.getActionSource(), game, _discardCount, _discardFilters)) + subAction.appendEffect( + new OptionalEffect(subAction, _playerId, + new ChooseAndDiscardCardsFromPlayEffect(subAction, _playerId, _discardCount, _discardCount, _discardFilters) { + @Override + protected void cardsToBeDiscardedCallback(Collection cards) { + if (cards.size() == _discardCount) { + _paid = true; + discountPaidCallback(); + } + } + })); + processSubAction(game, subAction); + } + } + + protected void discountPaidCallback() { + } +} diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set13/sauron/Card13_140.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set13/sauron/Card13_140.java index 8836baf20..3d03c1167 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set13/sauron/Card13_140.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set13/sauron/Card13_140.java @@ -1,6 +1,7 @@ package com.gempukku.lotro.cards.set13.sauron; import com.gempukku.lotro.cards.AbstractMinion; +import com.gempukku.lotro.cards.actions.PlayPermanentAction; import com.gempukku.lotro.cards.effects.DiscountEffect; import com.gempukku.lotro.cards.effects.discount.ExertCharactersDiscountEffect; import com.gempukku.lotro.common.CardType; @@ -11,7 +12,6 @@ import com.gempukku.lotro.filters.Filters; import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.game.state.LotroGame; import com.gempukku.lotro.logic.GameUtils; -import com.gempukku.lotro.logic.timing.Action; /** * Set: Bloodlines @@ -38,7 +38,7 @@ public class Card13_140 extends AbstractMinion { } @Override - protected DiscountEffect getDiscountEffect(Action action, String playerId, LotroGame game, PhysicalCard self) { + protected DiscountEffect getDiscountEffect(PlayPermanentAction action, String playerId, LotroGame game, PhysicalCard self) { return new ExertCharactersDiscountEffect(action, self, playerId, GameUtils.getRegion(game.getGameState()), CardType.MINION); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set15/orc/Card15_112.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set15/orc/Card15_112.java new file mode 100644 index 000000000..b3aeb5c10 --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set15/orc/Card15_112.java @@ -0,0 +1,70 @@ +package com.gempukku.lotro.cards.set15.orc; + +import com.gempukku.lotro.cards.AbstractMinion; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.actions.PlayPermanentAction; +import com.gempukku.lotro.cards.effects.AddUntilEndOfTurnModifierEffect; +import com.gempukku.lotro.cards.effects.DiscountEffect; +import com.gempukku.lotro.cards.effects.RemoveTwilightEffect; +import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDiscardEffect; +import com.gempukku.lotro.cards.effects.discount.OptionalDiscardDiscountEffect; +import com.gempukku.lotro.common.*; +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.modifiers.KeywordModifier; +import com.gempukku.lotro.logic.timing.Action; + +import java.util.Collections; +import java.util.List; + +/** + * Set: The Hunters + * Side: Shadow + * Culture: Orc + * Twilight Cost: 10 + * Type: Minion • Troll + * Strength: 22 + * Vitality: 6 + * Site: 5 + * Game Text: When you play this minion, you may discard 5 [ORC] minions from play to make it twilight cost -10 + * and fierce. Shadow: Remove (3) to play an [ORC] Orc from your discard pile. Its twilight cost is -2. + */ +public class Card15_112 extends AbstractMinion { + public Card15_112() { + super(10, 22, 6, 5, Race.TROLL, Culture.ORC, "Mountain-troll"); + } + + @Override + protected int getPotentialExtraPaymentDiscount(String playerId, LotroGame game, PhysicalCard self) { + if (PlayConditions.canDiscardFromPlay(self, game, 5, Culture.ORC, CardType.MINION)) + return 10; + return 0; + } + + @Override + protected DiscountEffect getDiscountEffect(final PlayPermanentAction action, String playerId, LotroGame game, final PhysicalCard self) { + return new OptionalDiscardDiscountEffect(action, 10, playerId, 5, Culture.ORC, CardType.MINION) { + @Override + protected void discountPaidCallback() { + action.appendEffect( + new AddUntilEndOfTurnModifierEffect( + new KeywordModifier(self, self, Keyword.FIERCE))); + } + }; + } + + @Override + protected List getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) { + if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.SHADOW, self, 3) + && PlayConditions.canPlayFromDiscard(playerId, game, 3, -2, Culture.ORC, Race.ORC)) { + ActivateCardAction action = new ActivateCardAction(self); + action.appendCost( + new RemoveTwilightEffect(3)); + action.appendEffect( + new ChooseAndPlayCardFromDiscardEffect(playerId, game, -2, Culture.ORC, Race.ORC)); + return Collections.singletonList(action); + } + return null; + } +} diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set7/sauron/Card7_282.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set7/sauron/Card7_282.java index 474858779..b08b83564 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set7/sauron/Card7_282.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set7/sauron/Card7_282.java @@ -1,13 +1,13 @@ package com.gempukku.lotro.cards.set7.sauron; import com.gempukku.lotro.cards.AbstractMinion; +import com.gempukku.lotro.cards.actions.PlayPermanentAction; import com.gempukku.lotro.cards.effects.DiscountEffect; import com.gempukku.lotro.cards.effects.discount.RemoveThreatsToDiscountEffect; import com.gempukku.lotro.common.Culture; import com.gempukku.lotro.common.Race; import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.game.state.LotroGame; -import com.gempukku.lotro.logic.timing.Action; /** * Set: The Return of the King @@ -31,7 +31,7 @@ public class Card7_282 extends AbstractMinion { } @Override - protected DiscountEffect getDiscountEffect(Action action, String playerId, LotroGame game, PhysicalCard self) { + protected DiscountEffect getDiscountEffect(PlayPermanentAction action, String playerId, LotroGame game, PhysicalCard self) { return new RemoveThreatsToDiscountEffect(action); } }