mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
refactor and remove some dependencies
This commit is contained in:
@@ -56,17 +56,19 @@ public class CardPool extends ItemPool<PaperCard> {
|
||||
}
|
||||
|
||||
// NOTE: ART indices are "1" -based
|
||||
public void add(final String cardName, final String setCode, final int artIndex, final int amount) {
|
||||
public void add(final String cardName, String setCode, final int artIndex, final int amount) {
|
||||
PaperCard cp = StaticData.instance().getCommonCards().getCard(cardName, setCode, artIndex);
|
||||
boolean isCommonCard = cp != null;
|
||||
if ( !isCommonCard ) {
|
||||
cp = StaticData.instance().getVariantCards().getCard(cardName, setCode);
|
||||
}
|
||||
|
||||
int artCount = isCommonCard
|
||||
? StaticData.instance().getCommonCards().getArtCount(cardName, setCode) : 1;
|
||||
if (cp == null )
|
||||
throw new RuntimeException(String.format("Card %s from %s is not supported by Forge, as it's neither a known common card nor one of casual variants' card.", cardName, setCode ));
|
||||
|
||||
setCode = cp.getEdition();
|
||||
int artCount = isCommonCard ? StaticData.instance().getCommonCards().getArtCount(cardName, setCode) : 1;
|
||||
|
||||
if ( cp != null) {
|
||||
if (artIndex >= 0 || artCount <= 1) {
|
||||
// either a specific art index is specified, or there is only one art, so just add the card
|
||||
this.add(cp, amount);
|
||||
@@ -84,10 +86,6 @@ public class CardPool extends ItemPool<PaperCard> {
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new RuntimeException(String.format("Card %s from %s is not supported by Forge, as it's neither a known common card nor one of casual variants' card.", cardName, setCode ));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all from a List of CardPrinted.
|
||||
|
||||
@@ -60,7 +60,7 @@ public class MyRandom {
|
||||
int[] groups = new int[numGroups];
|
||||
|
||||
for (int i = 0; i < value; i++) {
|
||||
groups[MyRandom.getRandom().nextInt(numGroups)]++;
|
||||
groups[random.nextInt(numGroups)]++;
|
||||
}
|
||||
|
||||
return groups;
|
||||
|
||||
@@ -39,7 +39,6 @@ import forge.limited.BoosterDraft;
|
||||
import forge.limited.IBoosterDraft;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
/**
|
||||
* Updates the deck editor UI as necessary draft selection mode.
|
||||
|
||||
@@ -37,7 +37,6 @@ import forge.limited.SealedCardPoolGenerator;
|
||||
import forge.limited.SealedDeckBuilder;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.MyRandom;
|
||||
import forge.util.storage.IStorage;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user