Game: fixed that search by card name was able to return a wrong card (example: cheat command)

This commit is contained in:
Oleg Agafonov 2023-05-08 22:58:30 +04:00
parent 6144dc64b7
commit 1dea98cf1f
13 changed files with 39 additions and 52 deletions

View file

@ -291,7 +291,7 @@ public final class DeckGenerator {
for (ColoredManaSymbol c : ColoredManaSymbol.values()) {
String landName = DeckGeneratorPool.getBasicLandName(c.toString());
criteria.rarities(Rarity.LAND).nameExact(landName);
criteria.rarities(Rarity.LAND).name(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");

View file

@ -154,9 +154,11 @@ public class AddLandDialog extends MageDialog {
criteria.ignoreSetsWithSnowLands();
}
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
// snow basics added only if in free mode and the chosen set has exclusively snow basics
// use contains to find snow lands too
criteria.nameContains(landName);
} else {
criteria.nameExact(landName);
criteria.name(landName);
}
criteria.rarities(Rarity.LAND);
List<CardInfo> cards = CardRepository.instance.findCards(criteria);

View file

@ -577,7 +577,7 @@ public enum WizardCardsImageSource implements CardImageSource {
private void getLandVariations(LinkedHashMap<String, String> setLinks, String cardSet, int multiverseId, String cardName) throws IOException, NumberFormatException {
CardCriteria criteria = new CardCriteria();
criteria.nameExact(cardName);
criteria.name(cardName);
criteria.setCodes(cardSet);
List<CardInfo> cards = CardRepository.instance.findCards(criteria);