Fixing movement process.

This commit is contained in:
marcins78@gmail.com
2012-01-15 12:22:42 +00:00
parent eac8e91ea7
commit b9443880a1
11 changed files with 36 additions and 20 deletions

View File

@@ -275,7 +275,7 @@ public class TriggerConditions {
public static boolean movesFrom(LotroGame game, EffectResult effectResult, Filterable... filters) {
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_FROM
&& Filters.and(filters).accepts(game.getGameState(), game.getModifiersQuerying(), game.getGameState().getCurrentSite())) {
&& Filters.and(filters).accepts(game.getGameState(), game.getModifiersQuerying(), ((WhenMoveFromResult) effectResult).getSite())) {
return true;
}
return false;

View File

@@ -2,6 +2,7 @@ package com.gempukku.lotro.cards.set1.elven;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.actions.PlayPermanentAction;
import com.gempukku.lotro.cards.effects.AddUntilEndOfTurnModifierEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
@@ -45,7 +46,7 @@ public class Card1_046 extends AbstractPermanent {
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_FROM
if (TriggerConditions.movesFrom(game, effectResult, Keyword.RIVER)
&& game.getGameState().getCurrentPhase() == Phase.FELLOWSHIP) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(new AddUntilEndOfTurnModifierEffect(new MoveLimitModifier(self, 1)));

View File

@@ -2,6 +2,7 @@ package com.gempukku.lotro.cards.set1.isengard;
import com.gempukku.lotro.cards.AbstractAttachable;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.actions.AttachPermanentAction;
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
import com.gempukku.lotro.cards.effects.SelfDiscardEffect;
@@ -54,9 +55,7 @@ public class Card1_134 extends AbstractAttachable {
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_FROM
&& game.getGameState().getCurrentSite() == self.getAttachedTo()) {
if (TriggerConditions.movesFrom(game, effectResult, Filters.hasAttached(self))) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(new ExertCharactersEffect(self, Filters.and(CardType.COMPANION, Race.HOBBIT)));

View File

@@ -1,6 +1,7 @@
package com.gempukku.lotro.cards.set1.site;
import com.gempukku.lotro.cards.AbstractSite;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.RemoveTwilightEffect;
import com.gempukku.lotro.common.Block;
import com.gempukku.lotro.game.PhysicalCard;
@@ -26,8 +27,7 @@ public class Card1_337 extends AbstractSite {
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_FROM
&& game.getGameState().getCurrentSite() == self) {
if (TriggerConditions.movesFrom(game, effectResult, self)) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(new RemoveTwilightEffect(2));
return Collections.singletonList(action);

View File

@@ -1,6 +1,7 @@
package com.gempukku.lotro.cards.set2.dwarven;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
@@ -30,8 +31,7 @@ public class Card2_014 extends AbstractPermanent {
@Override
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_FROM
&& game.getModifiersQuerying().hasKeyword(game.getGameState(), game.getGameState().getCurrentSite(), Keyword.UNDERGROUND)) {
if (TriggerConditions.movesFrom(game, effectResult, Keyword.UNDERGROUND)) {
Collection<PhysicalCard> dwarfCompanions = Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Race.DWARF, CardType.COMPANION);
if (dwarfCompanions.size() > 0) {
OptionalTriggerAction action = new OptionalTriggerAction(self);

View File

@@ -2,6 +2,7 @@ package com.gempukku.lotro.cards.set4.raider;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
import com.gempukku.lotro.cards.effects.SelfDiscardEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
@@ -33,8 +34,7 @@ public class Card4_231 extends AbstractPermanent {
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_FROM
&& game.getGameState().getCurrentSiteNumber() == 2 && game.getGameState().getCurrentSiteBlock() == Block.TWO_TOWERS) {
if (TriggerConditions.movesFrom(game, effectResult, Filters.siteBlock(Block.TWO_TOWERS), Filters.siteNumber(2))) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new ExertCharactersEffect(self, Filters.and(CardType.COMPANION, Keyword.RING_BOUND)));

View File

@@ -2,6 +2,7 @@ package com.gempukku.lotro.cards.set4.shire;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.RemoveBurdenEffect;
import com.gempukku.lotro.cards.effects.SelfDiscardEffect;
import com.gempukku.lotro.common.*;
@@ -36,8 +37,7 @@ public class Card4_299 extends AbstractPermanent {
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, final PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_FROM
&& game.getGameState().getCurrentSiteNumber() == 1 && game.getGameState().getCurrentSiteBlock() == Block.TWO_TOWERS) {
if (TriggerConditions.movesFrom(game, effectResult, Filters.siteBlock(Block.TWO_TOWERS), Filters.siteNumber(1))) {
final RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new PlayoutDecisionEffect(self.getOwner(),

View File

@@ -1,6 +1,7 @@
package com.gempukku.lotro.cards.set4.site;
import com.gempukku.lotro.cards.AbstractSite;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.common.Block;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
@@ -24,8 +25,7 @@ public class Card4_323 extends AbstractSite {
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_FROM
&& game.getGameState().getCurrentSite() == self) {
if (TriggerConditions.movesFrom(game, effectResult, self)) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new AddTwilightEffect(self, 2));

View File

@@ -1,6 +1,7 @@
package com.gempukku.lotro.cards.set4.site;
import com.gempukku.lotro.cards.AbstractSite;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
import com.gempukku.lotro.common.Block;
import com.gempukku.lotro.common.CardType;
@@ -26,8 +27,7 @@ public class Card4_329 extends AbstractSite {
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_FROM
&& game.getGameState().getCurrentSite() == self) {
if (TriggerConditions.movesFrom(game, effectResult, self)) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new ExertCharactersEffect(self, CardType.COMPANION, Keyword.RING_BOUND));

View File

@@ -26,6 +26,7 @@ public class MovementGameProcess implements GameProcess {
@Override
public void process(LotroGame game) {
PhysicalCard currentSite = game.getGameState().getCurrentSite();
final SystemQueueAction action = new SystemQueueAction();
action.appendEffect(
new UnrespondableEffect() {
@@ -55,7 +56,15 @@ public class MovementGameProcess implements GameProcess {
}
});
action.appendEffect(
new TriggeringResultEffect(new WhenMoveFromResult(), "Fellowship moved from"));
new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
GameState gameState = game.getGameState();
gameState.movePlayerToNextSite(game);
}
});
action.appendEffect(
new TriggeringResultEffect(new WhenMoveFromResult(currentSite), "Fellowship moved from"));
action.appendEffect(
new TriggeringResultEffect(new WhenMovesResult(), "Fellowship moves"));
action.appendEffect(
@@ -65,7 +74,6 @@ public class MovementGameProcess implements GameProcess {
@Override
protected void doPlayEffect(LotroGame game) {
GameState gameState = game.getGameState();
gameState.movePlayerToNextSite(game);
int siteTwilightCost = game.getModifiersQuerying().getTwilightCost(gameState, gameState.getCurrentSite(), false);
if (!game.getFormat().isOrderedSites()) {

View File

@@ -1,9 +1,17 @@
package com.gempukku.lotro.logic.timing.results;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.logic.timing.EffectResult;
public class WhenMoveFromResult extends EffectResult {
public WhenMoveFromResult() {
private PhysicalCard _site;
public WhenMoveFromResult(PhysicalCard site) {
super(EffectResult.Type.WHEN_MOVE_FROM);
_site = site;
}
public PhysicalCard getSite() {
return _site;
}
}