mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +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.keyword.FlashbackAbility;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.cards.repository.PluginClassloaderRegistery;
|
||||
import mage.constants.*;
|
||||
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
|
||||
// example: if set contains only one card side, e.g. dev forget to add it
|
||||
// verify test checks missing side cards in test_checkMissingSecondSideCardsInSets
|
||||
CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCardByClassName(secondSideCardClazz.getCanonicalName(), expansionSetCode);
|
||||
secondSideCard = cardInfo.getCard();
|
||||
// example: if set contains only one card side
|
||||
// method used in cards database creating, so can't use repository here
|
||||
ExpansionSet.SetCardInfo info = Sets.findCardByClass(secondSideCardClazz, expansionSetCode);
|
||||
if (info == null) {
|
||||
return null;
|
||||
}
|
||||
secondSideCard = createCard(secondSideCardClazz, new CardSetInfo(info.getName(), expansionSetCode, info.getCardNumber(), info.getRarity(), info.getGraphicInfo()));
|
||||
return secondSideCard;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
return instance;
|
||||
}
|
||||
|
||||
private Set<String> customSets = new HashSet<>();
|
||||
private final Set<String> customSets = new HashSet<>();
|
||||
|
||||
private Sets() {
|
||||
List<String> packages = new ArrayList<>();
|
||||
|
@ -199,4 +199,21 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
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