Controlling 5 sites now wins you a game.

This commit is contained in:
marcins78
2013-02-13 16:39:48 +00:00
parent 145c665797
commit ee97e301bd
5 changed files with 17 additions and 5 deletions

View File

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

View File

@@ -35,7 +35,7 @@ public class WinConditionRule {
&& 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");
else {
else if (game.getFormat().winOnControlling5Sites()) {
for (String opponent : GameUtils.getOpponents(game, game.getGameState().getCurrentPlayerId())) {
if (Filters.countActive(game.getGameState(), game.getModifiersQuerying(), CardType.SITE, Filters.siteControlled(opponent))>=5)
game.playerWon(opponent, "Controls 5 sites");

View File

@@ -23,6 +23,7 @@ public class DefaultLotroFormat implements LotroFormat {
private boolean _canCancelRingBearerSkirmish;
private boolean _hasRuleOfFour;
private boolean _winAtEndOfRegroup;
private boolean _winOnControlling5Sites;
private int _minimumDeckSize = 60;
private List<String> _bannedCards = new ArrayList<String>();
private List<String> _restrictedCards = new ArrayList<String>();
@@ -31,7 +32,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 winAtEndOfRegroup) {
boolean canCancelRingBearerSkirmish, boolean hasRuleOfFour, boolean winAtEndOfRegroup, boolean winOnControlling5Sites) {
_library = library;
_name = name;
_siteBlock = siteBlock;
@@ -42,10 +43,9 @@ public class DefaultLotroFormat implements LotroFormat {
_canCancelRingBearerSkirmish = canCancelRingBearerSkirmish;
_hasRuleOfFour = hasRuleOfFour;
_winAtEndOfRegroup = winAtEndOfRegroup;
_winOnControlling5Sites = winOnControlling5Sites;
}
@Override
public final boolean isOrderedSites() {
return _siteBlock != Block.SHADOWS;
@@ -76,6 +76,11 @@ public class DefaultLotroFormat implements LotroFormat {
return _hasRuleOfFour;
}
@Override
public boolean winOnControlling5Sites() {
return _winOnControlling5Sites;
}
@Override
public List<Integer> getValidSets() {
return Collections.unmodifiableList(_validSets);

View File

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

View File

@@ -257,6 +257,7 @@
"cancelRingBearerSkirmish":true,
"winAtEndOfRegroup":true,
"ruleOfFour":false,
"winOnControlling5Sites":true,
"hall":false
}
]