Commit 6b09bde7 authored by twanvl's avatar twanvl

while it is still possible: renamed select:cyclic to select:equal.

Added "equal proportional" and "equal nonempty" for symmetry.
select:equal now takes weights into account.
parent 3fc08f0e
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
pack type: pack type:
name: basic land name: basic land
select: cyclic select: equal
filter: card.rarity == "basic land" and not is_token_card() # can be shifted filter: card.rarity == "basic land" and not is_token_card() # can be shifted
pack type: pack type:
name: common name: common
...@@ -114,23 +114,22 @@ pack type: ...@@ -114,23 +114,22 @@ pack type:
name: common sometimes shifted or special name: common sometimes shifted or special
selectable: false selectable: false
# TODO: Perhaps use some kind of proportional system here as well? # TODO: Perhaps use some kind of proportional system here as well?
select: cyclic select: equal
item: common item:
item: common name: common
item: shifted common or else common weight: 6
item: common item:
item: common name: shifted common or else common
item: shifted common or else common weight: 3
item: common item:
item: common name: special or else common
item: shifted common or else common weight: 1
item: special or else common
# of the uncommon slots, 1/3 will be shifted, 1/4 of that will be shifted rares instead # of the uncommon slots, 1/3 will be shifted, 1/4 of that will be shifted rares instead
pack type: pack type:
name: uncommon sometimes shifted name: uncommon sometimes shifted
selectable: false selectable: false
select: cyclic select: equal
item: uncommon item: uncommon
item: uncommon item: uncommon
item: shifted uncommon or rare or else uncommon item: shifted uncommon or rare or else uncommon
......
This diff is collapsed.
...@@ -121,11 +121,13 @@ class PackGenerator; ...@@ -121,11 +121,13 @@ class PackGenerator;
enum PackSelectType enum PackSelectType
{ SELECT_AUTO { SELECT_AUTO
, SELECT_ALL , SELECT_ALL
, SELECT_REPLACE
, SELECT_NO_REPLACE , SELECT_NO_REPLACE
, SELECT_CYCLIC , SELECT_REPLACE
, SELECT_PROPORTIONAL , SELECT_PROPORTIONAL
, SELECT_NONEMPTY , SELECT_NONEMPTY
, SELECT_EQUAL
, SELECT_EQUAL_PROPORTIONAL
, SELECT_EQUAL_NONEMPTY
, SELECT_FIRST , SELECT_FIRST
}; };
...@@ -200,17 +202,23 @@ class PackInstance : public IntrusivePtrBase<PackInstance> { ...@@ -200,17 +202,23 @@ class PackInstance : public IntrusivePtrBase<PackInstance> {
PackGenerator& parent; PackGenerator& parent;
int depth; //< 0 = no items, otherwise 1+max depth of items refered to int depth; //< 0 = no items, otherwise 1+max depth of items refered to
vector<CardP> cards; //< All cards that pass the filter vector<CardP> cards; //< All cards that pass the filter
size_t count; //< Total number of non-empty cards/items
double total_weight; //< Sum of item and card weights double total_weight; //< Sum of item and card weights
size_t requested_copies; //< The requested number of copies of this pack size_t requested_copies; //< The requested number of copies of this pack
size_t card_copies; //< The number of cards that were chosen to come from this pack size_t card_copies; //< The number of cards that were chosen to come from this pack
double expected_copies; double expected_copies;
/// Generate some copies of all cards and items
void generate_all(vector<CardP>* out, size_t copies);
/// Generate one card/item chosen at random (using the select type)
void generate_one_random(vector<CardP>* out);
}; };
class PackGenerator { class PackGenerator {
public: public:
/// Reset the generator, possibly switching the set or reseeding /// Reset the generator, possibly switching the set or reseeding
void reset(const SetP& set, int seed); void reset(const SetP& set, int seed);
/// Reset the generator, but not the set
void reset(int seed);
/// Find the PackInstance for the PackType with the given name /// Find the PackInstance for the PackType with the given name
PackInstance& get(const String& name); PackInstance& get(const String& name);
......
...@@ -373,7 +373,7 @@ CustomPackDialog::CustomPackDialog(Window* parent, const SetP& set, const PackTy ...@@ -373,7 +373,7 @@ CustomPackDialog::CustomPackDialog(Window* parent, const SetP& set, const PackTy
} }
void CustomPackDialog::updateTotals() { void CustomPackDialog::updateTotals() {
generator.gen.seed(0); generator.reset(0);
int total_packs = 0; int total_packs = 0;
FOR_EACH(pick,pickers) { FOR_EACH(pick,pickers) {
int copies = pick.value->GetValue(); int copies = pick.value->GetValue();
...@@ -636,7 +636,7 @@ void RandomPackPanel::onPackTypeClick(wxCommandEvent& ev) { ...@@ -636,7 +636,7 @@ void RandomPackPanel::onPackTypeClick(wxCommandEvent& ev) {
void RandomPackPanel::updateTotals() { void RandomPackPanel::updateTotals() {
#if USE_NEW_PACK_SYSTEM #if USE_NEW_PACK_SYSTEM
generator.gen.seed((unsigned)last_seed); generator.reset(last_seed);
#else #else
totals->clear(); totals->clear();
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment