Making effects into real ones.
This commit is contained in:
@@ -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<Effect> preCostEffects = new LinkedList<Effect>();
|
||||
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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<PhysicalCard> 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<PhysicalCard>(discard), 1, 1) {
|
||||
@Override
|
||||
public void decisionMade(String result) throws DecisionResultInvalidException {
|
||||
List<PhysicalCard> 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<PhysicalCard> discard = getPlayableInDiscard(game);
|
||||
if (discard.size() > 0) {
|
||||
game.getUserFeedback().sendAwaitingDecision(_playerId,
|
||||
new ArbitraryCardsSelectionDecision(1, "Choose a card to play", new LinkedList<PhysicalCard>(discard), 1, 1) {
|
||||
@Override
|
||||
public void decisionMade(String result) throws DecisionResultInvalidException {
|
||||
List<PhysicalCard> 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<PhysicalCard> getPlayableInDiscard(LotroGame game) {
|
||||
return Filters.filter(game.getGameState().getDiscard(_playerId), game.getGameState(), game.getModifiersQuerying(), _filter, Filters.playable(game, _twilightModifier));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<PhysicalCard> 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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user