Winning when getting to site 9 should work fine now.
This commit is contained in:
@@ -16,7 +16,7 @@ public interface LotroGame {
|
||||
|
||||
public UserFeedback getUserFeedback();
|
||||
|
||||
public void checkWinLoseConditions();
|
||||
public void checkLoseConditions();
|
||||
|
||||
public void playerWon(String currentPlayerId, String reason);
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ public class DefaultLotroGame implements LotroGame {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkWinLoseConditions() {
|
||||
public void checkLoseConditions() {
|
||||
GameState gameState = getGameState();
|
||||
if (gameState != null && gameState.getCurrentPhase() != Phase.GAME_SETUP) {
|
||||
// Ring-bearer death
|
||||
@@ -158,12 +158,6 @@ public class DefaultLotroGame implements LotroGame {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Fellowship in regroup at the last site
|
||||
if (getGameState().getCurrentPhase() == Phase.REGROUP
|
||||
&& getGameState().getCurrentSiteNumber() == 9) {
|
||||
playerWon(getGameState().getCurrentPlayerId(), "Surviving to Regroup phase on site 9");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,5 +26,7 @@ public class RuleSet {
|
||||
new CharacterDeathRule(_actionsEnvironment).applyRule();
|
||||
|
||||
new SanctuaryRule(_actionsEnvironment).applyRule();
|
||||
|
||||
new WinConditionRule(_actionsEnvironment).applyRule();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class TurnProcedure {
|
||||
}
|
||||
}
|
||||
}
|
||||
_game.checkWinLoseConditions();
|
||||
_game.checkLoseConditions();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.gempukku.lotro.logic.timing.rules;
|
||||
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.game.AbstractActionProxy;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.game.state.actions.DefaultActionsEnvironment;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WinConditionRule {
|
||||
private DefaultActionsEnvironment _actionsEnvironment;
|
||||
|
||||
public WinConditionRule(DefaultActionsEnvironment actionsEnvironment) {
|
||||
_actionsEnvironment = actionsEnvironment;
|
||||
}
|
||||
|
||||
public void applyRule() {
|
||||
_actionsEnvironment.addAlwaysOnActionProxy(
|
||||
new AbstractActionProxy() {
|
||||
@Override
|
||||
public List<? extends Action> getRequiredBeforeTriggers(LotroGame lotroGame, Effect effect) {
|
||||
if (effect.getType() == EffectResult.Type.START_OF_PHASE
|
||||
&& lotroGame.getGameState().getCurrentPhase() == Phase.REGROUP
|
||||
&& lotroGame.getGameState().getCurrentSiteNumber() == 9)
|
||||
lotroGame.playerWon(lotroGame.getGameState().getCurrentPlayerId(), "Surviving to Regroup phase on site 9");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user