Commit b20d2637 authored by twanvl's avatar twanvl

fixed: version number propagates to included files

magic pack template now uses 'pack type' instead of 'pack item'
parent f07494b6

############################################################## Card pack items
############################################################## Card pack types
pack item:
pack type:
name: basic land
select: cyclic
filter: card.rarity == "basic land" and not is_token_card() # can be shifted
pack item:
pack type:
name: common
filter: card.rarity == "common" and not is_token_card() and not is_shifted_card()
pack item:
pack type:
name: uncommon
filter: card.rarity == "uncommon" and not is_token_card() and not is_shifted_card()
pack item:
pack type:
name: rare
filter: card.rarity == "rare" and not is_token_card() and not is_shifted_card()
pack item:
pack type:
name: mythic rare
filter: card.rarity == "mythic rare" and not is_token_card() and not is_shifted_card()
pack item:
pack type:
name: special
filter: card.rarity == "special" and not is_token_card() # can be shifted
pack item:
pack type:
name: shifted common
filter: card.rarity == "common" and not is_token_card() and is_shifted_card()
pack item:
pack type:
name: shifted uncommon
filter: card.rarity == "uncommon" and not is_token_card() and is_shifted_card()
pack item:
pack type:
name: shifted rare
filter:
( card.rarity == "rare" or
card.rarity == "mythic rare" # We've got to put shifted mythic rares somewhere
) and not is_token_card() and is_shifted_card()
pack item:
pack type:
name: token / rulestip
filter: is_token_card()
############################################################## shifted/special if possible
# shifted common if they exist, otherwise a normal common
pack item:
pack type:
name: shifted common or else common
selectable: false
select: first
......@@ -49,7 +49,7 @@ pack item:
item: common
# basic land if it exist, otherwise a common
pack item:
pack type:
name: basic land or else common
selectable: false
select: first
......@@ -57,7 +57,7 @@ pack item:
item: common
# special if it exist, otherwise a common
pack item:
pack type:
name: special or else common
selectable: false
select: first
......@@ -65,7 +65,7 @@ pack item:
item: common
# shifted uncommon/rare if they exist, otherwise a normal uncommon
pack item:
pack type:
name: shifted uncommon or rare or else uncommon
selectable: false
select: first
......@@ -74,7 +74,7 @@ pack item:
############################################################## Randomized selections
pack item:
pack type:
name: mythic rare or rare
selectable: false
# In Shards of Alara there are 15 mythic rares and 53 rares.
......@@ -96,7 +96,7 @@ pack item:
name: rare
probability: 2
pack item:
pack type:
name: shifted uncommon or rare
selectable: false
select: nonempty
......@@ -110,7 +110,7 @@ pack item:
############################################################## Common proportions of cards
# of the common slots, 3/10 will be shifted, 1/10 will be special
pack item:
pack type:
name: common sometimes shifted or special
selectable: false
# TODO: Perhaps use some kind of proportional system here as well?
......@@ -127,7 +127,7 @@ pack item:
item: special or else common
# of the uncommon slots, 1/3 will be shifted, 1/4 of that will be shifted rares instead
pack item:
pack type:
name: uncommon sometimes shifted
selectable: false
select: cyclic
......
......@@ -30,14 +30,18 @@ Reader::Reader(const InputStreamP& input, Packaged* package, const String& filen
handleAppVersion();
}
Reader::Reader(Packaged* pkg, const String& filename, bool ignore_invalid)
Reader::Reader(Reader* parent, Packaged* pkg, const String& filename, bool ignore_invalid)
: indent(0), expected_indent(0), state(OUTSIDE)
, ignore_invalid(ignore_invalid)
, filename(filename), package(pkg), line_number(0), previous_line_number(0)
, input(package_manager.openFileFromPackage(package, filename))
{
moveNext();
// in an included file, use the app version of the parent if we have none
handleAppVersion();
if (file_app_version == 0) {
file_app_version = parent->file_app_version;
}
}
void Reader::addAlias(Version end_version, const Char* a, const Char* b) {
......@@ -53,7 +57,7 @@ void Reader::handleIgnore(int end_version, const Char* a) {
}
void Reader::handleAppVersion() {
if (enterBlock(_("mse_version"))) {
if (enterBlock(_("mse_version"))) {
handle(file_app_version);
if (app_version < file_app_version) {
handle_warning(_ERROR_2_("newer version", filename, file_app_version.toString()), false);
......
......@@ -32,18 +32,18 @@ typedef shared_ptr<wxInputStream> InputStreamP;
* object that was just read.
*/
class Reader {
private:
/// Construct a reader that reads a file in a package
/** Used for "include file" keys.
* package can be nullptr
*/
Reader(Reader* parent, Packaged* package, const String& filename, bool ignore_invalid = false);
public:
/// Construct a reader that reads from the given input stream
/** filename is used only for error messages
*/
Reader(const InputStreamP& input, Packaged* package = nullptr, const String& filename = wxEmptyString, bool ignore_invalid = false);
/// Construct a reader that reads a file in a package
/** Used for "include file" keys.
* package can be nullptr
*/
Reader(Packaged* package, const String& filename, bool ignore_invalid = false);
~Reader() { showWarnings(); }
/// Tell the reflection code we are reading
......@@ -182,7 +182,7 @@ class Reader {
template <typename T>
void unknownKey(T& v) {
if (key == _("include file")) {
Reader reader(package, value, ignore_invalid);
Reader reader(this, package, value, ignore_invalid);
reader.handle_greedy(v);
moveNext();
} else {
......
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