diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/actions/PlayEventAction.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/actions/PlayEventAction.java index c18f09347..9c2f33eb8 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/actions/PlayEventAction.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/actions/PlayEventAction.java @@ -10,6 +10,7 @@ import com.gempukku.lotro.logic.GameUtils; import com.gempukku.lotro.logic.actions.AbstractCostToEffectAction; import com.gempukku.lotro.logic.effects.PlayEventEffect; import com.gempukku.lotro.logic.effects.SendMessageEffect; +import com.gempukku.lotro.logic.effects.SendPlayEventMessageEffect; import com.gempukku.lotro.logic.timing.AbstractSuccessfulEffect; import com.gempukku.lotro.logic.timing.Effect; import com.gempukku.lotro.logic.timing.EffectResult; @@ -37,6 +38,7 @@ public class PlayEventAction extends AbstractCostToEffectAction { List preCostEffects = new LinkedList(); preCostEffects.add(new SendMessageEffect(card.getOwner() + " plays " + GameUtils.getCardLink(card) + " from " + card.getZone().getHumanReadable())); + preCostEffects.add(new SendPlayEventMessageEffect(card)); preCostEffects.add(new RemoveCardFromZoneEffect(card)); appendCost(new PayTwilightCostEffect(card)); if (card.getZone() == Zone.DECK) diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/CancelActivatedEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/CancelActivatedEffect.java index 8ac3e1eb3..d9db6d07d 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/CancelActivatedEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/CancelActivatedEffect.java @@ -1,23 +1,43 @@ package com.gempukku.lotro.cards.effects; +import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.GameUtils; import com.gempukku.lotro.logic.effects.ActivateCardEffect; -import com.gempukku.lotro.logic.timing.UnrespondableEffect; +import com.gempukku.lotro.logic.timing.AbstractEffect; +import com.gempukku.lotro.logic.timing.EffectResult; -public class CancelActivatedEffect extends UnrespondableEffect { - private String _playerId; +public class CancelActivatedEffect extends AbstractEffect { + private PhysicalCard _source; private ActivateCardEffect _effect; - public CancelActivatedEffect(String playerId, ActivateCardEffect effect) { - _playerId = playerId; + public CancelActivatedEffect(PhysicalCard source, ActivateCardEffect effect) { + _source = source; _effect = effect; } @Override - public void doPlayEffect(LotroGame game) { - if (!_effect.isCancelled()) { - game.getGameState().sendMessage(_playerId + " cancels effect - " + _effect.getText(game)); + public boolean isPlayableInFull(LotroGame game) { + return !_effect.isCancelled(); + } + + @Override + public String getText(LotroGame game) { + return "Cancel effect of " + _effect.getText(game); + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + protected FullEffectResult playEffectReturningResult(LotroGame game) { + if (isPlayableInFull(game)) { + game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " cancels effect - " + _effect.getText(game)); _effect.cancel(); + return new FullEffectResult(null, true, true); } + return new FullEffectResult(null, false, false); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/CancelEventEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/CancelEventEffect.java index 834e68d49..f40ac8cbe 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/CancelEventEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/CancelEventEffect.java @@ -1,23 +1,43 @@ package com.gempukku.lotro.cards.effects; +import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.GameUtils; import com.gempukku.lotro.logic.effects.PlayEventEffect; -import com.gempukku.lotro.logic.timing.UnrespondableEffect; +import com.gempukku.lotro.logic.timing.AbstractEffect; +import com.gempukku.lotro.logic.timing.EffectResult; -public class CancelEventEffect extends UnrespondableEffect { - private String _playerId; +public class CancelEventEffect extends AbstractEffect { + private PhysicalCard _source; private PlayEventEffect _effect; - public CancelEventEffect(String playerId, PlayEventEffect effect) { - _playerId = playerId; + public CancelEventEffect(PhysicalCard source, PlayEventEffect effect) { + _source = source; _effect = effect; } @Override - public void doPlayEffect(LotroGame game) { + public boolean isPlayableInFull(LotroGame game) { + return !_effect.isCancelled(); + } + + @Override + public String getText(LotroGame game) { + return "Cancel effect - " + _effect.getText(game); + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + protected FullEffectResult playEffectReturningResult(LotroGame game) { if (!_effect.isCancelled()) { - game.getGameState().sendMessage(_playerId + " cancels effect - " + _effect.getText(game)); + game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " cancels effect - " + _effect.getText(game)); _effect.cancel(); + return new FullEffectResult(null, true, true); } + return new FullEffectResult(null, false, false); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/ChooseAndPlayCardFromDiscardEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/ChooseAndPlayCardFromDiscardEffect.java index 61feb648f..f05e4fb21 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/ChooseAndPlayCardFromDiscardEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/ChooseAndPlayCardFromDiscardEffect.java @@ -6,13 +6,14 @@ import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.game.state.LotroGame; import com.gempukku.lotro.logic.decisions.ArbitraryCardsSelectionDecision; import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException; -import com.gempukku.lotro.logic.timing.UnrespondableEffect; +import com.gempukku.lotro.logic.timing.AbstractEffect; +import com.gempukku.lotro.logic.timing.EffectResult; import java.util.Collection; import java.util.LinkedList; import java.util.List; -public class ChooseAndPlayCardFromDiscardEffect extends UnrespondableEffect { +public class ChooseAndPlayCardFromDiscardEffect extends AbstractEffect { private String _playerId; private Filter _filter; private int _twilightModifier; @@ -34,18 +35,36 @@ public class ChooseAndPlayCardFromDiscardEffect extends UnrespondableEffect { } @Override - public void doPlayEffect(final LotroGame game) { - Collection discard = Filters.filter(game.getGameState().getDiscard(_playerId), game.getGameState(), game.getModifiersQuerying(), _filter, Filters.playable(game, _twilightModifier)); - game.getUserFeedback().sendAwaitingDecision(_playerId, - new ArbitraryCardsSelectionDecision(1, "Choose a card to play", new LinkedList(discard), 1, 1) { - @Override - public void decisionMade(String result) throws DecisionResultInvalidException { - List selectedCards = getSelectedCardsByResponse(result); - if (selectedCards.size() > 0) { - PhysicalCard selectedCard = selectedCards.get(0); - game.getActionsEnvironment().addActionToStack(selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier)); + public boolean isPlayableInFull(LotroGame game) { + return getPlayableInDiscard(game).size() > 0; + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + protected FullEffectResult playEffectReturningResult(final LotroGame game) { + Collection discard = getPlayableInDiscard(game); + if (discard.size() > 0) { + game.getUserFeedback().sendAwaitingDecision(_playerId, + new ArbitraryCardsSelectionDecision(1, "Choose a card to play", new LinkedList(discard), 1, 1) { + @Override + public void decisionMade(String result) throws DecisionResultInvalidException { + List selectedCards = getSelectedCardsByResponse(result); + if (selectedCards.size() > 0) { + PhysicalCard selectedCard = selectedCards.get(0); + game.getActionsEnvironment().addActionToStack(selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier)); + } } - } - }); + }); + return new FullEffectResult(null, true, true); + } + return new FullEffectResult(null, false, false); + } + + private Collection getPlayableInDiscard(LotroGame game) { + return Filters.filter(game.getGameState().getDiscard(_playerId), game.getGameState(), game.getModifiersQuerying(), _filter, Filters.playable(game, _twilightModifier)); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/DiscardCardFromDeckEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/DiscardCardFromDeckEffect.java index 689b4a8f2..dcef0972c 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/DiscardCardFromDeckEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/DiscardCardFromDeckEffect.java @@ -5,9 +5,10 @@ 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.GameUtils; -import com.gempukku.lotro.logic.timing.UnrespondableEffect; +import com.gempukku.lotro.logic.timing.AbstractEffect; +import com.gempukku.lotro.logic.timing.EffectResult; -public class DiscardCardFromDeckEffect extends UnrespondableEffect { +public class DiscardCardFromDeckEffect extends AbstractEffect { private PhysicalCard _card; public DiscardCardFromDeckEffect(PhysicalCard card) { @@ -15,12 +16,29 @@ public class DiscardCardFromDeckEffect extends UnrespondableEffect { } @Override - public void doPlayEffect(LotroGame game) { - if (game.getGameState().getDeck(_card.getOwner()).contains(_card)) { + public boolean isPlayableInFull(LotroGame game) { + return _card.getZone() == Zone.DECK; + } + + @Override + public String getText(LotroGame game) { + return "Discard " + GameUtils.getCardLink(_card) + " from deck"; + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + protected FullEffectResult playEffectReturningResult(LotroGame game) { + if (isPlayableInFull(game)) { GameState gameState = game.getGameState(); gameState.sendMessage(GameUtils.getCardLink(_card) + " gets discarded from deck"); gameState.removeCardFromZone(_card); gameState.addCardToZone(_card, Zone.DISCARD); + return new FullEffectResult(null, true, true); } + return new FullEffectResult(null, false, false); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PlaySiteEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PlaySiteEffect.java index e38365e32..260dc896c 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PlaySiteEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PlaySiteEffect.java @@ -7,27 +7,52 @@ 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.GameUtils; -import com.gempukku.lotro.logic.timing.UnrespondableEffect; +import com.gempukku.lotro.logic.timing.AbstractEffect; +import com.gempukku.lotro.logic.timing.EffectResult; +import java.util.Collection; import java.util.LinkedList; import java.util.List; -public class PlaySiteEffect extends UnrespondableEffect { +public class PlaySiteEffect extends AbstractEffect { private String _playerId; + private Block _siteBlock; private int _siteNumber; public PlaySiteEffect(String playerId, Block siteBlock, int siteNumber) { _playerId = playerId; + _siteBlock = siteBlock; _siteNumber = siteNumber; } + private PhysicalCard getMatchingSite(LotroGame game) { + Collection matching = Filters.filter(game.getGameState().getAdventureDeck(_playerId), game.getGameState(), game.getModifiersQuerying(), Filters.siteNumber(_siteNumber), Filters.siteBlock(_siteBlock)); + if (matching.size() > 0) + return matching.iterator().next(); + else + return null; + } + @Override - public void doPlayEffect(LotroGame game) { + public boolean isPlayableInFull(LotroGame game) { + return getMatchingSite(game) != null; + } + + @Override + public String getText(LotroGame game) { + return "Play site"; + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + protected FullEffectResult playEffectReturningResult(LotroGame game) { GameState gameState = game.getGameState(); - PhysicalCard newSite = Filters.filter(gameState.getAdventureDeck(_playerId), game.getGameState(), game.getModifiersQuerying(), Filters.siteNumber(_siteNumber)).iterator().next(); + PhysicalCard newSite = getMatchingSite(game); if (newSite != null) { - - PhysicalCard card = gameState.getSite(_siteNumber); Zone zone = null; @@ -56,6 +81,14 @@ public class PlaySiteEffect extends UnrespondableEffect { for (PhysicalCard physicalCard : stacked) gameState.stackCard(physicalCard, newSite); } + + sitePlayedCallback(newSite); + return new FullEffectResult(null, true, true); } + return new FullEffectResult(null, false, false); + } + + protected void sitePlayedCallback(PhysicalCard site) { + } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromDeckOnBottomOfDeckEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromDeckOnBottomOfDeckEffect.java index abcfb8bcf..2f2694919 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromDeckOnBottomOfDeckEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromDeckOnBottomOfDeckEffect.java @@ -5,9 +5,10 @@ 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.GameUtils; -import com.gempukku.lotro.logic.timing.UnrespondableEffect; +import com.gempukku.lotro.logic.timing.AbstractEffect; +import com.gempukku.lotro.logic.timing.EffectResult; -public class PutCardFromDeckOnBottomOfDeckEffect extends UnrespondableEffect { +public class PutCardFromDeckOnBottomOfDeckEffect extends AbstractEffect { private PhysicalCard _source; private PhysicalCard _physicalCard; @@ -22,12 +23,24 @@ public class PutCardFromDeckOnBottomOfDeckEffect extends UnrespondableEffect { } @Override - public void doPlayEffect(LotroGame game) { + public String getText(LotroGame game) { + return "Put " + GameUtils.getCardLink(_physicalCard) + " on the bottom of draw deck"; + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + protected FullEffectResult playEffectReturningResult(LotroGame game) { if (isPlayableInFull(game)) { GameState gameState = game.getGameState(); gameState.sendMessage(_physicalCard.getOwner() + " puts " + GameUtils.getCardLink(_physicalCard) + " from deck on the bottom of deck"); gameState.removeCardFromZone(_physicalCard); gameState.putCardOnBottomOfDeck(_physicalCard); + return new FullEffectResult(null, true, true); } + return new FullEffectResult(null, false, false); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromDiscardOnBottomOfDeckEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromDiscardOnBottomOfDeckEffect.java index 2439ba98c..8d3cbfb6f 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromDiscardOnBottomOfDeckEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromDiscardOnBottomOfDeckEffect.java @@ -1,12 +1,14 @@ package com.gempukku.lotro.cards.effects; +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.GameUtils; -import com.gempukku.lotro.logic.timing.UnrespondableEffect; +import com.gempukku.lotro.logic.timing.AbstractEffect; +import com.gempukku.lotro.logic.timing.EffectResult; -public class PutCardFromDiscardOnBottomOfDeckEffect extends UnrespondableEffect { +public class PutCardFromDiscardOnBottomOfDeckEffect extends AbstractEffect { private PhysicalCard _physicalCard; public PutCardFromDiscardOnBottomOfDeckEffect(PhysicalCard physicalCard) { @@ -14,10 +16,29 @@ public class PutCardFromDiscardOnBottomOfDeckEffect extends UnrespondableEffect } @Override - public void doPlayEffect(LotroGame game) { - GameState gameState = game.getGameState(); - gameState.sendMessage(_physicalCard.getOwner() + " puts " + GameUtils.getCardLink(_physicalCard) + " from discard on the bottom of deck"); - gameState.removeCardFromZone(_physicalCard); - gameState.putCardOnBottomOfDeck(_physicalCard); + public boolean isPlayableInFull(LotroGame game) { + return _physicalCard.getZone() == Zone.DISCARD; + } + + @Override + protected FullEffectResult playEffectReturningResult(LotroGame game) { + if (isPlayableInFull(game)) { + GameState gameState = game.getGameState(); + gameState.sendMessage(_physicalCard.getOwner() + " puts " + GameUtils.getCardLink(_physicalCard) + " from discard on the bottom of deck"); + gameState.removeCardFromZone(_physicalCard); + gameState.putCardOnBottomOfDeck(_physicalCard); + return new FullEffectResult(null, true, true); + } + return new FullEffectResult(null, false, false); + } + + @Override + public String getText(LotroGame game) { + return "Put " + GameUtils.getCardLink(_physicalCard) + " from discard on bottom of deck"; + } + + @Override + public EffectResult.Type getType() { + return null; } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromHandOnBottomOfDeckEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromHandOnBottomOfDeckEffect.java index 6429746e2..fc1948578 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromHandOnBottomOfDeckEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromHandOnBottomOfDeckEffect.java @@ -1,11 +1,13 @@ package com.gempukku.lotro.cards.effects; +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 com.gempukku.lotro.logic.timing.AbstractEffect; +import com.gempukku.lotro.logic.timing.EffectResult; -public class PutCardFromHandOnBottomOfDeckEffect extends UnrespondableEffect { +public class PutCardFromHandOnBottomOfDeckEffect extends AbstractEffect { private PhysicalCard _physicalCard; public PutCardFromHandOnBottomOfDeckEffect(PhysicalCard physicalCard) { @@ -13,10 +15,30 @@ public class PutCardFromHandOnBottomOfDeckEffect extends UnrespondableEffect { } @Override - public void doPlayEffect(LotroGame game) { - GameState gameState = game.getGameState(); - gameState.sendMessage(_physicalCard.getOwner() + " puts a card from hand on bottom of his or her deck"); - gameState.removeCardFromZone(_physicalCard); - gameState.putCardOnBottomOfDeck(_physicalCard); + public boolean isPlayableInFull(LotroGame game) { + return _physicalCard.getZone() == Zone.HAND; + } + + @Override + public String getText(LotroGame game) { + return "Put card from hand on bottom of deck"; + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + protected FullEffectResult playEffectReturningResult(LotroGame game) { + if (isPlayableInFull(game)) { + GameState gameState = game.getGameState(); + gameState.sendMessage(_physicalCard.getOwner() + " puts a card from hand on bottom of his or her deck"); + gameState.removeCardFromZone(_physicalCard); + gameState.putCardOnBottomOfDeck(_physicalCard); + + return new FullEffectResult(null, true, true); + } + return new FullEffectResult(null, false, false); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromHandOnTopOfDeckEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromHandOnTopOfDeckEffect.java index 39ee5ba8f..403b97cfc 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromHandOnTopOfDeckEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/PutCardFromHandOnTopOfDeckEffect.java @@ -1,11 +1,14 @@ package com.gempukku.lotro.cards.effects; +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 com.gempukku.lotro.logic.GameUtils; +import com.gempukku.lotro.logic.timing.AbstractEffect; +import com.gempukku.lotro.logic.timing.EffectResult; -public class PutCardFromHandOnTopOfDeckEffect extends UnrespondableEffect { +public class PutCardFromHandOnTopOfDeckEffect extends AbstractEffect { private PhysicalCard _physicalCard; public PutCardFromHandOnTopOfDeckEffect(PhysicalCard physicalCard) { @@ -13,10 +16,29 @@ public class PutCardFromHandOnTopOfDeckEffect extends UnrespondableEffect { } @Override - public void doPlayEffect(LotroGame game) { - GameState gameState = game.getGameState(); - gameState.sendMessage(_physicalCard.getOwner() + " puts a card from hand on top of his or her deck"); - gameState.removeCardFromZone(_physicalCard); - gameState.putCardOnTopOfDeck(_physicalCard); + public boolean isPlayableInFull(LotroGame game) { + return _physicalCard.getZone() == Zone.HAND; + } + + @Override + public String getText(LotroGame game) { + return "Put " + GameUtils.getCardLink(_physicalCard) + " from hand on top of deck"; + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + protected FullEffectResult playEffectReturningResult(LotroGame game) { + if (isPlayableInFull(game)) { + GameState gameState = game.getGameState(); + gameState.sendMessage(_physicalCard.getOwner() + " puts a card from hand on top of his or her deck"); + gameState.removeCardFromZone(_physicalCard); + gameState.putCardOnTopOfDeck(_physicalCard); + return new FullEffectResult(null, true, true); + } + return new FullEffectResult(null, false, false); } } \ No newline at end of file diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/StackCardFromDiscardEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/StackCardFromDiscardEffect.java index 20d845ff7..5afdb23ea 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/StackCardFromDiscardEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/StackCardFromDiscardEffect.java @@ -4,9 +4,10 @@ import com.gempukku.lotro.common.Zone; 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.UnrespondableEffect; +import com.gempukku.lotro.logic.timing.AbstractEffect; +import com.gempukku.lotro.logic.timing.EffectResult; -public class StackCardFromDiscardEffect extends UnrespondableEffect { +public class StackCardFromDiscardEffect extends AbstractEffect { private PhysicalCard _card; private PhysicalCard _stackOn; @@ -16,11 +17,28 @@ public class StackCardFromDiscardEffect extends UnrespondableEffect { } @Override - public void doPlayEffect(LotroGame game) { - if (_card.getZone() == Zone.DISCARD) { + public boolean isPlayableInFull(LotroGame game) { + return _card.getZone() == Zone.DISCARD && _stackOn.getZone().isInPlay(); + } + + @Override + public String getText(LotroGame game) { + return "Stack " + GameUtils.getCardLink(_card) + " from discard on " + GameUtils.getCardLink(_stackOn); + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + protected FullEffectResult playEffectReturningResult(LotroGame game) { + if (isPlayableInFull(game)) { game.getGameState().sendMessage(_card.getOwner() + " stacks " + GameUtils.getCardLink(_card) + " from discard on " + GameUtils.getCardLink(_stackOn)); game.getGameState().removeCardFromZone(_card); game.getGameState().stackCard(_card, _stackOn); + return new FullEffectResult(null, true, true); } + return new FullEffectResult(null, false, false); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/StackCardFromHandEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/StackCardFromHandEffect.java index fd185d5c8..6f0d36bd0 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/StackCardFromHandEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/StackCardFromHandEffect.java @@ -4,9 +4,10 @@ import com.gempukku.lotro.common.Zone; 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.UnrespondableEffect; +import com.gempukku.lotro.logic.timing.AbstractEffect; +import com.gempukku.lotro.logic.timing.EffectResult; -public class StackCardFromHandEffect extends UnrespondableEffect { +public class StackCardFromHandEffect extends AbstractEffect { private PhysicalCard _card; private PhysicalCard _stackOn; @@ -16,11 +17,28 @@ public class StackCardFromHandEffect extends UnrespondableEffect { } @Override - public void doPlayEffect(LotroGame game) { - if (_card.getZone() == Zone.HAND) { + protected FullEffectResult playEffectReturningResult(LotroGame game) { + if (isPlayableInFull(game)) { game.getGameState().sendMessage(_card.getOwner() + " stacks " + GameUtils.getCardLink(_card) + " from hand on " + GameUtils.getCardLink(_stackOn)); game.getGameState().removeCardFromZone(_card); game.getGameState().stackCard(_card, _stackOn); + return new FullEffectResult(null, true, true); } + return new FullEffectResult(null, false, false); + } + + @Override + public String getText(LotroGame game) { + return "Stack " + GameUtils.getCardLink(_card) + " from hand on " + GameUtils.getCardLink(_stackOn); + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + public boolean isPlayableInFull(LotroGame game) { + return _card.getZone() == Zone.HAND; } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/StackCardFromPlayEffect.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/StackCardFromPlayEffect.java index d0244d8fe..74fb29656 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/StackCardFromPlayEffect.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/effects/StackCardFromPlayEffect.java @@ -1,16 +1,16 @@ 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.GameUtils; -import com.gempukku.lotro.logic.timing.UnrespondableEffect; +import com.gempukku.lotro.logic.timing.AbstractEffect; +import com.gempukku.lotro.logic.timing.EffectResult; import java.util.List; -public class StackCardFromPlayEffect extends UnrespondableEffect { +public class StackCardFromPlayEffect extends AbstractEffect { private PhysicalCard _card; private PhysicalCard _stackOn; @@ -20,8 +20,23 @@ public class StackCardFromPlayEffect extends UnrespondableEffect { } @Override - public void doPlayEffect(LotroGame game) { - if (!PlayConditions.nonPlayZone(_card.getZone())) { + public String getText(LotroGame game) { + return "Stack " + GameUtils.getCardLink(_card) + " on " + GameUtils.getCardLink(_stackOn); + } + + @Override + public EffectResult.Type getType() { + return null; + } + + @Override + public boolean isPlayableInFull(LotroGame game) { + return _card.getZone().isInPlay() && _stackOn.getZone().isInPlay(); + } + + @Override + protected FullEffectResult playEffectReturningResult(LotroGame game) { + if (isPlayableInFull(game)) { game.getGameState().stopAffecting(_card); game.getGameState().removeCardFromZone(_card); @@ -42,6 +57,9 @@ public class StackCardFromPlayEffect extends UnrespondableEffect { game.getGameState().sendMessage(_card.getOwner() + " stacks " + GameUtils.getCardLink(_card) + " from play on " + GameUtils.getCardLink(_stackOn)); game.getGameState().stackCard(_card, _stackOn); + + return new FullEffectResult(null, true, true); } + return new FullEffectResult(null, false, false); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/gondor/Card1_115.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/gondor/Card1_115.java index 056138b03..4b643c195 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/gondor/Card1_115.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/gondor/Card1_115.java @@ -42,7 +42,7 @@ public class Card1_115 extends AbstractResponseEvent { if (fpCharacter.getBlueprint().getRace() == Race.MAN && fpCharacter.getBlueprint().getCulture() == Culture.GONDOR) { PlayEventAction action = new PlayEventAction(self); - action.appendEffect(new CancelEventEffect(playerId, (PlayEventEffect) effect)); + action.appendEffect(new CancelEventEffect(self, (PlayEventEffect) effect)); return Collections.singletonList(action); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/isengard/Card1_161.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/isengard/Card1_161.java index 5e443e5d6..d63703370 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/isengard/Card1_161.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/isengard/Card1_161.java @@ -64,7 +64,7 @@ public class Card1_161 extends AbstractResponseEvent { action.appendCost( new ChoiceEffect(action, playerId, possibleCosts)); - action.appendEffect(new CancelEventEffect(playerId, (PlayEventEffect) effect)); + action.appendEffect(new CancelEventEffect(self, (PlayEventEffect) effect)); return Collections.singletonList(action); } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/moria/Card1_194.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/moria/Card1_194.java index bc2bab071..b9005fa67 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/moria/Card1_194.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/moria/Card1_194.java @@ -42,7 +42,7 @@ public class Card1_194 extends AbstractResponseEvent { && Filters.countSpottable(game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.MORIA), Filters.type(CardType.MINION)) >= 3 && PlayConditions.canPayForShadowCard(game, self, 0)) { PlayEventAction action = new PlayEventAction(self); - action.appendEffect(new CancelEventEffect(playerId, (PlayEventEffect) effect)); + action.appendEffect(new CancelEventEffect(self, (PlayEventEffect) effect)); return Collections.singletonList(action); } return null; diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/sauron/Card1_261.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/sauron/Card1_261.java index 0261623bd..7cc867f52 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/sauron/Card1_261.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/sauron/Card1_261.java @@ -50,7 +50,7 @@ public class Card1_261 extends AbstractMinion { action.appendCost( new ExertCharactersEffect(self, self)); action.appendEffect( - new CancelEventEffect(playerId, (PlayEventEffect) effect)); + new CancelEventEffect(self, (PlayEventEffect) effect)); return Collections.singletonList(action); } return null; diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/sauron/Card1_275.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/sauron/Card1_275.java index 49ff0da9a..4effc2fa0 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/sauron/Card1_275.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/sauron/Card1_275.java @@ -40,7 +40,7 @@ public class Card1_275 extends AbstractPermanent { action.appendCost( new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.culture(Culture.SAURON), Filters.keyword(Keyword.TRACKER))); action.appendEffect( - new CancelEventEffect(playerId, (PlayEventEffect) effect)); + new CancelEventEffect(self, (PlayEventEffect) effect)); return Collections.singletonList(action); } return null; diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/wraith/Card1_207.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/wraith/Card1_207.java index 0d4eeac94..913f816f2 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/wraith/Card1_207.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/wraith/Card1_207.java @@ -68,7 +68,7 @@ public class Card1_207 extends AbstractPermanent { if (game.getModifiersQuerying().hasKeyword(game.getGameState(), self.getStackedOn(), Keyword.RING_BEARER)) { RequiredTriggerAction action = new RequiredTriggerAction(self); action.appendEffect( - new CancelEventEffect(self.getOwner(), (PlayEventEffect) effect)); + new CancelEventEffect(self, (PlayEventEffect) effect)); return Collections.singletonList(action); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/gandalf/Card2_026.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/gandalf/Card2_026.java index c3cb5af11..0449a351b 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/gandalf/Card2_026.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/gandalf/Card2_026.java @@ -4,6 +4,7 @@ import com.gempukku.lotro.cards.AbstractEvent; import com.gempukku.lotro.cards.actions.PlayEventAction; import com.gempukku.lotro.cards.effects.PlaySiteEffect; import com.gempukku.lotro.common.Culture; +import com.gempukku.lotro.common.Keyword; import com.gempukku.lotro.common.Phase; import com.gempukku.lotro.common.Side; import com.gempukku.lotro.filters.Filters; @@ -32,18 +33,15 @@ public class Card2_026 extends AbstractEvent { } @Override - public PlayEventAction getPlayCardAction(final String playerId, LotroGame game, PhysicalCard self, int twilightModifier) { + public PlayEventAction getPlayCardAction(final String playerId, final LotroGame game, PhysicalCard self, int twilightModifier) { final PlayEventAction action = new PlayEventAction(self); PhysicalCard nextSite = game.getGameState().getSite(game.getGameState().getCurrentSiteNumber() + 1); if (nextSite == null || !nextSite.getOwner().equals(playerId)) { action.appendEffect( new PlaySiteEffect(playerId, null, game.getGameState().getCurrentSiteNumber() + 1) { @Override - public void doPlayEffect(LotroGame game) { - super.doPlayEffect(game); - PhysicalCard nextSiteAfter = game.getGameState().getSite(game.getGameState().getCurrentSiteNumber() + 1); - if (nextSiteAfter != null - && nextSiteAfter.getOwner().equals(playerId)) + protected void sitePlayedCallback(PhysicalCard site) { + if (game.getModifiersQuerying().hasKeyword(game.getGameState(), site, Keyword.UNDERGROUND)) action.appendEffect( new DrawCardEffect(playerId, 1)); } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/isengard/Card2_047.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/isengard/Card2_047.java index aa931e53e..a4e49dfab 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/isengard/Card2_047.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/isengard/Card2_047.java @@ -56,7 +56,7 @@ public class Card2_047 extends AbstractMinion { action.appendCost( new ExertCharactersEffect(self, self)); action.appendEffect( - new CancelEventEffect(playerId, playEffect)); + new CancelEventEffect(self, playEffect)); return Collections.singletonList(action); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/sauron/Card2_089.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/sauron/Card2_089.java index dc0a7014d..07235cb29 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/sauron/Card2_089.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set2/sauron/Card2_089.java @@ -62,7 +62,7 @@ public class Card2_089 extends AbstractMinion { action.appendCost( new ChoiceEffect(action, playerId, possibleCosts)); action.appendEffect( - new CancelEventEffect(playerId, playEffect)); + new CancelEventEffect(self, playEffect)); return Collections.singletonList(action); } } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/isengard/Card4_155.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/isengard/Card4_155.java index 396d4002b..11a4c51c4 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/isengard/Card4_155.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set4/isengard/Card4_155.java @@ -47,7 +47,7 @@ public class Card4_155 extends AbstractResponseEvent { action.appendCost( new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.name("Grima"))); action.appendEffect( - new CancelActivatedEffect(playerId, activateEffect)); + new CancelActivatedEffect(self, activateEffect)); return Collections.singletonList(action); } } diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/effects/PlayCardEffect.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/effects/PlayCardEffect.java index 50a1158b1..4e6eea838 100644 --- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/effects/PlayCardEffect.java +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/effects/PlayCardEffect.java @@ -1,6 +1,5 @@ package com.gempukku.lotro.logic.effects; -import com.gempukku.lotro.common.CardType; import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.game.state.LotroGame; import com.gempukku.lotro.logic.timing.AbstractEffect; @@ -45,8 +44,6 @@ public class PlayCardEffect extends AbstractEffect { @Override protected FullEffectResult playEffectReturningResult(LotroGame game) { - if (_cardPlayed.getBlueprint().getCardType() == CardType.EVENT) - game.getGameState().eventPlayed(_cardPlayed); return new FullEffectResult(new EffectResult[]{new PlayCardResult(_cardPlayed, _attachedToCard)}, true, true); } } diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/effects/SendPlayEventMessageEffect.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/effects/SendPlayEventMessageEffect.java new file mode 100644 index 000000000..2a45ba10b --- /dev/null +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/effects/SendPlayEventMessageEffect.java @@ -0,0 +1,18 @@ +package com.gempukku.lotro.logic.effects; + +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.timing.UnrespondableEffect; + +public class SendPlayEventMessageEffect extends UnrespondableEffect { + private PhysicalCard _card; + + public SendPlayEventMessageEffect(PhysicalCard card) { + _card = card; + } + + @Override + protected void doPlayEffect(LotroGame game) { + game.getGameState().eventPlayed(_card); + } +}