mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Make Add Land dialog no longer add a random mix of regular and snow-covered basic lands (#9353)
The Add Land dialog now only adds regular basic lands and never snow-covered ones, unless you specifically select a set that only contains snow basics (e.g. MH1) Sets that only contain snow basics are not selectable when adding lands to a Limited deck.
This commit is contained in:
parent
ebdb6b53a4
commit
7554a2b6b5
7 changed files with 32 additions and 13 deletions
|
|
@ -291,7 +291,7 @@ public final class DeckGenerator {
|
|||
|
||||
for (ColoredManaSymbol c : ColoredManaSymbol.values()) {
|
||||
String landName = DeckGeneratorPool.getBasicLandName(c.toString());
|
||||
criteria.rarities(Rarity.LAND).name(landName);
|
||||
criteria.rarities(Rarity.LAND).nameExact(landName);
|
||||
List<CardInfo> cards = CardRepository.instance.findCards(criteria);
|
||||
if (cards.isEmpty()) { // Workaround to get basic lands if lands are not available for the given sets
|
||||
criteria.setCodes("M15");
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ public class AddLandDialog extends MageDialog {
|
|||
private static final Logger logger = Logger.getLogger(MageDialog.class);
|
||||
|
||||
private Deck deck;
|
||||
|
||||
private DeckEditorMode mode;
|
||||
|
||||
private static final int DEFAULT_SEALED_DECK_CARD_NUMBER = 40;
|
||||
|
||||
|
|
@ -41,6 +43,7 @@ public class AddLandDialog extends MageDialog {
|
|||
|
||||
public void showDialog(Deck deck, DeckEditorMode mode) {
|
||||
this.deck = deck;
|
||||
this.mode = mode;
|
||||
SortedSet<String> landSetNames = new TreeSet<>();
|
||||
String defaultSetName = null;
|
||||
if (mode != DeckEditorMode.FREE_BUILDING) {
|
||||
|
|
@ -139,10 +142,11 @@ public class AddLandDialog extends MageDialog {
|
|||
|
||||
private void addLands(String landName, int number, boolean useFullArt) {
|
||||
String landSetName = (String) cbLandSet.getSelectedItem();
|
||||
ExpansionInfo expansionInfo = null;
|
||||
|
||||
CardCriteria criteria = new CardCriteria();
|
||||
if (!landSetName.equals("<Random lands>")) {
|
||||
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByName(landSetName);
|
||||
expansionInfo = ExpansionRepository.instance.getSetByName(landSetName);
|
||||
if (expansionInfo == null) {
|
||||
throw new IllegalArgumentException("Code of Set " + landSetName + " not found");
|
||||
}
|
||||
|
|
@ -150,7 +154,12 @@ public class AddLandDialog extends MageDialog {
|
|||
} else {
|
||||
criteria.ignoreSetsWithSnowLands();
|
||||
}
|
||||
criteria.rarities(Rarity.LAND).name(landName);
|
||||
if (mode == DeckEditorMode.FREE_BUILDING && expansionInfo != null && CardRepository.haveSnowLands(expansionInfo.getCode())) {
|
||||
criteria.name(landName); // snow basics added only if in free mode and the chosen set has exclusively snow basics
|
||||
} else {
|
||||
criteria.nameExact(landName);
|
||||
}
|
||||
criteria.rarities(Rarity.LAND);
|
||||
List<CardInfo> cards = CardRepository.instance.findCards(criteria);
|
||||
if (cards.isEmpty()) {
|
||||
logger.error("No basic lands found in Set: " + landSetName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue