card_fields rewrite and magic-modules.mse-include (#21)
Overhauls the card_fields file to allow for template designers more freedom in manipulating data. Adds magic-modules.mse-include, a large scale include file for building templates in a standardized way. Applying this to existing frames will be coming in future updates.
This commit is contained in:
@@ -177,11 +177,11 @@ distil_color_words_statistic :=
|
||||
{
|
||||
colors := ""
|
||||
if lang_setting("is_colorless")() then colors := colors + "C"
|
||||
if lang_setting("is_white")() then colors := colors + "W"
|
||||
if lang_setting("is_blue")() then colors := colors + "U"
|
||||
if lang_setting("is_black")() then colors := colors + "B"
|
||||
if lang_setting("is_red")() then colors := colors + "R"
|
||||
if lang_setting("is_green")() then colors := colors + "G"
|
||||
if lang_setting("is_white")() then colors := colors + "W"
|
||||
if lang_setting("is_blue")() then colors := colors + "U"
|
||||
if lang_setting("is_black")() then colors := colors + "B"
|
||||
if lang_setting("is_red")() then colors := colors + "R"
|
||||
if lang_setting("is_green")() then colors := colors + "G"
|
||||
|
||||
if length(colors) > 1 and colors.0 == "C" then substring(colors, begin: 1) else colors
|
||||
}
|
||||
@@ -253,7 +253,7 @@ face_omniverse_color_statistic :=
|
||||
if chosen(choice: "land") then all_en_space_statistic(lang_setting("land"))
|
||||
else if chosen(choice: "multicolor") then all_en_space_statistic(lang_setting("multicolor"))
|
||||
else if count_chosen(choices: "white, blue, black, red, green, pink, purple, yellow, orange, brown") == 2
|
||||
and chosen(choice: "artifact") then all_en_space_statistic(lang_setting("hybrid")) ##hybrid artifacts would show as their first color
|
||||
and chosen(choice: "artifact") then all_en_space_statistic(lang_setting("hybrid")) ##hybrid artifacts would show as their first color
|
||||
else if chosen(choice: "hybrid") then all_en_space_statistic(lang_setting("hybrid"))
|
||||
else if (chosen(choice: "artifact")
|
||||
and not ( chosen(choice: "white")
|
||||
@@ -265,7 +265,7 @@ face_omniverse_color_statistic :=
|
||||
or chosen(choice: "purple")
|
||||
or chosen(choice: "yellow")
|
||||
or chosen(choice: "orange")
|
||||
or chosen(choice: "brown"))) then all_en_space_statistic(lang_setting("artifact"))
|
||||
or chosen(choice: "brown"))) then all_en_space_statistic(lang_setting("artifact"))
|
||||
else if chosen(choice: "white") then all_en_space_statistic(lang_setting("white"))
|
||||
else if chosen(choice: "blue") then all_en_space_statistic(lang_setting("blue"))
|
||||
else if chosen(choice: "black") then all_en_space_statistic(lang_setting("black"))
|
||||
@@ -461,14 +461,14 @@ face_mana_production_list_statistic :=
|
||||
# the mana symbols we can produce
|
||||
produced_symbols := wubrgc_break_statistic(lang_setting("mana_symbol_production")(combined_text))
|
||||
|
||||
(if lang_setting("is_plains")(sub) or contains_element(produced_symbols, element:"W") then ",W" else "") +
|
||||
(if lang_setting("is_island")(sub) or contains_element(produced_symbols, element:"U") then ",U" else "") +
|
||||
(if lang_setting("is_swamp")(sub) or contains_element(produced_symbols, element:"B") then ",B" else "") +
|
||||
(if lang_setting("is_mountain")(sub) or contains_element(produced_symbols, element:"R") then ",R" else "") +
|
||||
(if lang_setting("is_forest")(sub) or contains_element(produced_symbols, element:"G") then ",G" else "") +
|
||||
(if lang_setting("is_wastes")(name) or contains_element(produced_symbols, element:"C") then ",C" else "") +
|
||||
(if lang_setting("is_plains")(sub) or contains_element(produced_symbols, element:"W") then ",W" else "") +
|
||||
(if lang_setting("is_island")(sub) or contains_element(produced_symbols, element:"U") then ",U" else "") +
|
||||
(if lang_setting("is_swamp")(sub) or contains_element(produced_symbols, element:"B") then ",B" else "") +
|
||||
(if lang_setting("is_mountain")(sub) or contains_element(produced_symbols, element:"R") then ",R" else "") +
|
||||
(if lang_setting("is_forest")(sub) or contains_element(produced_symbols, element:"G") then ",G" else "") +
|
||||
(if lang_setting("is_wastes")(name) or contains_element(produced_symbols, element:"C") then ",C" else "") +
|
||||
(if can_Any then ","+all_en_space_statistic(lang_setting("mana_any")) else "") +
|
||||
(if can_Chosen then ","+all_en_space_statistic(lang_setting("mana_chosen")) else "")
|
||||
(if can_Chosen then ","+all_en_space_statistic(lang_setting("mana_chosen")) else "")
|
||||
}
|
||||
|
||||
# Word counting
|
||||
@@ -673,7 +673,7 @@ format_average_statistic :=
|
||||
rarity_statistic :=
|
||||
{
|
||||
if is_tokenish_statistics(card.shape) or lang_setting("is_token")(card.super_type) then all_en_space_statistic(lang_setting("token"))
|
||||
else if lang_setting("is_land")(card.super_type) and lang_setting("is_basic")(card.super_type) then all_en_space_statistic(lang_setting("basic_land"))
|
||||
else if lang_setting("is_land")(card.super_type) and lang_setting("is_basic")(card.super_type) then all_en_space_statistic(lang_setting("basic_land"))
|
||||
else all_en_space_statistic(lang_setting(replace_space_statistic(card.rarity)))
|
||||
}
|
||||
is_tokenish_statistics :=
|
||||
@@ -822,18 +822,18 @@ detect_custom_creature_subtypes_statistic :=
|
||||
for a from 0 to 1 do (
|
||||
subtypes := if a == 1 then face_detect_custom_subtypes_statistic(c.sub_type_2) else face_detect_custom_subtypes_statistic(c.sub_type)
|
||||
super := if a == 1 then c.super_type_2 else c.super_type
|
||||
is_creature := lang_setting("is_creature")(super) or lang_setting("is_kindred")(super)
|
||||
is_artifact := lang_setting("is_artifact")(super)
|
||||
is_enchantment := lang_setting("is_enchantment")(super)
|
||||
is_land := lang_setting("is_land")(super)
|
||||
is_just_creature := is_creature and not is_artifact and not is_enchantment and not is_land
|
||||
is_creature := lang_setting("is_creature")(super) or lang_setting("is_kindred")(super)
|
||||
is_artifact := lang_setting("is_artifact")(super)
|
||||
is_enchantment := lang_setting("is_enchantment")(super)
|
||||
is_land := lang_setting("is_land")(super)
|
||||
is_just_creature := is_creature and not is_artifact and not is_enchantment and not is_land
|
||||
for each s in subtypes do (
|
||||
# is this a canon type?
|
||||
has_creature := if is_creature then contains(creature_subtypes_statistic(), match:s+";") else false
|
||||
has_creature := if is_creature then contains(creature_subtypes_statistic(), match:s+";") else false
|
||||
if not has_creature then (
|
||||
if is_just_creature then creature_hard := creature_hard + [s]
|
||||
else if not is_creature then noncreature_hard := noncreature_hard + [s]
|
||||
else creature_soft := creature_soft + [s]
|
||||
if is_just_creature then creature_hard := creature_hard + [s]
|
||||
else if not is_creature then noncreature_hard := noncreature_hard + [s]
|
||||
else creature_soft := creature_soft + [s]
|
||||
)
|
||||
"" ## dummy return, otherwise it tries to concat scripts and explodes
|
||||
)
|
||||
@@ -878,36 +878,36 @@ detect_custom_subtypes_statistic :=
|
||||
for a from 0 to 1 do (
|
||||
subtypes := if a == 1 then face_detect_custom_subtypes_statistic(c.sub_type_2) else face_detect_custom_subtypes_statistic(c.sub_type)
|
||||
super := if a == 1 then c.super_type_2 else c.super_type
|
||||
is_creature := lang_setting("is_creature")(super) or lang_setting("is_kindred")(super)
|
||||
is_artifact := lang_setting("is_artifact")(super)
|
||||
is_enchantment := lang_setting("is_enchantment")(super)
|
||||
is_land := lang_setting("is_land")(super)
|
||||
is_creature := lang_setting("is_creature")(super) or lang_setting("is_kindred")(super)
|
||||
is_artifact := lang_setting("is_artifact")(super)
|
||||
is_enchantment := lang_setting("is_enchantment")(super)
|
||||
is_land := lang_setting("is_land")(super)
|
||||
is_spell := lang_setting("is_spell")(super)
|
||||
is_walker := lang_setting("is_planeswalker")(super) or lang_setting("is_emblem")(super)
|
||||
is_battle := lang_setting("is_battle")(super)
|
||||
is_just_creature := is_creature and not is_artifact and not is_enchantment and not is_land
|
||||
is_just_artifact := is_artifact and not is_creature and not is_enchantment and not is_land
|
||||
is_just_enchantment := is_enchantment and not is_creature and not is_artifact and not is_land
|
||||
is_just_land := is_land and not is_creature and not is_artifact and not is_enchantment
|
||||
is_just_creature := is_creature and not is_artifact and not is_enchantment and not is_land
|
||||
is_just_artifact := is_artifact and not is_creature and not is_enchantment and not is_land
|
||||
is_just_enchantment := is_enchantment and not is_creature and not is_artifact and not is_land
|
||||
is_just_land := is_land and not is_creature and not is_artifact and not is_enchantment
|
||||
for each s in subtypes do (
|
||||
# is this a canon type?
|
||||
has_creature := if is_creature then contains(creature_subtypes_statistic(), match:s+";") else false
|
||||
has_creature := if is_creature then contains(creature_subtypes_statistic(), match:s+";") else false
|
||||
has_artifact := if is_artifact then contains(artifact_subtypes_statistic(), match:s+";") else false
|
||||
has_enchantment := if is_enchantment then contains(enchantment_subtypes_statistic(), match:s+";") else false
|
||||
has_land := if is_land then contains(land_subtypes_statistic(), match:s+";") else false
|
||||
has_spell := if is_spell then contains(spell_subtypes_statistic(), match:s+";") else false
|
||||
has_land := if is_land then contains(land_subtypes_statistic(), match:s+";") else false
|
||||
has_spell := if is_spell then contains(spell_subtypes_statistic(), match:s+";") else false
|
||||
has_walker := if is_walker then contains(planeswalker_subtypes_statistic(), match:s+";") else false
|
||||
has_battle := if is_battle then contains(battle_subtypes_statistic(), match:s+";") else false
|
||||
if not has_creature and not has_artifact and not has_enchantment and not has_land and not has_walker and not has_battle and not has_spell then (
|
||||
if is_just_creature then creature_hard := creature_hard + [s]
|
||||
else if is_just_artifact then artifact_hard := artifact_hard + [s]
|
||||
else if is_just_enchantment then enchantment_hard := enchantment_hard + [s]
|
||||
else if is_just_land then land_hard := land_hard + [s]
|
||||
else if is_walker then walker_soft := walker_soft + [s]
|
||||
else if is_battle then battle_soft := battle_soft + [s]
|
||||
else if is_spell then spell_hard := spell_hard + [s]
|
||||
else if not is_creature then noncreature_hard := noncreature_hard + [s]
|
||||
else unknown_sub_types := unknown_sub_types + [s]
|
||||
if is_just_creature then creature_hard := creature_hard + [s]
|
||||
else if is_just_artifact then artifact_hard := artifact_hard + [s]
|
||||
else if is_just_enchantment then enchantment_hard := enchantment_hard + [s]
|
||||
else if is_just_land then land_hard := land_hard + [s]
|
||||
else if is_walker then walker_soft := walker_soft + [s]
|
||||
else if is_battle then battle_soft := battle_soft + [s]
|
||||
else if is_spell then spell_hard := spell_hard + [s]
|
||||
else if not is_creature then noncreature_hard := noncreature_hard + [s]
|
||||
else unknown_sub_types := unknown_sub_types + [s]
|
||||
)
|
||||
"" ## dummy return, otherwise it tries to concat scripts and explodes
|
||||
)
|
||||
@@ -950,14 +950,14 @@ detect_custom_subtypes_statistic :=
|
||||
creature_hard := sort_list(creature_hard, remove_duplicates:true)
|
||||
|
||||
final := "\n"
|
||||
if length(creature_hard) > 0 then final := final + "Custom Creature Types:\n" + join(creature_hard, sep:"\n") + "\n\n";
|
||||
if length(artifact_hard) > 0 then final := final + "Custom Artifact Types:\n" + join(artifact_hard, sep:"\n") + "\n\n";
|
||||
if length(enchantment_hard) > 0 then final := final + "Custom Enchantment Types:\n" + join(enchantment_hard, sep:"\n") + "\n\n";
|
||||
if length(land_hard) > 0 then final := final + "Custom Land Types:\n" + join(land_hard, sep:"\n") + "\n\n";
|
||||
if length(spell_hard) > 0 then final := final + "Custom Spell Types:\n" + join(spell_hard, sep:"\n") + "\n\n";
|
||||
if length(walker_soft) > 0 then final := final + "Custom Planeswalker Types:\n" + join(walker_soft, sep:"\n") + "\n\n";
|
||||
if length(battle_soft) > 0 then final := final + "Custom Battle Types:\n" + join(battle_soft, sep:"\n") + "\n\n";
|
||||
if length(undetermined_types) > 0 then final := final + "Custom Unknown Types:\n" + join(undetermined_types, sep:"\n") + "\n\n";
|
||||
if length(creature_hard) > 0 then final := final + "Custom Creature Types:\n" + join(creature_hard, sep:"\n") + "\n\n";
|
||||
if length(artifact_hard) > 0 then final := final + "Custom Artifact Types:\n" + join(artifact_hard, sep:"\n") + "\n\n";
|
||||
if length(enchantment_hard) > 0 then final := final + "Custom Enchantment Types:\n" + join(enchantment_hard, sep:"\n") + "\n\n";
|
||||
if length(land_hard) > 0 then final := final + "Custom Land Types:\n" + join(land_hard, sep:"\n") + "\n\n";
|
||||
if length(spell_hard) > 0 then final := final + "Custom Spell Types:\n" + join(spell_hard, sep:"\n") + "\n\n";
|
||||
if length(walker_soft) > 0 then final := final + "Custom Planeswalker Types:\n" + join(walker_soft, sep:"\n") + "\n\n";
|
||||
if length(battle_soft) > 0 then final := final + "Custom Battle Types:\n" + join(battle_soft, sep:"\n") + "\n\n";
|
||||
if length(undetermined_types) > 0 then final := final + "Custom Unknown Types:\n" + join(undetermined_types, sep:"\n") + "\n\n";
|
||||
|
||||
trace(final)
|
||||
""
|
||||
@@ -1159,7 +1159,7 @@ power_statistic :=
|
||||
fields := ["power"] + if not check_2_statistic() then []
|
||||
else if contains(card.shape, match: "flip")
|
||||
or contains(card.shape, match: "split")
|
||||
or contains(card.shape, match: "aftermath") then ["power_2"]
|
||||
or contains(card.shape, match: "aftermath") then ["power_2"]
|
||||
else if contains(card.shape, match: "double faced") then (if contains((card.styling or else styling).front_style or else "", match: "leveler") then ["power_4"] else ["power_2"])
|
||||
else []
|
||||
count := length(fields) - 1
|
||||
@@ -1171,7 +1171,7 @@ toughness_statistic :=
|
||||
fields := ["toughness"] + if not check_2_statistic() then []
|
||||
else if contains(card.shape, match: "flip")
|
||||
or contains(card.shape, match: "split")
|
||||
or contains(card.shape, match: "aftermath") then ["toughness_2"]
|
||||
or contains(card.shape, match: "aftermath") then ["toughness_2"]
|
||||
else if contains(card.shape, match: "double faced") then (if contains((card.styling or else styling).front_style or else "", match: "leveler") then ["toughness_4"] else ["toughness_2"])
|
||||
else []
|
||||
count := length(fields) - 1
|
||||
|
||||
Reference in New Issue
Block a user