Game can end either at start of regroup or end of regroup phase per format.
This commit is contained in:
@@ -14,6 +14,8 @@ public interface LotroFormat {
|
||||
|
||||
public boolean hasMulliganRule();
|
||||
|
||||
public boolean winAtEndOfRegroup();
|
||||
|
||||
public String getName();
|
||||
|
||||
public void validateCard(String cardId) throws DeckInvalidException;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -255,6 +255,7 @@
|
||||
"valid":[],
|
||||
"set":[20],
|
||||
"cancelRingBearerSkirmish":true,
|
||||
"winAtEndOfRegroup":true,
|
||||
"ruleOfFour":false,
|
||||
"hall":false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user