mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- 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:
@@ -69,7 +69,7 @@ public class CardPool extends ItemPool<PaperCard> {
|
|||||||
this.add(cp, amount);
|
this.add(cp, amount);
|
||||||
} else {
|
} else {
|
||||||
// random art index specified, make sure we get different groups of cards with different art
|
// 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++) {
|
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);
|
PaperCard cp_random = isCommonCard ? StaticData.instance().getCommonCards().tryGetCard(cardName, setCode, i) : StaticData.instance().getVariantCards().tryGetCard(cardName, setCode, i);
|
||||||
this.add(cp_random, artGroups[i]);
|
this.add(cp_random, artGroups[i]);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class MyRandom {
|
|||||||
return MyRandom.random;
|
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];
|
int[] groups = new int[numGroups];
|
||||||
|
|
||||||
for (int i = 0; i < value; i++) {
|
for (int i = 0; i < value; i++) {
|
||||||
|
|||||||
@@ -125,10 +125,11 @@ public final class QuestUtilCards {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (String landName : MagicColor.Constant.BASIC_LANDS) {
|
for (String landName : MagicColor.Constant.BASIC_LANDS) {
|
||||||
for (int i=0; i<nBasic; i++) {
|
int artCount = db.getArtCount(landName, landCode);
|
||||||
// we have to add lands one at a time here because ItemPool<PaperCard> can't handle art index
|
int artGroups[] = MyRandom.splitIntoRandomGroups(nBasic, artCount);
|
||||||
// randomization internally when adding cards in a batch (all cards end up with the same art)
|
|
||||||
pool.add(db.getCard(landName, landCode, -1), 1);
|
for (int i=0; i<artGroups.length; i++) {
|
||||||
|
pool.add(db.getCard(landName, landCode, i), artGroups[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user