mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Some minor changes.
This commit is contained in:
parent
905fd65ebd
commit
bdaa78e144
4 changed files with 121 additions and 120 deletions
|
|
@ -30,7 +30,6 @@ package mage.cards.decks;
|
|||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Sets;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.constants.Rarity;
|
||||
|
|
@ -112,14 +111,14 @@ public class Constructed extends DeckValidator {
|
|||
if (!rarities.isEmpty()) {
|
||||
for (Card card : deck.getCards()) {
|
||||
if (!rarities.contains(card.getRarity())) {
|
||||
if( !legalRarity(card) ){
|
||||
if (!legalRarity(card)) {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (!rarities.contains(card.getRarity())) {
|
||||
if( !legalRarity(card) ){
|
||||
if (!legalRarity(card)) {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -128,14 +127,14 @@ public class Constructed extends DeckValidator {
|
|||
|
||||
for (Card card : deck.getCards()) {
|
||||
if (!isSetAllowed(card.getExpansionSetCode())) {
|
||||
if( !legalSets(card) ){
|
||||
if (!legalSets(card)) {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (!isSetAllowed(card.getExpansionSetCode())) {
|
||||
if( !legalSets(card) ){
|
||||
if (!legalSets(card)) {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -147,10 +146,11 @@ public class Constructed extends DeckValidator {
|
|||
|
||||
/**
|
||||
* Checks if the given card is legal in any of the given rarities
|
||||
*
|
||||
* @param card - the card to check
|
||||
* @return Whether the card was printed at any of the given rarities.
|
||||
*/
|
||||
protected boolean legalRarity(Card card){
|
||||
protected boolean legalRarity(Card card) {
|
||||
// check if card is legal if taken from other set
|
||||
boolean legal = false;
|
||||
List<CardInfo> cardInfos = CardRepository.instance.findCards(card.getName());
|
||||
|
|
@ -168,16 +168,22 @@ public class Constructed extends DeckValidator {
|
|||
|
||||
/**
|
||||
* Checks if a given set is legal in this format.
|
||||
*
|
||||
* @param code - the set code to check
|
||||
* @return Whether the set is legal in this format.
|
||||
*/
|
||||
protected boolean isSetAllowed(String code) {
|
||||
if(Sets.isCustomSet(code)) return allowAllCustomSets || allowedCustomSetCodes.contains(code);
|
||||
else return setCodes.isEmpty() || setCodes.contains(code);
|
||||
// To check here for custom set makes no sens IMHO because the format does define what's aloowed and what not
|
||||
// if (Sets.isCustomSet(code)) {
|
||||
// return allowAllCustomSets || allowedCustomSetCodes.contains(code);
|
||||
// } else {
|
||||
return setCodes.isEmpty() || setCodes.contains(code);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given card is legal in any of the given sets
|
||||
*
|
||||
* @param card - the card to check
|
||||
* @return Whether the card was printed in any of this format's sets.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue