Fiddling with actions.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.gempukku.lotro.cards.actions;
|
||||
|
||||
import com.gempukku.lotro.cards.effects.*;
|
||||
import com.gempukku.lotro.cards.effects.AttachCardEffect;
|
||||
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
|
||||
import com.gempukku.lotro.cards.effects.PayPlayOnTwilightCostEffect;
|
||||
import com.gempukku.lotro.cards.effects.ShuffleDeckEffect;
|
||||
import com.gempukku.lotro.common.Zone;
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
@@ -12,15 +15,11 @@ import com.gempukku.lotro.logic.effects.PlayCardEffect;
|
||||
import com.gempukku.lotro.logic.effects.SendMessageEffect;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class AttachPermanentAction extends AbstractCostToEffectAction {
|
||||
private PhysicalCard _source;
|
||||
private PhysicalCard _cardToAttach;
|
||||
|
||||
private Effect _removeCardEffect;
|
||||
private boolean _cardRemoved;
|
||||
|
||||
private ChooseActiveCardEffect _chooseTargetEffect;
|
||||
@@ -34,15 +33,12 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
|
||||
private Effect _playCardEffect;
|
||||
private boolean _cardPlayed;
|
||||
|
||||
private Effect _discardCardEffect;
|
||||
private boolean _cardDiscarded;
|
||||
|
||||
private boolean _exertTarget;
|
||||
|
||||
public AttachPermanentAction(final LotroGame game, final PhysicalCard card, Filter filter, final Map<Filter, Integer> attachCostModifiers, final int twilightModifier) {
|
||||
_source = card;
|
||||
|
||||
_removeCardEffect = new RemoveCardFromZoneEffect(card);
|
||||
_cardToAttach = card;
|
||||
|
||||
_chooseTargetEffect =
|
||||
new ChooseActiveCardEffect(null, card.getOwner(), "Attach " + card.getBlueprint().getName() + ". Choose target to attach to", filter) {
|
||||
@@ -53,7 +49,7 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
|
||||
new ExertCharactersEffect(target, target));
|
||||
}
|
||||
|
||||
_putCardIntoPlayEffect = new AttachCardEffect(_source, target);
|
||||
_putCardIntoPlayEffect = new AttachCardEffect(_cardToAttach, target);
|
||||
|
||||
int modifier = twilightModifier;
|
||||
for (Map.Entry<Filter, Integer> filterIntegerEntry : attachCostModifiers.entrySet())
|
||||
@@ -71,7 +67,6 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
|
||||
_playCardEffect = new PlayCardEffect(card, target);
|
||||
}
|
||||
};
|
||||
_discardCardEffect = new PutCardIntoDiscardEffect(card);
|
||||
}
|
||||
|
||||
public void setExertTarget(boolean exertTarget) {
|
||||
@@ -80,19 +75,19 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
|
||||
|
||||
@Override
|
||||
public PhysicalCard getActionSource() {
|
||||
return _source;
|
||||
return _cardToAttach;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Attach " + _source.getBlueprint().getName();
|
||||
return "Attach " + _cardToAttach.getBlueprint().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
if (!_cardRemoved) {
|
||||
_cardRemoved = true;
|
||||
return _removeCardEffect;
|
||||
game.getGameState().removeCardsFromZone(Collections.singleton(_cardToAttach));
|
||||
}
|
||||
|
||||
if (!_targetChosen) {
|
||||
@@ -125,13 +120,13 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
|
||||
} else {
|
||||
if (!_cardDiscarded) {
|
||||
_cardDiscarded = true;
|
||||
return _discardCardEffect;
|
||||
game.getGameState().addCardToZone(_cardToAttach, Zone.DISCARD);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!_cardDiscarded) {
|
||||
_cardDiscarded = true;
|
||||
return _discardCardEffect;
|
||||
game.getGameState().addCardToZone(_cardToAttach, Zone.DISCARD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.gempukku.lotro.cards.actions;
|
||||
|
||||
import com.gempukku.lotro.cards.effects.PayTwilightCostEffect;
|
||||
import com.gempukku.lotro.cards.effects.RemoveCardFromZoneEffect;
|
||||
import com.gempukku.lotro.cards.effects.ShuffleDeckEffect;
|
||||
import com.gempukku.lotro.common.Zone;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
@@ -11,18 +10,19 @@ 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;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class PlayEventAction extends AbstractCostToEffectAction {
|
||||
private PhysicalCard _source;
|
||||
private PhysicalCard _eventPlayed;
|
||||
private boolean _requiresRanger;
|
||||
|
||||
private boolean _cardRemoved;
|
||||
|
||||
private Iterator<Effect> _preCostIterator;
|
||||
|
||||
private PlayEventEffect _playCardEffect;
|
||||
@@ -35,13 +35,12 @@ public class PlayEventAction extends AbstractCostToEffectAction {
|
||||
}
|
||||
|
||||
public PlayEventAction(PhysicalCard card, boolean requiresRanger) {
|
||||
_source = card;
|
||||
_eventPlayed = card;
|
||||
_requiresRanger = requiresRanger;
|
||||
|
||||
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)
|
||||
preCostEffects.add(new ShuffleDeckEffect(card.getOwner()));
|
||||
@@ -59,19 +58,24 @@ public class PlayEventAction extends AbstractCostToEffectAction {
|
||||
|
||||
@Override
|
||||
public PhysicalCard getActionSource() {
|
||||
return _source;
|
||||
return _eventPlayed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Play " + _source.getBlueprint().getName();
|
||||
return "Play " + _eventPlayed.getBlueprint().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
if (_preCostIterator.hasNext())
|
||||
return _preCostIterator.next();
|
||||
|
||||
if (!_cardRemoved) {
|
||||
_cardRemoved = true;
|
||||
game.getGameState().removeCardsFromZone(Collections.singleton(_eventPlayed));
|
||||
}
|
||||
|
||||
if (!isCostFailed()) {
|
||||
Effect cost = getNextCost();
|
||||
if (cost != null)
|
||||
@@ -91,23 +95,7 @@ public class PlayEventAction extends AbstractCostToEffectAction {
|
||||
|
||||
if (!_cardDiscarded) {
|
||||
_cardDiscarded = true;
|
||||
return new AbstractSuccessfulEffect() {
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EffectResult.Type getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EffectResult[] playEffect(LotroGame game) {
|
||||
game.getGameState().addCardToZone(_source, _playCardEffect.getTargetZone());
|
||||
return null;
|
||||
}
|
||||
};
|
||||
game.getGameState().addCardToZone(_eventPlayed, _playCardEffect.getTargetZone());
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gempukku.lotro.cards.actions;
|
||||
|
||||
import com.gempukku.lotro.cards.effects.*;
|
||||
import com.gempukku.lotro.cards.effects.PayTwilightCostEffect;
|
||||
import com.gempukku.lotro.cards.effects.ShuffleDeckEffect;
|
||||
import com.gempukku.lotro.common.Zone;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
@@ -10,58 +11,61 @@ import com.gempukku.lotro.logic.effects.PlayCardEffect;
|
||||
import com.gempukku.lotro.logic.effects.SendMessageEffect;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class PlayPermanentAction extends AbstractCostToEffectAction {
|
||||
private PhysicalCard _source;
|
||||
private PhysicalCard _permanentPlayed;
|
||||
private Zone _zone;
|
||||
|
||||
private boolean _cardRemoved;
|
||||
|
||||
private Iterator<Effect> _preCostIterator;
|
||||
|
||||
private Effect _putCardIntoPlayEffect;
|
||||
private boolean _cardPutIntoPlay;
|
||||
|
||||
private Effect _playCardEffect;
|
||||
private boolean _cardPlayed;
|
||||
|
||||
private Effect _discardCardEffect;
|
||||
private boolean _cardDiscarded;
|
||||
|
||||
public PlayPermanentAction(PhysicalCard card, Zone zone, int twilightModifier) {
|
||||
_source = card;
|
||||
_permanentPlayed = card;
|
||||
_zone = zone;
|
||||
|
||||
List<Effect> preCostEffects = new LinkedList<Effect>();
|
||||
preCostEffects.add(new SendMessageEffect(card.getOwner() + " plays " + GameUtils.getCardLink(card) + " from " + card.getZone().getHumanReadable()));
|
||||
preCostEffects.add(new RemoveCardFromZoneEffect(card));
|
||||
appendCost(new PayTwilightCostEffect(card, twilightModifier));
|
||||
if (card.getZone() == Zone.DECK)
|
||||
preCostEffects.add(new ShuffleDeckEffect(card.getOwner()));
|
||||
|
||||
_preCostIterator = preCostEffects.iterator();
|
||||
|
||||
_putCardIntoPlayEffect = new PutCardIntoPlayEffect(card, zone);
|
||||
|
||||
_playCardEffect = new PlayCardEffect(card);
|
||||
|
||||
_discardCardEffect = new PutCardIntoDiscardEffect(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PhysicalCard getActionSource() {
|
||||
return _source;
|
||||
return _permanentPlayed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Play " + _source.getBlueprint().getName();
|
||||
return "Play " + _permanentPlayed.getBlueprint().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
if (_preCostIterator.hasNext())
|
||||
return _preCostIterator.next();
|
||||
|
||||
if (!_cardRemoved) {
|
||||
_cardRemoved = true;
|
||||
game.getGameState().removeCardsFromZone(Collections.singleton(_permanentPlayed));
|
||||
}
|
||||
|
||||
if (!isCostFailed()) {
|
||||
Effect cost = getNextCost();
|
||||
if (cost != null)
|
||||
@@ -69,7 +73,8 @@ public class PlayPermanentAction extends AbstractCostToEffectAction {
|
||||
|
||||
if (!_cardPutIntoPlay) {
|
||||
_cardPutIntoPlay = true;
|
||||
return _putCardIntoPlayEffect;
|
||||
game.getGameState().addCardToZone(_permanentPlayed, _zone);
|
||||
game.getGameState().startAffecting(_permanentPlayed, game.getModifiersEnvironment());
|
||||
}
|
||||
|
||||
if (!_cardPlayed) {
|
||||
@@ -83,7 +88,7 @@ public class PlayPermanentAction extends AbstractCostToEffectAction {
|
||||
} else {
|
||||
if (!_cardDiscarded) {
|
||||
_cardDiscarded = true;
|
||||
return _discardCardEffect;
|
||||
game.getGameState().addCardToZone(_permanentPlayed, Zone.DISCARD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class CancelEventEffect extends AbstractEffect {
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
if (!_effect.isCancelled()) {
|
||||
if (isPlayableInFull(game)) {
|
||||
game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " cancels effect - " + _effect.getText(game));
|
||||
_effect.cancel();
|
||||
return new FullEffectResult(null, true, true);
|
||||
|
||||
@@ -28,12 +28,14 @@ public class CancelSkirmishEffect extends AbstractEffect {
|
||||
|
||||
@Override
|
||||
public boolean isPlayableInFull(LotroGame game) {
|
||||
return (_involvementFilter == null || Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.inSkirmish(), _involvementFilter) > 0);
|
||||
return game.getGameState().getSkirmish() != null
|
||||
&& !game.getGameState().getSkirmish().isCancelled()
|
||||
&& (_involvementFilter == null || Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.inSkirmish(), _involvementFilter) > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
if (_involvementFilter == null || Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.inSkirmish(), _involvementFilter) > 0) {
|
||||
if (isPlayableInFull(game)) {
|
||||
game.getGameState().sendMessage("Skirmish is cancelled");
|
||||
game.getGameState().getSkirmish().cancel();
|
||||
return new FullEffectResult(null, true, true);
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
|
||||
public class CardAffectingGameEffect extends UnrespondableEffect {
|
||||
private PhysicalCard _physicalCard;
|
||||
|
||||
public CardAffectingGameEffect(PhysicalCard physicalCard) {
|
||||
_physicalCard = physicalCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doPlayEffect(LotroGame game) {
|
||||
game.getGameState().startAffecting(_physicalCard, game.getModifiersEnvironment());
|
||||
}
|
||||
}
|
||||
@@ -39,14 +39,14 @@ public class DiscardBottomCardFromDeckEffect extends AbstractEffect {
|
||||
gameState.sendMessage(_playerId + " discards bottom card from his or her deck - " + GameUtils.getCardLink(card));
|
||||
gameState.addCardToZone(card, Zone.DISCARD);
|
||||
|
||||
discardedCard(card);
|
||||
discardedCardCallback(card);
|
||||
|
||||
return new FullEffectResult(null, true, true);
|
||||
}
|
||||
return new FullEffectResult(null, false, false);
|
||||
}
|
||||
|
||||
protected void discardedCard(PhysicalCard card) {
|
||||
protected void discardedCardCallback(PhysicalCard card) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ public class ExertCharactersEffect extends AbstractPreventableCardEffect {
|
||||
protected EffectResult[] playoutEffectOn(LotroGame game, Collection<PhysicalCard> cards) {
|
||||
if (cards.size() > 0)
|
||||
game.getGameState().sendMessage(getAppendedNames(cards) + " exert(s) due to " + GameUtils.getCardLink(_source));
|
||||
for (PhysicalCard woundedCard : cards) {
|
||||
|
||||
for (PhysicalCard woundedCard : cards)
|
||||
game.getGameState().addWound(woundedCard);
|
||||
}
|
||||
|
||||
return new EffectResult[]{new ExertResult(cards)};
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
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;
|
||||
|
||||
public class PutCardIntoDiscardEffect extends UnrespondableEffect {
|
||||
private PhysicalCard _card;
|
||||
|
||||
public PutCardIntoDiscardEffect(PhysicalCard card) {
|
||||
_card = card;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doPlayEffect(LotroGame game) {
|
||||
GameState gameState = game.getGameState();
|
||||
gameState.addCardToZone(_card, Zone.DISCARD);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
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;
|
||||
|
||||
public class PutCardIntoPlayEffect extends UnrespondableEffect {
|
||||
private PhysicalCard _physicalCard;
|
||||
private Zone _zone;
|
||||
|
||||
public PutCardIntoPlayEffect(PhysicalCard physicalCard, Zone zone) {
|
||||
_physicalCard = physicalCard;
|
||||
_zone = zone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doPlayEffect(LotroGame game) {
|
||||
GameState gameState = game.getGameState();
|
||||
gameState.addCardToZone(_physicalCard, _zone);
|
||||
gameState.startAffecting(_physicalCard, game.getModifiersEnvironment());
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class RemoveCardFromZoneEffect extends UnrespondableEffect {
|
||||
private PhysicalCard _physicalCard;
|
||||
|
||||
public RemoveCardFromZoneEffect(PhysicalCard physicalCard) {
|
||||
_physicalCard = physicalCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doPlayEffect(LotroGame game) {
|
||||
game.getGameState().removeCardsFromZone(Collections.singleton(_physicalCard));
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class Card3_009 extends AbstractPermanent {
|
||||
action.appendEffect(
|
||||
new DiscardBottomCardFromDeckEffect(playerId) {
|
||||
@Override
|
||||
protected void discardedCard(PhysicalCard card) {
|
||||
protected void discardedCardCallback(PhysicalCard card) {
|
||||
if (card.getBlueprint().getCulture() == Culture.ELVEN) {
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(self, playerId, "Choose a minion", Filters.type(CardType.MINION), Filters.inSkirmishAgainst(Filters.race(Race.ELF))) {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ActivateCardAction extends AbstractCostToEffectAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
if (!_sentMessage && _physicalCard != null) {
|
||||
_sentMessage = true;
|
||||
return new SendMessageEffect(getMessage());
|
||||
|
||||
@@ -26,7 +26,7 @@ public class OptionalTriggerAction extends AbstractCostToEffectAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
if (!_sentMessage && _physicalCard != null) {
|
||||
_sentMessage = true;
|
||||
return new SendMessageEffect(getMessage());
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PreventSubAction implements Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
return _effectQueue.poll();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class RequiredTriggerAction extends AbstractCostToEffectAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
if (!_sentMessage && _physicalCard != null) {
|
||||
_sentMessage = true;
|
||||
return new SendMessageEffect(getMessage());
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SubAction implements Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
return _effects.poll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class SystemQueueAction extends AbstractCostToEffectAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
if (!isCostFailed()) {
|
||||
Effect cost = getNextCost();
|
||||
if (cost != null)
|
||||
|
||||
@@ -13,5 +13,5 @@ public interface Action {
|
||||
|
||||
public String getText(LotroGame game);
|
||||
|
||||
public Effect nextEffect();
|
||||
public Effect nextEffect(LotroGame game);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gempukku.lotro.logic.timing;
|
||||
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
public class ActionStack {
|
||||
@@ -9,9 +11,9 @@ public class ActionStack {
|
||||
_actionStack.add(action);
|
||||
}
|
||||
|
||||
public Effect getNextEffect() {
|
||||
public Effect getNextEffect(LotroGame game) {
|
||||
Action action = _actionStack.peek();
|
||||
Effect effect = action.nextEffect();
|
||||
Effect effect = action.nextEffect(game);
|
||||
if (effect != null) {
|
||||
return effect;
|
||||
} else {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class TurnProcedure {
|
||||
_playedGameProcess = true;
|
||||
}
|
||||
} else {
|
||||
Effect effect = _actionStack.getNextEffect();
|
||||
Effect effect = _actionStack.getNextEffect(_game);
|
||||
if (effect != null) {
|
||||
if (effect.getType() == null) {
|
||||
effect.playEffect(_game);
|
||||
@@ -75,7 +75,7 @@ public class TurnProcedure {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
if (!_checkedIsAboutToRequiredResponses) {
|
||||
_checkedIsAboutToRequiredResponses = true;
|
||||
List<Action> requiredIsAboutToResponses = _game.getActionsEnvironment().getRequiredBeforeTriggers(_effect);
|
||||
|
||||
@@ -48,7 +48,7 @@ public class PlayerReconcilesAction implements Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
if (_effectQueue == null) {
|
||||
_effectQueue = new LinkedList<Effect>();
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ResolveSkirmishAction implements Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
if (_effects == null) {
|
||||
_effects = resolveSkirmish();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class SimpleEffectAction implements Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effect nextEffect() {
|
||||
public Effect nextEffect(LotroGame game) {
|
||||
Effect result = _effect;
|
||||
_effect = null;
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user