- Optimized the generation of basic lands with random art for the quest mode card pool and quest shop.

- Better name for a function to split a value into a predefined number of random groups.
This commit is contained in:
Agetian
2014-01-15 15:59:57 +00:00
parent f4263e943d
commit f131aafa44
3 changed files with 7 additions and 6 deletions

View File

@@ -69,7 +69,7 @@ public class CardPool extends ItemPool<PaperCard> {
this.add(cp, amount);
} else {
// random art index specified, make sure we get different groups of cards with different art
int[] artGroups = MyRandom.splitIntoGroups(amount, artCount);
int[] artGroups = MyRandom.splitIntoRandomGroups(amount, artCount);
for (int i = 0; i < artGroups.length; i++) {
PaperCard cp_random = isCommonCard ? StaticData.instance().getCommonCards().tryGetCard(cardName, setCode, i) : StaticData.instance().getVariantCards().tryGetCard(cardName, setCode, i);
this.add(cp_random, artGroups[i]);

View File

@@ -56,7 +56,7 @@ public class MyRandom {
return MyRandom.random;
}
public static int[] splitIntoGroups(final int value, final int numGroups) {
public static int[] splitIntoRandomGroups(final int value, final int numGroups) {
int[] groups = new int[numGroups];
for (int i = 0; i < value; i++) {

View File

@@ -125,10 +125,11 @@ public final class QuestUtilCards {
}
for (String landName : MagicColor.Constant.BASIC_LANDS) {
for (int i=0; i<nBasic; i++) {
// we have to add lands one at a time here because ItemPool<PaperCard> can't handle art index
// randomization internally when adding cards in a batch (all cards end up with the same art)
pool.add(db.getCard(landName, landCode, -1), 1);
int artCount = db.getArtCount(landName, landCode);
int artGroups[] = MyRandom.splitIntoRandomGroups(nBasic, artCount);
for (int i=0; i<artGroups.length; i++) {
pool.add(db.getCard(landName, landCode, i), artGroups[i]);
}
}