Game can end either at start of regroup or end of regroup phase per format.

This commit is contained in:
marcins78
2013-02-13 16:33:17 +00:00
parent 0d6179f01e
commit 67d6eb62e7
5 changed files with 24 additions and 3 deletions

View File

@@ -14,6 +14,8 @@ public interface LotroFormat {
public boolean hasMulliganRule();
public boolean winAtEndOfRegroup();
public String getName();
public void validateCard(String cardId) throws DeckInvalidException;

View File

@@ -22,11 +22,17 @@ public class WinConditionRule {
new AbstractActionProxy() {
@Override
public List<? extends RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResults) {
if (effectResults.getType() == EffectResult.Type.START_OF_PHASE
if (game.getFormat().winAtEndOfRegroup()
&& effectResults.getType() == EffectResult.Type.END_OF_PHASE
&& game.getGameState().getCurrentPhase() == Phase.REGROUP
&& game.getGameState().getCurrentSiteNumber() == 9)
game.playerWon(game.getGameState().getCurrentPlayerId(), "Surviving to end of Regroup phase on site 9");
else if (effectResults.getType() == EffectResult.Type.START_OF_PHASE
&& game.getGameState().getCurrentPhase() == Phase.REGROUP
&& game.getGameState().getCurrentSiteNumber() == 9
&& !game.getModifiersQuerying().hasFlagActive(game.getGameState(), ModifierFlag.WIN_CHECK_AFTER_SHADOW_RECONCILE))
game.playerWon(game.getGameState().getCurrentPlayerId(), "Surviving to Regroup phase on site 9");
return null;
}
});

View File

@@ -22,6 +22,7 @@ public class DefaultLotroFormat implements LotroFormat {
private boolean _mulliganRule;
private boolean _canCancelRingBearerSkirmish;
private boolean _hasRuleOfFour;
private boolean _winAtEndOfRegroup;
private int _minimumDeckSize = 60;
private List<String> _bannedCards = new ArrayList<String>();
private List<String> _restrictedCards = new ArrayList<String>();
@@ -30,7 +31,7 @@ public class DefaultLotroFormat implements LotroFormat {
public DefaultLotroFormat(LotroCardBlueprintLibrary library, String name, Block siteBlock,
boolean validateShadowFPCount, int minimumDeckSize, int maximumSameName, boolean mulliganRule,
boolean canCancelRingBearerSkirmish, boolean hasRuleOfFour) {
boolean canCancelRingBearerSkirmish, boolean hasRuleOfFour, boolean winAtEndOfRegroup) {
_library = library;
_name = name;
_siteBlock = siteBlock;
@@ -40,8 +41,11 @@ public class DefaultLotroFormat implements LotroFormat {
_mulliganRule = mulliganRule;
_canCancelRingBearerSkirmish = canCancelRingBearerSkirmish;
_hasRuleOfFour = hasRuleOfFour;
_winAtEndOfRegroup = winAtEndOfRegroup;
}
@Override
public final boolean isOrderedSites() {
return _siteBlock != Block.SHADOWS;
@@ -57,6 +61,11 @@ public class DefaultLotroFormat implements LotroFormat {
return _mulliganRule;
}
@Override
public boolean winAtEndOfRegroup() {
return _winAtEndOfRegroup;
}
@Override
public boolean canCancelRingBearerSkirmish() {
return _canCancelRingBearerSkirmish;

View File

@@ -36,8 +36,11 @@ public class LotroFormatLibrary {
Boolean hasRuleOfFour = (Boolean) formatDef.get("ruleOfFour");
if (hasRuleOfFour == null)
hasRuleOfFour = true;
Boolean winAtEndOfRegroup = (Boolean) formatDef.get("winAtEndOfRegroup");
if (winAtEndOfRegroup == null)
winAtEndOfRegroup = false;
final DefaultLotroFormat format = new DefaultLotroFormat(library, name, block, true, 60, 4, true, cancelRingBearerSkirmish, hasRuleOfFour);
final DefaultLotroFormat format = new DefaultLotroFormat(library, name, block, true, 60, 4, true, cancelRingBearerSkirmish, hasRuleOfFour, winAtEndOfRegroup);
JSONArray sets = (JSONArray) formatDef.get("set");
for (Object set : sets)

View File

@@ -255,6 +255,7 @@
"valid":[],
"set":[20],
"cancelRingBearerSkirmish":true,
"winAtEndOfRegroup":true,
"ruleOfFour":false,
"hall":false
}