mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Added boolean to deactivate legend rule.
This commit is contained in:
parent
a1928ce95a
commit
50e0a2c2a8
2 changed files with 19 additions and 2 deletions
|
@ -1327,7 +1327,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
}
|
||||
}
|
||||
}
|
||||
if (filterLegendary.match(perm, this)) {
|
||||
if (this.getState().isLegendaryRuleActive() && filterLegendary.match(perm, this)) {
|
||||
legendary.add(perm);
|
||||
}
|
||||
if (filterEquipment.match(perm, this)) {
|
||||
|
@ -1415,6 +1415,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
// If a player controls two or more legendary permanents with the same name, that player
|
||||
// chooses one of them, and the rest are put into their owners' graveyards.
|
||||
// This is called the "legend rule."
|
||||
|
||||
if (legendary.size() > 1) { //don't bother checking if less than 2 legends in play
|
||||
for (Permanent legend: legendary) {
|
||||
FilterPermanent filterLegendName = new FilterPermanent();
|
||||
|
|
|
@ -98,6 +98,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
private Battlefield battlefield;
|
||||
private int turnNum = 1;
|
||||
private boolean extraTurn = false;
|
||||
private boolean legendaryRuleActive = true;
|
||||
private boolean gameOver;
|
||||
private boolean paused;
|
||||
private ContinuousEffects effects;
|
||||
|
@ -144,6 +145,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
this.battlefield = state.battlefield.copy();
|
||||
this.turnNum = state.turnNum;
|
||||
this.extraTurn = state.extraTurn;
|
||||
this.legendaryRuleActive = state.legendaryRuleActive;
|
||||
this.gameOver = state.gameOver;
|
||||
this.effects = state.effects.copy();
|
||||
for (TriggeredAbility trigger: state.triggered) {
|
||||
|
@ -385,7 +387,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
}
|
||||
battlefield.reset(game);
|
||||
combat.reset();
|
||||
resetOtherAbilities();
|
||||
this.reset();
|
||||
effects.apply(game);
|
||||
battlefield.fireControlChangeEvents(game);
|
||||
}
|
||||
|
@ -621,6 +623,11 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
}
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
this.setLegendaryRuleActive(true);
|
||||
this.resetOtherAbilities();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
battlefield.clear();
|
||||
effects.clear();
|
||||
|
@ -634,6 +641,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
lookedAt.clear();
|
||||
turnNum = 0;
|
||||
extraTurn = false;
|
||||
legendaryRuleActive = true;
|
||||
gameOver = false;
|
||||
specialActions.clear();
|
||||
otherAbilities.clear();
|
||||
|
@ -656,4 +664,12 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
return this.paused;
|
||||
}
|
||||
|
||||
public boolean isLegendaryRuleActive() {
|
||||
return legendaryRuleActive;
|
||||
}
|
||||
|
||||
public void setLegendaryRuleActive(boolean legendaryRuleActive) {
|
||||
this.legendaryRuleActive = legendaryRuleActive;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue