forked from External/mage
- Fixed #4220 - card viewer raise error with alternative card numbers;
- Fixed potential error on getCardsByRarity; - Added inner checks for wrong booster max card numbers settings;
This commit is contained in:
parent
6802ebc537
commit
66a70dd116
5 changed files with 62 additions and 5 deletions
|
|
@ -32,6 +32,7 @@ import mage.cards.repository.CardInfo;
|
|||
import mage.cards.repository.CardRepository;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetType;
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.RandomUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -82,6 +83,10 @@ public abstract class ExpansionSet implements Serializable {
|
|||
return this.cardNumber;
|
||||
}
|
||||
|
||||
public int getCardNumberAsInt(){
|
||||
return CardUtil.parseCardNumberAsInt(this.cardNumber);
|
||||
}
|
||||
|
||||
public Rarity getRarity() {
|
||||
return this.rarity;
|
||||
}
|
||||
|
|
@ -388,9 +393,10 @@ public abstract class ExpansionSet implements Serializable {
|
|||
criteria.doubleFaced(false);
|
||||
}
|
||||
savedCardsInfos = CardRepository.instance.findCards(criteria);
|
||||
// Workaround after card number is numeric
|
||||
// Workaround after card number is numeric (p.s. card number is not numeric for some cards)
|
||||
// TODO: some sets have фывфывфывфывфыв
|
||||
if (maxCardNumberInBooster != Integer.MAX_VALUE) {
|
||||
savedCardsInfos.removeIf(next -> Integer.valueOf(next.getCardNumber()) > maxCardNumberInBooster && rarity != Rarity.LAND);
|
||||
savedCardsInfos.removeIf(next -> next.getCardNumberAsInt() > maxCardNumberInBooster && rarity != Rarity.LAND);
|
||||
}
|
||||
|
||||
savedCards.put(rarity, savedCardsInfos);
|
||||
|
|
@ -431,4 +437,6 @@ public abstract class ExpansionSet implements Serializable {
|
|||
savedCards.clear();
|
||||
}
|
||||
|
||||
public int getMaxCardNumberInBooster() { return maxCardNumberInBooster; }
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue