mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
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:
parent
a7f78e8190
commit
b960b77774
15 changed files with 36 additions and 31 deletions
|
|
@ -15,8 +15,8 @@ public class TwoPlayerDuel extends GameImpl {
|
||||||
this(attackOption, range, mulligan, startLife, 60);
|
this(attackOption, range, mulligan, startLife, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TwoPlayerDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int startingHandSize) {
|
public TwoPlayerDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int minimumDeckSize) {
|
||||||
super(attackOption, range, mulligan, startingLife, startingHandSize);
|
super(attackOption, range, mulligan, startingLife, minimumDeckSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TwoPlayerDuel(final TwoPlayerDuel game) {
|
public TwoPlayerDuel(final TwoPlayerDuel game) {
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ enum GyrudaDoomOfDepthsCompanionCondition implements CompanionCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLegal(Set<Card> deck, int startingHandSize) {
|
public boolean isLegal(Set<Card> deck, int minimumDeckSize) {
|
||||||
return deck
|
return deck
|
||||||
.stream()
|
.stream()
|
||||||
.mapToInt(MageObject::getManaValue)
|
.mapToInt(MageObject::getManaValue)
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,21 @@ import mage.abilities.costs.Cost;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.keyword.CompanionAbility;
|
import mage.abilities.keyword.CompanionAbility;
|
||||||
import mage.abilities.keyword.CompanionCondition;
|
import mage.abilities.keyword.CompanionCondition;
|
||||||
|
import mage.abilities.mana.ConditionalColoredManaAbility;
|
||||||
|
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
||||||
import mage.abilities.mana.conditional.ManaCondition;
|
import mage.abilities.mana.conditional.ManaCondition;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.SuperType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
import mage.abilities.mana.ConditionalColoredManaAbility;
|
import java.util.Map;
|
||||||
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
|
@ -61,7 +66,7 @@ enum JeganthaTheWellspringCompanionCondition implements CompanionCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLegal(Set<Card> deck, int startingHandSize) {
|
public boolean isLegal(Set<Card> deck, int minimumDeckSize) {
|
||||||
return deck.stream().noneMatch(JeganthaTheWellspringCompanionCondition::checkCard);
|
return deck.stream().noneMatch(JeganthaTheWellspringCompanionCondition::checkCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ enum KaheeraTheOrphanguardCompanionCondition implements CompanionCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLegal(Set<Card> deck, int startingHandSize) {
|
public boolean isLegal(Set<Card> deck, int minimumDeckSize) {
|
||||||
return deck.stream()
|
return deck.stream()
|
||||||
.filter(card -> card.hasCardTypeForDeckbuilding(CardType.CREATURE))
|
.filter(card -> card.hasCardTypeForDeckbuilding(CardType.CREATURE))
|
||||||
.allMatch(KaheeraTheOrphanguardCompanionCondition::isCardLegal);
|
.allMatch(KaheeraTheOrphanguardCompanionCondition::isCardLegal);
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ enum KerugaCondition implements CompanionCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLegal(Set<Card> deck, int startingHandSize) {
|
public boolean isLegal(Set<Card> deck, int minimumDeckSize) {
|
||||||
return deck.stream().allMatch(card -> card.hasCardTypeForDeckbuilding(CardType.LAND) || card.getManaValue() >= 3);
|
return deck.stream().allMatch(card -> card.hasCardTypeForDeckbuilding(CardType.LAND) || card.getManaValue() >= 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package mage.cards.l;
|
package mage.cards.l;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.common.CastFromGraveyardOnceStaticAbility;
|
import mage.abilities.common.CastFromGraveyardOnceStaticAbility;
|
||||||
|
|
@ -18,6 +16,9 @@ import mage.constants.SuperType;
|
||||||
import mage.filter.common.FilterPermanentCard;
|
import mage.filter.common.FilterPermanentCard;
|
||||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
|
|
@ -67,7 +68,7 @@ enum LurrusOfTheDreamDenCompanionCondition implements CompanionCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLegal(Set<Card> deck, int startingHandSize) {
|
public boolean isLegal(Set<Card> deck, int minimumDeckSize) {
|
||||||
return deck.stream()
|
return deck.stream()
|
||||||
.filter(MageObject::isPermanent)
|
.filter(MageObject::isPermanent)
|
||||||
.mapToInt(MageObject::getManaValue)
|
.mapToInt(MageObject::getManaValue)
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ enum LutriTheSpellchaserCompanionCondition implements CompanionCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLegal(Set<Card> deck, int startingHandSize) {
|
public boolean isLegal(Set<Card> deck, int minimumDeckSize) {
|
||||||
Map<String, Integer> cardMap = new HashMap<>();
|
Map<String, Integer> cardMap = new HashMap<>();
|
||||||
deck.stream()
|
deck.stream()
|
||||||
.filter(card -> !card.hasCardTypeForDeckbuilding(CardType.LAND))
|
.filter(card -> !card.hasCardTypeForDeckbuilding(CardType.LAND))
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ enum OboshThePreypiercerCompanionCondition implements CompanionCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLegal(Set<Card> deck, int startingHandSize) {
|
public boolean isLegal(Set<Card> deck, int minimumDeckSize) {
|
||||||
return deck
|
return deck
|
||||||
.stream()
|
.stream()
|
||||||
.filter(card -> !card.hasCardTypeForDeckbuilding(CardType.LAND))
|
.filter(card -> !card.hasCardTypeForDeckbuilding(CardType.LAND))
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ enum UmoriCondition implements CompanionCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLegal(Set<Card> deck, int startingHandSize) {
|
public boolean isLegal(Set<Card> deck, int minimumDeckSize) {
|
||||||
Set<CardType> cardTypes = new HashSet<>();
|
Set<CardType> cardTypes = new HashSet<>();
|
||||||
for (Card card : deck) {
|
for (Card card : deck) {
|
||||||
// Lands are fine.
|
// Lands are fine.
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,8 @@ enum YorionSkyNomadCompanionCondition implements CompanionCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLegal(Set<Card> deck, int startingHandSize) {
|
public boolean isLegal(Set<Card> deck, int minimumDeckSize) {
|
||||||
return deck.size() >= startingHandSize + 20;
|
return deck.size() >= minimumDeckSize + 20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ enum ZirdaTheDawnwakerCompanionCondition implements CompanionCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLegal(Set<Card> deck, int startingHandSize) {
|
public boolean isLegal(Set<Card> deck, int minimumDeckSize) {
|
||||||
return deck
|
return deck
|
||||||
.stream()
|
.stream()
|
||||||
.filter(MageObject::isPermanent)
|
.filter(MageObject::isPermanent)
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@ public class CompanionAbility extends SpecialAction {
|
||||||
return "Companion — " + companionCondition.getRule();
|
return "Companion — " + companionCondition.getRule();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isLegal(Set<Card> cards, int startingHandSize) {
|
public final boolean isLegal(Set<Card> cards, int minimumDeckSize) {
|
||||||
return companionCondition.isLegal(cards, startingHandSize);
|
return companionCondition.isLegal(cards, minimumDeckSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getLegalRule() {
|
public final String getLegalRule() {
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ public interface CompanionCondition extends Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param deck The set of cards to check.
|
* @param deck The set of cards to check.
|
||||||
* @param startingHandSize
|
* @param minimumDeckSize
|
||||||
* @return Whether the companion is valid for that deck.
|
* @return Whether the companion is valid for that deck.
|
||||||
*/
|
*/
|
||||||
boolean isLegal(Set<Card> deck, int startingHandSize);
|
boolean isLegal(Set<Card> deck, int minimumDeckSize);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import mage.game.mulligan.Mulligan;
|
||||||
import mage.game.turn.TurnMod;
|
import mage.game.turn.TurnMod;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.watchers.common.CommanderInfoWatcher;
|
import mage.watchers.common.CommanderInfoWatcher;
|
||||||
import mage.watchers.common.CommanderPlaysCountWatcher;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
@ -32,8 +31,8 @@ public abstract class GameCommanderImpl extends GameImpl {
|
||||||
|
|
||||||
protected boolean startingPlayerSkipsDraw = true;
|
protected boolean startingPlayerSkipsDraw = true;
|
||||||
|
|
||||||
public GameCommanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int startingHandSize) {
|
public GameCommanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int minimumDeckSize) {
|
||||||
super(attackOption, range, mulligan, startingLife, startingHandSize);
|
super(attackOption, range, mulligan, startingLife, minimumDeckSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameCommanderImpl(final GameCommanderImpl game) {
|
public GameCommanderImpl(final GameCommanderImpl game) {
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ public abstract class GameImpl implements Game {
|
||||||
private boolean saveGame = false; // replay code, not done
|
private boolean saveGame = false; // replay code, not done
|
||||||
private int priorityTime; // match time limit
|
private int priorityTime; // match time limit
|
||||||
private final int startingLife;
|
private final int startingLife;
|
||||||
private final int startingHandSize;
|
private final int minimumDeckSize;
|
||||||
protected transient PlayerList playerList; // auto-generated from state, don't copy
|
protected transient PlayerList playerList; // auto-generated from state, don't copy
|
||||||
|
|
||||||
// infinite loop check (temporary data, do not 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
|
// temporary store for income concede commands, don't copy
|
||||||
private final LinkedList<UUID> concedingPlayers = new LinkedList<>();
|
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.id = UUID.randomUUID();
|
||||||
this.range = range;
|
this.range = range;
|
||||||
this.mulligan = mulligan;
|
this.mulligan = mulligan;
|
||||||
|
|
@ -164,7 +164,7 @@ public abstract class GameImpl implements Game {
|
||||||
this.state = new GameState();
|
this.state = new GameState();
|
||||||
this.startingLife = startingLife;
|
this.startingLife = startingLife;
|
||||||
this.executingRollback = false;
|
this.executingRollback = false;
|
||||||
this.startingHandSize = startingHandSize;
|
this.minimumDeckSize = minimumDeckSize;
|
||||||
|
|
||||||
initGameDefaultWatchers();
|
initGameDefaultWatchers();
|
||||||
}
|
}
|
||||||
|
|
@ -251,7 +251,7 @@ public abstract class GameImpl implements Game {
|
||||||
this.saveGame = game.saveGame;
|
this.saveGame = game.saveGame;
|
||||||
this.priorityTime = game.priorityTime;
|
this.priorityTime = game.priorityTime;
|
||||||
this.startingLife = game.startingLife;
|
this.startingLife = game.startingLife;
|
||||||
this.startingHandSize = game.startingHandSize;
|
this.minimumDeckSize = game.minimumDeckSize;
|
||||||
//this.playerList = game.playerList; // auto-generated list, don't copy
|
//this.playerList = game.playerList; // auto-generated list, don't copy
|
||||||
|
|
||||||
// loop check code, no need to copy
|
// loop check code, no need to copy
|
||||||
|
|
@ -1173,7 +1173,7 @@ public abstract class GameImpl implements Game {
|
||||||
for (Ability ability : card.getAbilities(this)) {
|
for (Ability ability : card.getAbilities(this)) {
|
||||||
if (ability instanceof CompanionAbility) {
|
if (ability instanceof CompanionAbility) {
|
||||||
CompanionAbility companionAbility = (CompanionAbility) ability;
|
CompanionAbility companionAbility = (CompanionAbility) ability;
|
||||||
if (companionAbility.isLegal(cards, startingHandSize)) {
|
if (companionAbility.isLegal(cards, minimumDeckSize)) {
|
||||||
potentialCompanions.add(card);
|
potentialCompanions.add(card);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue