mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Merge fix
This commit is contained in:
parent
1b430e5d99
commit
4e174e25be
2 changed files with 25 additions and 7 deletions
|
@ -10,8 +10,6 @@ import mage.abilities.hint.Hint;
|
||||||
import mage.abilities.hint.HintUtils;
|
import mage.abilities.hint.HintUtils;
|
||||||
import mage.abilities.keyword.FlashbackAbility;
|
import mage.abilities.keyword.FlashbackAbility;
|
||||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||||
import mage.cards.repository.CardInfo;
|
|
||||||
import mage.cards.repository.CardRepository;
|
|
||||||
import mage.cards.repository.PluginClassloaderRegistery;
|
import mage.cards.repository.PluginClassloaderRegistery;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.counters.Counter;
|
import mage.counters.Counter;
|
||||||
|
@ -695,10 +693,13 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
||||||
}
|
}
|
||||||
|
|
||||||
// must be non strict search in any sets, not one set
|
// must be non strict search in any sets, not one set
|
||||||
// example: if set contains only one card side, e.g. dev forget to add it
|
// example: if set contains only one card side
|
||||||
// verify test checks missing side cards in test_checkMissingSecondSideCardsInSets
|
// method used in cards database creating, so can't use repository here
|
||||||
CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCardByClassName(secondSideCardClazz.getCanonicalName(), expansionSetCode);
|
ExpansionSet.SetCardInfo info = Sets.findCardByClass(secondSideCardClazz, expansionSetCode);
|
||||||
secondSideCard = cardInfo.getCard();
|
if (info == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
secondSideCard = createCard(secondSideCardClazz, new CardSetInfo(info.getName(), expansionSetCode, info.getCardNumber(), info.getRarity(), info.getGraphicInfo()));
|
||||||
return secondSideCard;
|
return secondSideCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<String> customSets = new HashSet<>();
|
private final Set<String> customSets = new HashSet<>();
|
||||||
|
|
||||||
private Sets() {
|
private Sets() {
|
||||||
List<String> packages = new ArrayList<>();
|
List<String> packages = new ArrayList<>();
|
||||||
|
@ -199,4 +199,21 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ExpansionSet.SetCardInfo findCardByClass(Class<?> clazz, String preferedSetCode) {
|
||||||
|
ExpansionSet.SetCardInfo info = null;
|
||||||
|
if (instance.containsKey(preferedSetCode)) {
|
||||||
|
info = instance.get(preferedSetCode).findCardInfoByClass(clazz).stream().findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info == null) {
|
||||||
|
for (Map.Entry<String, ExpansionSet> entry : instance.entrySet()) {
|
||||||
|
info = entry.getValue().findCardInfoByClass(clazz).stream().findFirst().orElse(null);
|
||||||
|
if (info != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue