Multiple changes:

- game: fixed possible empty pay text in custom costs;
- debug: improved debug info for CardInfo objects;
- db: removed unused split sides from cards database;
- db: fixed constant cards adding on each cards database scan (e.g. on tests start);
This commit is contained in:
Oleg Agafonov 2021-08-13 14:54:10 +04:00
parent cd22dfd4cc
commit 76e57d009e
3 changed files with 18 additions and 8 deletions

View file

@ -42,6 +42,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
public ManaCostsImpl(final ManaCostsImpl<T> costs) {
this.id = costs.id;
this.text = costs.text;
for (T cost : costs) {
this.add(cost.copy());
}

View file

@ -478,4 +478,9 @@ public class CardInfo {
public String getModalDoubleFacesSecondSideName() {
return modalDoubleFacesSecondSideName;
}
@Override
public String toString() {
return String.format("%s (%s, %s)", getName(), getSetCode(), getCardNumber());
}
}

View file

@ -52,19 +52,23 @@ public final class CardScanner {
// check cards (only add mode, without updates)
for (ExpansionSet set : Sets.getInstance().values()) {
for (ExpansionSet.SetCardInfo setInfo : set.getSetCardInfo()) {
if (CardRepository.instance.findCard(set.getCode(), setInfo.getCardNumber()) == null) {
// need add
if (CardRepository.instance.findCard(set.getCode(), setInfo.getCardNumber(), false) == null) {
// found new card
Card card = CardImpl.createCard(
setInfo.getCardClass(),
new CardSetInfo(setInfo.getName(), set.getCode(), setInfo.getCardNumber(), setInfo.getRarity(), setInfo.getGraphicInfo()),
errorsList);
if (card != null) {
cardsToAdd.add(new CardInfo(card)); // normal, transformed, adventure, modal double faces -- all must have single face in db
if (card instanceof SplitCard) {
SplitCard splitCard = (SplitCard) card;
cardsToAdd.add(new CardInfo(splitCard.getLeftHalfCard()));
cardsToAdd.add(new CardInfo(splitCard.getRightHalfCard()));
}
// Adds only main card, except night cards.
// TODO: remove night cards from sets and db someday
// Possible reasons for night cards in sets:
// - direct put night card to battlefield by name in tests;
// - images download;
// - in old days xmage client was able to works without card classes, e.g.
// downloads unknown cards from the server as texts (images, hints and all other works fine with it)
cardsToAdd.add(new CardInfo(card));
}
}
}