Continuing implementation of Planechase.

This commit is contained in:
spjspj 2018-04-12 00:07:24 +10:00
parent dbbc5f255c
commit c8b741f0bf
13 changed files with 77 additions and 25 deletions

View file

@ -51,6 +51,6 @@ public enum MainPhaseStackEmptyCondition implements Condition {
@Override
public String toString() {
return "during the main phase and the stack is empty";
return "during the main phase when the stack is empty";
}
}

View file

@ -1074,7 +1074,7 @@ public abstract class GameImpl implements Game, Serializable {
}
// 20180408 - 901.5
if (state.isPlaneChase()) {
if (gameOptions.planeChase) {
addPlane(Plane.getRandomPlane(), null, getActivePlayerId());
}
}

View file

@ -50,5 +50,10 @@ public class GameOptions implements Serializable {
* Names of users banned from participating in the game
*/
public Set<String> bannedUsers = Collections.emptySet();
/**
* Use planechase variant
*/
public boolean planeChase = false;
}

View file

@ -61,6 +61,7 @@ public class Table implements Serializable {
private Tournament tournament;
private TableRecorder recorder;
private Set<String> bannedUsernames;
private boolean isPlaneChase;
@FunctionalInterface
public interface TableRecorder {
@ -70,21 +71,21 @@ public class Table implements Serializable {
protected TableEventSource tableEventSource = new TableEventSource();
public Table(UUID roomId, String gameType, String name, String controllerName, DeckValidator validator, List<PlayerType> playerTypes, TableRecorder recorder, Tournament tournament, Set<String> bannedUsernames) {
this(roomId, gameType, name, controllerName, validator, playerTypes, recorder, bannedUsernames);
public Table(UUID roomId, String gameType, String name, String controllerName, DeckValidator validator, List<PlayerType> playerTypes, TableRecorder recorder, Tournament tournament, Set<String> bannedUsernames, boolean isPlaneChase) {
this(roomId, gameType, name, controllerName, validator, playerTypes, recorder, bannedUsernames, isPlaneChase);
this.tournament = tournament;
this.isTournament = true;
setState(TableState.WAITING);
}
public Table(UUID roomId, String gameType, String name, String controllerName, DeckValidator validator, List<PlayerType> playerTypes, TableRecorder recorder, Match match, Set<String> bannedUsernames) {
this(roomId, gameType, name, controllerName, validator, playerTypes, recorder, bannedUsernames);
public Table(UUID roomId, String gameType, String name, String controllerName, DeckValidator validator, List<PlayerType> playerTypes, TableRecorder recorder, Match match, Set<String> bannedUsernames, boolean isPlaneChase) {
this(roomId, gameType, name, controllerName, validator, playerTypes, recorder, bannedUsernames, isPlaneChase);
this.match = match;
this.isTournament = false;
setState(TableState.WAITING);
}
protected Table(UUID roomId, String gameType, String name, String controllerName, DeckValidator validator, List<PlayerType> playerTypes, TableRecorder recorder, Set<String> bannedUsernames) {
protected Table(UUID roomId, String gameType, String name, String controllerName, DeckValidator validator, List<PlayerType> playerTypes, TableRecorder recorder, Set<String> bannedUsernames, boolean isPlaneChase) {
tableId = UUID.randomUUID();
this.roomId = roomId;
this.numSeats = playerTypes.size();
@ -96,6 +97,7 @@ public class Table implements Serializable {
this.validator = validator;
this.recorder = recorder;
this.bannedUsernames = new HashSet<>(bannedUsernames);
this.isPlaneChase = isPlaneChase;
}
private void createSeats(List<PlayerType> playerTypes) {

View file

@ -59,13 +59,12 @@ import mage.watchers.common.PlanarRollWatcher;
public class FeedingGroundsPlane extends Plane {
private static final FilterCard filter = new FilterCard("Red spells or Green spells");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("Red or Green creature");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("a creature");
static {
filter.add(Predicates.or(
new ColorPredicate(ObjectColor.RED),
new ColorPredicate(ObjectColor.GREEN)));
filter2.add(Predicates.or(new ColorPredicate(ObjectColor.RED), new ColorPredicate(ObjectColor.GREEN)));
}
private static final String rule = "put X +1/+1 counters on target creature, where X is that creature's converted mana cost";

View file

@ -61,6 +61,7 @@ public class MatchOptions implements Serializable {
protected SkillLevel skillLevel;
protected boolean rollbackTurnsAllowed;
protected boolean spectatorsAllowed;
protected boolean planeChase;
protected int quitRatio;
protected int edhPowerLevel;
protected boolean rated;
@ -213,6 +214,14 @@ public class MatchOptions implements Serializable {
public void setSpectatorsAllowed(boolean spectatorsAllowed) {
this.spectatorsAllowed = spectatorsAllowed;
}
public boolean isPlaneChase() {
return planeChase;
}
public void setPlaneChase(boolean planeChase) {
this.planeChase = planeChase;
}
public int getQuitRatio() {
return quitRatio;

View file

@ -46,6 +46,7 @@ public class TournamentOptions implements Serializable {
protected MatchOptions matchOptions;
protected LimitedOptions limitedOptions;
protected boolean watchingAllowed = true;
protected boolean planeChase = false;
protected int numberRounds;
protected String password;
protected int quitRatio;
@ -91,6 +92,14 @@ public class TournamentOptions implements Serializable {
this.watchingAllowed = watchingAllowed;
}
public boolean isPlaneChase() {
return planeChase;
}
public void setPlaneChase(boolean planeChase) {
this.planeChase = planeChase;
}
public int getNumberRounds() {
return numberRounds;
}