Fiddling with actions.

This commit is contained in:
marcins78@gmail.com
2011-10-14 13:05:54 +00:00
parent e2c5391d49
commit 8b016bbe6b
24 changed files with 74 additions and 165 deletions

View File

@@ -1,6 +1,9 @@
package com.gempukku.lotro.cards.actions; 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.common.Zone;
import com.gempukku.lotro.filters.Filter; import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.game.PhysicalCard; 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.effects.SendMessageEffect;
import com.gempukku.lotro.logic.timing.Effect; import com.gempukku.lotro.logic.timing.Effect;
import java.util.Iterator; import java.util.*;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public class AttachPermanentAction extends AbstractCostToEffectAction { public class AttachPermanentAction extends AbstractCostToEffectAction {
private PhysicalCard _source; private PhysicalCard _cardToAttach;
private Effect _removeCardEffect;
private boolean _cardRemoved; private boolean _cardRemoved;
private ChooseActiveCardEffect _chooseTargetEffect; private ChooseActiveCardEffect _chooseTargetEffect;
@@ -34,15 +33,12 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
private Effect _playCardEffect; private Effect _playCardEffect;
private boolean _cardPlayed; private boolean _cardPlayed;
private Effect _discardCardEffect;
private boolean _cardDiscarded; private boolean _cardDiscarded;
private boolean _exertTarget; private boolean _exertTarget;
public AttachPermanentAction(final LotroGame game, final PhysicalCard card, Filter filter, final Map<Filter, Integer> attachCostModifiers, final int twilightModifier) { public AttachPermanentAction(final LotroGame game, final PhysicalCard card, Filter filter, final Map<Filter, Integer> attachCostModifiers, final int twilightModifier) {
_source = card; _cardToAttach = card;
_removeCardEffect = new RemoveCardFromZoneEffect(card);
_chooseTargetEffect = _chooseTargetEffect =
new ChooseActiveCardEffect(null, card.getOwner(), "Attach " + card.getBlueprint().getName() + ". Choose target to attach to", filter) { 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)); new ExertCharactersEffect(target, target));
} }
_putCardIntoPlayEffect = new AttachCardEffect(_source, target); _putCardIntoPlayEffect = new AttachCardEffect(_cardToAttach, target);
int modifier = twilightModifier; int modifier = twilightModifier;
for (Map.Entry<Filter, Integer> filterIntegerEntry : attachCostModifiers.entrySet()) for (Map.Entry<Filter, Integer> filterIntegerEntry : attachCostModifiers.entrySet())
@@ -71,7 +67,6 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
_playCardEffect = new PlayCardEffect(card, target); _playCardEffect = new PlayCardEffect(card, target);
} }
}; };
_discardCardEffect = new PutCardIntoDiscardEffect(card);
} }
public void setExertTarget(boolean exertTarget) { public void setExertTarget(boolean exertTarget) {
@@ -80,19 +75,19 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
@Override @Override
public PhysicalCard getActionSource() { public PhysicalCard getActionSource() {
return _source; return _cardToAttach;
} }
@Override @Override
public String getText(LotroGame game) { public String getText(LotroGame game) {
return "Attach " + _source.getBlueprint().getName(); return "Attach " + _cardToAttach.getBlueprint().getName();
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
if (!_cardRemoved) { if (!_cardRemoved) {
_cardRemoved = true; _cardRemoved = true;
return _removeCardEffect; game.getGameState().removeCardsFromZone(Collections.singleton(_cardToAttach));
} }
if (!_targetChosen) { if (!_targetChosen) {
@@ -125,13 +120,13 @@ public class AttachPermanentAction extends AbstractCostToEffectAction {
} else { } else {
if (!_cardDiscarded) { if (!_cardDiscarded) {
_cardDiscarded = true; _cardDiscarded = true;
return _discardCardEffect; game.getGameState().addCardToZone(_cardToAttach, Zone.DISCARD);
} }
} }
} else { } else {
if (!_cardDiscarded) { if (!_cardDiscarded) {
_cardDiscarded = true; _cardDiscarded = true;
return _discardCardEffect; game.getGameState().addCardToZone(_cardToAttach, Zone.DISCARD);
} }
} }

View File

@@ -1,7 +1,6 @@
package com.gempukku.lotro.cards.actions; package com.gempukku.lotro.cards.actions;
import com.gempukku.lotro.cards.effects.PayTwilightCostEffect; 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.cards.effects.ShuffleDeckEffect;
import com.gempukku.lotro.common.Zone; import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.game.PhysicalCard; 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.PlayEventEffect;
import com.gempukku.lotro.logic.effects.SendMessageEffect; import com.gempukku.lotro.logic.effects.SendMessageEffect;
import com.gempukku.lotro.logic.effects.SendPlayEventMessageEffect; 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.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
public class PlayEventAction extends AbstractCostToEffectAction { public class PlayEventAction extends AbstractCostToEffectAction {
private PhysicalCard _source; private PhysicalCard _eventPlayed;
private boolean _requiresRanger; private boolean _requiresRanger;
private boolean _cardRemoved;
private Iterator<Effect> _preCostIterator; private Iterator<Effect> _preCostIterator;
private PlayEventEffect _playCardEffect; private PlayEventEffect _playCardEffect;
@@ -35,13 +35,12 @@ public class PlayEventAction extends AbstractCostToEffectAction {
} }
public PlayEventAction(PhysicalCard card, boolean requiresRanger) { public PlayEventAction(PhysicalCard card, boolean requiresRanger) {
_source = card; _eventPlayed = card;
_requiresRanger = requiresRanger; _requiresRanger = requiresRanger;
List<Effect> preCostEffects = new LinkedList<Effect>(); List<Effect> preCostEffects = new LinkedList<Effect>();
preCostEffects.add(new SendMessageEffect(card.getOwner() + " plays " + GameUtils.getCardLink(card) + " from " + card.getZone().getHumanReadable())); preCostEffects.add(new SendMessageEffect(card.getOwner() + " plays " + GameUtils.getCardLink(card) + " from " + card.getZone().getHumanReadable()));
preCostEffects.add(new SendPlayEventMessageEffect(card)); preCostEffects.add(new SendPlayEventMessageEffect(card));
preCostEffects.add(new RemoveCardFromZoneEffect(card));
appendCost(new PayTwilightCostEffect(card)); appendCost(new PayTwilightCostEffect(card));
if (card.getZone() == Zone.DECK) if (card.getZone() == Zone.DECK)
preCostEffects.add(new ShuffleDeckEffect(card.getOwner())); preCostEffects.add(new ShuffleDeckEffect(card.getOwner()));
@@ -59,19 +58,24 @@ public class PlayEventAction extends AbstractCostToEffectAction {
@Override @Override
public PhysicalCard getActionSource() { public PhysicalCard getActionSource() {
return _source; return _eventPlayed;
} }
@Override @Override
public String getText(LotroGame game) { public String getText(LotroGame game) {
return "Play " + _source.getBlueprint().getName(); return "Play " + _eventPlayed.getBlueprint().getName();
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
if (_preCostIterator.hasNext()) if (_preCostIterator.hasNext())
return _preCostIterator.next(); return _preCostIterator.next();
if (!_cardRemoved) {
_cardRemoved = true;
game.getGameState().removeCardsFromZone(Collections.singleton(_eventPlayed));
}
if (!isCostFailed()) { if (!isCostFailed()) {
Effect cost = getNextCost(); Effect cost = getNextCost();
if (cost != null) if (cost != null)
@@ -91,23 +95,7 @@ public class PlayEventAction extends AbstractCostToEffectAction {
if (!_cardDiscarded) { if (!_cardDiscarded) {
_cardDiscarded = true; _cardDiscarded = true;
return new AbstractSuccessfulEffect() { game.getGameState().addCardToZone(_eventPlayed, _playCardEffect.getTargetZone());
@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;
}
};
} }
return null; return null;

View File

@@ -1,6 +1,7 @@
package com.gempukku.lotro.cards.actions; 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.common.Zone;
import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame; 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.effects.SendMessageEffect;
import com.gempukku.lotro.logic.timing.Effect; import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
public class PlayPermanentAction extends AbstractCostToEffectAction { public class PlayPermanentAction extends AbstractCostToEffectAction {
private PhysicalCard _source; private PhysicalCard _permanentPlayed;
private Zone _zone;
private boolean _cardRemoved;
private Iterator<Effect> _preCostIterator; private Iterator<Effect> _preCostIterator;
private Effect _putCardIntoPlayEffect;
private boolean _cardPutIntoPlay; private boolean _cardPutIntoPlay;
private Effect _playCardEffect; private Effect _playCardEffect;
private boolean _cardPlayed; private boolean _cardPlayed;
private Effect _discardCardEffect;
private boolean _cardDiscarded; private boolean _cardDiscarded;
public PlayPermanentAction(PhysicalCard card, Zone zone, int twilightModifier) { public PlayPermanentAction(PhysicalCard card, Zone zone, int twilightModifier) {
_source = card; _permanentPlayed = card;
_zone = zone;
List<Effect> preCostEffects = new LinkedList<Effect>(); List<Effect> preCostEffects = new LinkedList<Effect>();
preCostEffects.add(new SendMessageEffect(card.getOwner() + " plays " + GameUtils.getCardLink(card) + " from " + card.getZone().getHumanReadable())); preCostEffects.add(new SendMessageEffect(card.getOwner() + " plays " + GameUtils.getCardLink(card) + " from " + card.getZone().getHumanReadable()));
preCostEffects.add(new RemoveCardFromZoneEffect(card));
appendCost(new PayTwilightCostEffect(card, twilightModifier)); appendCost(new PayTwilightCostEffect(card, twilightModifier));
if (card.getZone() == Zone.DECK) if (card.getZone() == Zone.DECK)
preCostEffects.add(new ShuffleDeckEffect(card.getOwner())); preCostEffects.add(new ShuffleDeckEffect(card.getOwner()));
_preCostIterator = preCostEffects.iterator(); _preCostIterator = preCostEffects.iterator();
_putCardIntoPlayEffect = new PutCardIntoPlayEffect(card, zone);
_playCardEffect = new PlayCardEffect(card); _playCardEffect = new PlayCardEffect(card);
_discardCardEffect = new PutCardIntoDiscardEffect(card);
} }
@Override @Override
public PhysicalCard getActionSource() { public PhysicalCard getActionSource() {
return _source; return _permanentPlayed;
} }
@Override @Override
public String getText(LotroGame game) { public String getText(LotroGame game) {
return "Play " + _source.getBlueprint().getName(); return "Play " + _permanentPlayed.getBlueprint().getName();
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
if (_preCostIterator.hasNext()) if (_preCostIterator.hasNext())
return _preCostIterator.next(); return _preCostIterator.next();
if (!_cardRemoved) {
_cardRemoved = true;
game.getGameState().removeCardsFromZone(Collections.singleton(_permanentPlayed));
}
if (!isCostFailed()) { if (!isCostFailed()) {
Effect cost = getNextCost(); Effect cost = getNextCost();
if (cost != null) if (cost != null)
@@ -69,7 +73,8 @@ public class PlayPermanentAction extends AbstractCostToEffectAction {
if (!_cardPutIntoPlay) { if (!_cardPutIntoPlay) {
_cardPutIntoPlay = true; _cardPutIntoPlay = true;
return _putCardIntoPlayEffect; game.getGameState().addCardToZone(_permanentPlayed, _zone);
game.getGameState().startAffecting(_permanentPlayed, game.getModifiersEnvironment());
} }
if (!_cardPlayed) { if (!_cardPlayed) {
@@ -83,7 +88,7 @@ public class PlayPermanentAction extends AbstractCostToEffectAction {
} else { } else {
if (!_cardDiscarded) { if (!_cardDiscarded) {
_cardDiscarded = true; _cardDiscarded = true;
return _discardCardEffect; game.getGameState().addCardToZone(_permanentPlayed, Zone.DISCARD);
} }
} }

View File

@@ -33,7 +33,7 @@ public class CancelEventEffect extends AbstractEffect {
@Override @Override
protected FullEffectResult playEffectReturningResult(LotroGame game) { protected FullEffectResult playEffectReturningResult(LotroGame game) {
if (!_effect.isCancelled()) { if (isPlayableInFull(game)) {
game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " cancels effect - " + _effect.getText(game)); game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " cancels effect - " + _effect.getText(game));
_effect.cancel(); _effect.cancel();
return new FullEffectResult(null, true, true); return new FullEffectResult(null, true, true);

View File

@@ -28,12 +28,14 @@ public class CancelSkirmishEffect extends AbstractEffect {
@Override @Override
public boolean isPlayableInFull(LotroGame game) { 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 @Override
protected FullEffectResult playEffectReturningResult(LotroGame game) { 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().sendMessage("Skirmish is cancelled");
game.getGameState().getSkirmish().cancel(); game.getGameState().getSkirmish().cancel();
return new FullEffectResult(null, true, true); return new FullEffectResult(null, true, true);

View File

@@ -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());
}
}

View File

@@ -39,14 +39,14 @@ public class DiscardBottomCardFromDeckEffect extends AbstractEffect {
gameState.sendMessage(_playerId + " discards bottom card from his or her deck - " + GameUtils.getCardLink(card)); gameState.sendMessage(_playerId + " discards bottom card from his or her deck - " + GameUtils.getCardLink(card));
gameState.addCardToZone(card, Zone.DISCARD); gameState.addCardToZone(card, Zone.DISCARD);
discardedCard(card); discardedCardCallback(card);
return new FullEffectResult(null, true, true); return new FullEffectResult(null, true, true);
} }
return new FullEffectResult(null, false, false); return new FullEffectResult(null, false, false);
} }
protected void discardedCard(PhysicalCard card) { protected void discardedCardCallback(PhysicalCard card) {
} }
} }

View File

@@ -52,9 +52,9 @@ public class ExertCharactersEffect extends AbstractPreventableCardEffect {
protected EffectResult[] playoutEffectOn(LotroGame game, Collection<PhysicalCard> cards) { protected EffectResult[] playoutEffectOn(LotroGame game, Collection<PhysicalCard> cards) {
if (cards.size() > 0) if (cards.size() > 0)
game.getGameState().sendMessage(getAppendedNames(cards) + " exert(s) due to " + GameUtils.getCardLink(_source)); game.getGameState().sendMessage(getAppendedNames(cards) + " exert(s) due to " + GameUtils.getCardLink(_source));
for (PhysicalCard woundedCard : cards) {
for (PhysicalCard woundedCard : cards)
game.getGameState().addWound(woundedCard); game.getGameState().addWound(woundedCard);
}
return new EffectResult[]{new ExertResult(cards)}; return new EffectResult[]{new ExertResult(cards)};
} }

View File

@@ -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);
}
}

View File

@@ -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());
}
}

View File

@@ -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));
}
}

View File

@@ -42,7 +42,7 @@ public class Card3_009 extends AbstractPermanent {
action.appendEffect( action.appendEffect(
new DiscardBottomCardFromDeckEffect(playerId) { new DiscardBottomCardFromDeckEffect(playerId) {
@Override @Override
protected void discardedCard(PhysicalCard card) { protected void discardedCardCallback(PhysicalCard card) {
if (card.getBlueprint().getCulture() == Culture.ELVEN) { if (card.getBlueprint().getCulture() == Culture.ELVEN) {
action.appendEffect( action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a minion", Filters.type(CardType.MINION), Filters.inSkirmishAgainst(Filters.race(Race.ELF))) { new ChooseActiveCardEffect(self, playerId, "Choose a minion", Filters.type(CardType.MINION), Filters.inSkirmishAgainst(Filters.race(Race.ELF))) {

View File

@@ -32,7 +32,7 @@ public class ActivateCardAction extends AbstractCostToEffectAction {
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
if (!_sentMessage && _physicalCard != null) { if (!_sentMessage && _physicalCard != null) {
_sentMessage = true; _sentMessage = true;
return new SendMessageEffect(getMessage()); return new SendMessageEffect(getMessage());

View File

@@ -26,7 +26,7 @@ public class OptionalTriggerAction extends AbstractCostToEffectAction {
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
if (!_sentMessage && _physicalCard != null) { if (!_sentMessage && _physicalCard != null) {
_sentMessage = true; _sentMessage = true;
return new SendMessageEffect(getMessage()); return new SendMessageEffect(getMessage());

View File

@@ -51,7 +51,7 @@ public class PreventSubAction implements Action {
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
return _effectQueue.poll(); return _effectQueue.poll();
} }

View File

@@ -26,7 +26,7 @@ public class RequiredTriggerAction extends AbstractCostToEffectAction {
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
if (!_sentMessage && _physicalCard != null) { if (!_sentMessage && _physicalCard != null) {
_sentMessage = true; _sentMessage = true;
return new SendMessageEffect(getMessage()); return new SendMessageEffect(getMessage());

View File

@@ -41,7 +41,7 @@ public class SubAction implements Action {
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
return _effects.poll(); return _effects.poll();
} }
} }

View File

@@ -16,7 +16,7 @@ public class SystemQueueAction extends AbstractCostToEffectAction {
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
if (!isCostFailed()) { if (!isCostFailed()) {
Effect cost = getNextCost(); Effect cost = getNextCost();
if (cost != null) if (cost != null)

View File

@@ -13,5 +13,5 @@ public interface Action {
public String getText(LotroGame game); public String getText(LotroGame game);
public Effect nextEffect(); public Effect nextEffect(LotroGame game);
} }

View File

@@ -1,5 +1,7 @@
package com.gempukku.lotro.logic.timing; package com.gempukku.lotro.logic.timing;
import com.gempukku.lotro.game.state.LotroGame;
import java.util.Stack; import java.util.Stack;
public class ActionStack { public class ActionStack {
@@ -9,9 +11,9 @@ public class ActionStack {
_actionStack.add(action); _actionStack.add(action);
} }
public Effect getNextEffect() { public Effect getNextEffect(LotroGame game) {
Action action = _actionStack.peek(); Action action = _actionStack.peek();
Effect effect = action.nextEffect(); Effect effect = action.nextEffect(game);
if (effect != null) { if (effect != null) {
return effect; return effect;
} else { } else {

View File

@@ -43,7 +43,7 @@ public class TurnProcedure {
_playedGameProcess = true; _playedGameProcess = true;
} }
} else { } else {
Effect effect = _actionStack.getNextEffect(); Effect effect = _actionStack.getNextEffect(_game);
if (effect != null) { if (effect != null) {
if (effect.getType() == null) { if (effect.getType() == null) {
effect.playEffect(_game); effect.playEffect(_game);
@@ -75,7 +75,7 @@ public class TurnProcedure {
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
if (!_checkedIsAboutToRequiredResponses) { if (!_checkedIsAboutToRequiredResponses) {
_checkedIsAboutToRequiredResponses = true; _checkedIsAboutToRequiredResponses = true;
List<Action> requiredIsAboutToResponses = _game.getActionsEnvironment().getRequiredBeforeTriggers(_effect); List<Action> requiredIsAboutToResponses = _game.getActionsEnvironment().getRequiredBeforeTriggers(_effect);

View File

@@ -48,7 +48,7 @@ public class PlayerReconcilesAction implements Action {
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
if (_effectQueue == null) { if (_effectQueue == null) {
_effectQueue = new LinkedList<Effect>(); _effectQueue = new LinkedList<Effect>();

View File

@@ -47,7 +47,7 @@ public class ResolveSkirmishAction implements Action {
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
if (_effects == null) { if (_effects == null) {
_effects = resolveSkirmish(); _effects = resolveSkirmish();
} }

View File

@@ -35,7 +35,7 @@ public class SimpleEffectAction implements Action {
} }
@Override @Override
public Effect nextEffect() { public Effect nextEffect(LotroGame game) {
Effect result = _effect; Effect result = _effect;
_effect = null; _effect = null;
return result; return result;