Play next site.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.effects.PlaySiteEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
public class PlayNextSiteEffect extends PlaySiteEffect {
|
||||
public PlayNextSiteEffect(Action action, String playerId) {
|
||||
super(action, playerId, null, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSiteNumberToPlay(LotroGame game) {
|
||||
return game.getGameState().getCurrentSiteNumber() + 1;
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,13 @@ import com.gempukku.lotro.cards.AbstractEvent;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfTurnModifierEffect;
|
||||
import com.gempukku.lotro.cards.effects.PlayNextSiteEffect;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.effects.PlaySiteEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.TwilightCostModifier;
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ public class Card8_029 extends AbstractEvent {
|
||||
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
|
||||
PlayEventAction action = new PlayEventAction(self);
|
||||
action.appendEffect(
|
||||
new PlaySiteEffect(action, playerId, null, game.getGameState().getCurrentSiteNumber() + 1));
|
||||
new PlayNextSiteEffect(action, playerId));
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfTurnModifierEffect(
|
||||
new TwilightCostModifier(self, Filters.siteNumber(game.getGameState().getCurrentSiteNumber() + 1), -1)));
|
||||
|
||||
@@ -40,15 +40,21 @@ public class PlaySiteEffect extends AbstractEffect {
|
||||
_extraSiteFilters = extraSiteFilters;
|
||||
}
|
||||
|
||||
protected int getSiteNumberToPlay(LotroGame game) {
|
||||
return _siteNumber;
|
||||
}
|
||||
|
||||
private Collection<PhysicalCard> getMatchingSites(LotroGame game) {
|
||||
if (_siteNumber > 9 || _siteNumber < 1)
|
||||
final int siteNumber = getSiteNumberToPlay(game);
|
||||
|
||||
if (siteNumber > 9 || siteNumber < 1)
|
||||
return Collections.emptySet();
|
||||
|
||||
if (game.getFormat().isOrderedSites()) {
|
||||
Filter printedSiteNumber = new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
return physicalCard.getBlueprint().getSiteNumber() == _siteNumber;
|
||||
return physicalCard.getBlueprint().getSiteNumber() == siteNumber;
|
||||
}
|
||||
};
|
||||
if (_siteBlock != null)
|
||||
@@ -80,6 +86,8 @@ public class PlaySiteEffect extends AbstractEffect {
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
final int siteNumber = getSiteNumberToPlay(game);
|
||||
|
||||
Collection<PhysicalCard> newSite = getMatchingSites(game);
|
||||
|
||||
if (newSite.size() > 0) {
|
||||
@@ -91,7 +99,7 @@ public class PlaySiteEffect extends AbstractEffect {
|
||||
PhysicalCard newSite = selectedCards.iterator().next();
|
||||
|
||||
GameState gameState = game.getGameState();
|
||||
PhysicalCard oldSite = gameState.getSite(_siteNumber);
|
||||
PhysicalCard oldSite = gameState.getSite(siteNumber);
|
||||
|
||||
Zone zone = null;
|
||||
String controlled = null;
|
||||
@@ -109,7 +117,7 @@ public class PlaySiteEffect extends AbstractEffect {
|
||||
}
|
||||
|
||||
gameState.removeCardsFromZone(_playerId, Collections.singleton(newSite));
|
||||
newSite.setSiteNumber(_siteNumber);
|
||||
newSite.setSiteNumber(siteNumber);
|
||||
gameState.addCardToZone(game, newSite, Zone.ADVENTURE_PATH);
|
||||
gameState.sendMessage(newSite.getOwner() + " plays " + GameUtils.getCardLink(newSite));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user