* Game: fixed that Snow-Covered lands can be added to auto-generated or submitted/timeout decks (#7222);

This commit is contained in:
Oleg Agafonov 2020-12-23 10:26:49 +04:00
parent 10cf9c4a4e
commit dd7c1939d3
6 changed files with 71 additions and 51 deletions

View file

@ -37,10 +37,6 @@ public class AddLandDialog extends MageDialog {
this.setModal(true);
}
private boolean setHaveSnowLands(ExpansionInfo exp) {
return CardRepository.instance.haveSnowLands(exp.getCode());
}
public void showDialog(Deck deck, DeckEditorMode mode) {
this.deck = deck;
SortedSet<String> landSetNames = new TreeSet<>();
@ -49,7 +45,7 @@ public class AddLandDialog extends MageDialog {
// decide from which sets basic lands are taken from
for (String setCode : deck.getExpansionSetCodes()) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
if (expansionInfo != null && expansionInfo.hasBasicLands() && !setHaveSnowLands(expansionInfo)) {
if (expansionInfo != null && expansionInfo.hasBasicLands() && !CardRepository.haveSnowLands(expansionInfo.getCode())) {
defaultSetName = expansionInfo.getName();
break;
}
@ -62,7 +58,7 @@ public class AddLandDialog extends MageDialog {
if (expansionInfo != null) {
List<ExpansionInfo> blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
for (ExpansionInfo blockSet : blockSets) {
if (blockSet.hasBasicLands() && !setHaveSnowLands(expansionInfo)) {
if (blockSet.hasBasicLands() && !CardRepository.haveSnowLands(expansionInfo.getCode())) {
defaultSetName = expansionInfo.getName();
break;
}
@ -71,11 +67,12 @@ public class AddLandDialog extends MageDialog {
}
}
}
// if still no set with lands found, add list of all available
List<ExpansionInfo> basicLandSets = ExpansionRepository.instance.getSetsWithBasicLandsByReleaseDate();
for (ExpansionInfo expansionInfo : basicLandSets) {
// snow lands only in free mode
if (mode != DeckEditorMode.FREE_BUILDING && setHaveSnowLands(expansionInfo)) {
if (mode != DeckEditorMode.FREE_BUILDING && CardRepository.haveSnowLands(expansionInfo.getCode())) {
continue;
}
landSetNames.add(expansionInfo.getName());
@ -148,6 +145,8 @@ public class AddLandDialog extends MageDialog {
throw new IllegalArgumentException("Code of Set " + landSetName + " not found");
}
criteria.setCodes(expansionInfo.getCode());
} else {
criteria.ignoreSetsWithSnowLands();
}
criteria.rarities(Rarity.LAND).name(landName);
List<CardInfo> cards = CardRepository.instance.findCards(criteria);