mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
correct how collectorNumber is located
The existing logic will always return the first match for a given card name, even if there are multiple different printings of the same card name within a set. This change aligns the collectorNumber with the alternate art index. Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
This commit is contained in:
@@ -312,14 +312,18 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
||||
return tryGetCard(request);
|
||||
}
|
||||
|
||||
public String getCardCollectorNumber(String cardName, String reqEdition) {
|
||||
public String getCardCollectorNumber(String cardName, String reqEdition, int artIndex) {
|
||||
cardName = getName(cardName);
|
||||
CardEdition edition = editions.get(reqEdition);
|
||||
if (edition == null)
|
||||
return null;
|
||||
int numMatches = 0;
|
||||
for (CardInSet card : edition.getCards()) {
|
||||
if (card.name.equalsIgnoreCase(cardName)) {
|
||||
return card.collectorNumber;
|
||||
numMatches += 1;
|
||||
if (numMatches == artIndex) {
|
||||
return card.collectorNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user