Refactor name of minimum deck size (was startingHandSize) (#10628)

* Refactor: rename starting hand size, it was actually minimum deck size (40, 60 or 100 most of the time)
This commit is contained in:
Susucre 2023-07-15 23:45:19 +02:00 committed by GitHub
parent a7f78e8190
commit b960b77774
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 36 additions and 31 deletions

View file

@ -41,8 +41,8 @@ public class CompanionAbility extends SpecialAction {
return "Companion — " + companionCondition.getRule();
}
public final boolean isLegal(Set<Card> cards, int startingHandSize) {
return companionCondition.isLegal(cards, startingHandSize);
public final boolean isLegal(Set<Card> cards, int minimumDeckSize) {
return companionCondition.isLegal(cards, minimumDeckSize);
}
public final String getLegalRule() {

View file

@ -19,8 +19,8 @@ public interface CompanionCondition extends Serializable {
/**
* @param deck The set of cards to check.
* @param startingHandSize
* @param minimumDeckSize
* @return Whether the companion is valid for that deck.
*/
boolean isLegal(Set<Card> deck, int startingHandSize);
boolean isLegal(Set<Card> deck, int minimumDeckSize);
}

View file

@ -16,7 +16,6 @@ import mage.game.mulligan.Mulligan;
import mage.game.turn.TurnMod;
import mage.players.Player;
import mage.watchers.common.CommanderInfoWatcher;
import mage.watchers.common.CommanderPlaysCountWatcher;
import java.util.*;
import java.util.stream.Stream;
@ -32,8 +31,8 @@ public abstract class GameCommanderImpl extends GameImpl {
protected boolean startingPlayerSkipsDraw = true;
public GameCommanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int startingHandSize) {
super(attackOption, range, mulligan, startingLife, startingHandSize);
public GameCommanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int minimumDeckSize) {
super(attackOption, range, mulligan, startingLife, minimumDeckSize);
}
public GameCommanderImpl(final GameCommanderImpl game) {

View file

@ -144,7 +144,7 @@ public abstract class GameImpl implements Game {
private boolean saveGame = false; // replay code, not done
private int priorityTime; // match time limit
private final int startingLife;
private final int startingHandSize;
private final int minimumDeckSize;
protected transient PlayerList playerList; // auto-generated from state, don't copy
// infinite loop check (temporary data, do not copy)
@ -156,7 +156,7 @@ public abstract class GameImpl implements Game {
// temporary store for income concede commands, don't copy
private final LinkedList<UUID> concedingPlayers = new LinkedList<>();
public GameImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int startingHandSize) {
public GameImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int minimumDeckSize) {
this.id = UUID.randomUUID();
this.range = range;
this.mulligan = mulligan;
@ -164,7 +164,7 @@ public abstract class GameImpl implements Game {
this.state = new GameState();
this.startingLife = startingLife;
this.executingRollback = false;
this.startingHandSize = startingHandSize;
this.minimumDeckSize = minimumDeckSize;
initGameDefaultWatchers();
}
@ -251,7 +251,7 @@ public abstract class GameImpl implements Game {
this.saveGame = game.saveGame;
this.priorityTime = game.priorityTime;
this.startingLife = game.startingLife;
this.startingHandSize = game.startingHandSize;
this.minimumDeckSize = game.minimumDeckSize;
//this.playerList = game.playerList; // auto-generated list, don't copy
// loop check code, no need to copy
@ -1173,7 +1173,7 @@ public abstract class GameImpl implements Game {
for (Ability ability : card.getAbilities(this)) {
if (ability instanceof CompanionAbility) {
CompanionAbility companionAbility = (CompanionAbility) ability;
if (companionAbility.isLegal(cards, startingHandSize)) {
if (companionAbility.isLegal(cards, minimumDeckSize)) {
potentialCompanions.add(card);
break;
}