CLB Update

This commit is contained in:
CajunAvenger
2022-06-29 07:21:32 -05:00
parent dc7c3fbbd0
commit 50ffff2f6f
464 changed files with 903585 additions and 63 deletions

View File

@@ -5,7 +5,7 @@ include file: language
include file: /magic-blends.mse-include/new-blends
############################################################## version check
version_date := {"2022-01-30"}
version_date := {"2022-06-07"}
############################################################## Sorting mana symbols
# correctly sort a mana symbol (no guild mana)
@@ -450,6 +450,7 @@ protection_code := {
else if match(input, match:"^its owner$") then "anything its owner controls"
else if match(input, match:"^(each of )?your opponents$") then "anything " + replace(input, match:"(each of )?your opponents", replace:"controlled by those players")
else if match(input, match:"(the|a) [^\n]* of your choice") then "anything " + replace(input, match:"(the|a) ([^\n]*) of your choice", replace:"of that \\2")
else if input == "colorless" then "anything colorless"
else "anything " + replace(english_singular(input), match:"and from", replace:"or", in_context:" <match> ")
output := " targeted, dealt damage, enchanted, equipped by " + output
if match(output, match:"(artifacts|creatures|instants|lands|planeswalkers|sorceries|tribals|planes|schemes|emblems|conspiracies|by [A-Z])") and not match(output, match:"(enchantmentsAura|Curse)") then
@@ -649,7 +650,9 @@ this_or_that := {
this := "this"
that := "that"
type := input
if is_creaturish(card.type) then type := "creature"
if input == "type" then type := main_type(card.type)
else if is_creaturish(card.type) then type := "creature"
if type == "" then type := "permanent"
if upper then (
this := "This"
that := "That"
@@ -780,6 +783,10 @@ text_filter :=
match:"SYMAROUND",
replace:"<sym></sym>"
)+
replace@(
match:"-\n-"
replace:"<soft-line>\n</soft-line>"
)+
# step 3a : expand shortcut word CARDNAME
replace@(
match: "CARDNAME>?",
@@ -873,7 +880,7 @@ text_filter :=
{ if set.mark_errors then
check_spelling(
language: language().spellcheck_code,
extra_dictionary: "/magic.mse-game/magic-words",
extra_dictionary: "/magic.mse-game/dictionary/magic-words",
extra_match: additional_text_words
)
else input
@@ -1181,6 +1188,9 @@ round_up := {to_int(0.99999999999998+input)}
round_near := {to_int(0.5+input)}
to_title := replace@(match:"(^| )([A-z])([^ ]*)", replace:{_1+ to_upper(_2) + to_lower(_3)})
to_sentence := replace@(match:"(^|\n)([A-z])([^\n]*)", replace:{_1+ to_upper(_2) + to_lower(_3)})
join_arrays := {
a1 + for x from 0 to length(a2)-1 do [a2[x]]
}
join := {
string := ""
if length(input) == 2 then spacer := " "
@@ -1189,11 +1199,21 @@ join := {
string := string + (if x == length(input)-1 then closing else "") + input[x] + (if x == length(input)-1 then "" else spacer)
string
}@(spacer:", ", closing:"and ")
includes := { flagged := false
for x from 0 to length(array)-1 do
if array[x] == input then flagged := true;
flagged
ar_position := {
pos := -1
dummy := for x from 0 to length(in)-1 do (
if in[x] == of then pos := x
"filler"
)
pos
}
unique_elements := {
e1 := []
e2 := []
e1 := e1 + for x from 0 to length(of)-1 do if ar_position(of:of[x], in:from) == -1 then [of[x]]
}
includes := {ar_position(of:input in:array) != -1}
pull_comma_array := {
array := split_text(input, match:divider)
length := length(comma_count(input))
@@ -1388,22 +1408,31 @@ auto_flags := {true}
front_modal_hint := {
if not auto_flags() then ["", "", 10.5]
else if remove_tags(card.sub_type_2) != "" then [card.sub_type_2, "<sym>"+card.casting_cost_2+"</sym>", 10.5]
else if card.casting_cost_2 != "" then [main_types(card.super_type_2), "<sym>"+card.casting_cost_2+"</sym>", 10.5]
else [main_types(card.super_type_2), mana_ability(card.rule_text_2), 10.5]
else if card.casting_cost_2 != "" then [main_type(card.super_type_2), "<sym>"+card.casting_cost_2+"</sym>", 10.5]
else [main_type(card.super_type_2), mana_ability(card.rule_text_2), 10.5]
}
back_modal_hint := {
if not auto_flags() then ["", "", 10.5]
else if remove_tags(card.sub_type) != "" then [card.sub_type, "<sym>"+card.casting_cost+"</sym>", 10.5]
else if card.casting_cost != "" then [main_types(card.super_type), "<sym>"+card.casting_cost+"</sym>", 10.5]
else [main_types(card.super_type), mana_ability(card.rule_text), 10.5]
else if card.casting_cost != "" then [main_type(card.super_type), "<sym>"+card.casting_cost+"</sym>", 10.5]
else [main_type(card.super_type), mana_ability(card.rule_text), 10.5]
}
mana_ability := {
abils := break_text(input, match:"(</?sym(-auto)?>)?T(</?sym(-auto)?>)?: Add (</?sym(-auto)?>)?(W|U|B|R|G|C)(</?sym(-auto)?>)?(, | or )?(</?sym(-auto)?>)?(W|U|B|R|G|C)?(</?sym(-auto)?>)?(, or )?(</?sym(-auto)?>)?(W|U|B|R|G|C)?(</?sym(-auto)?>)?.")
abils[0] or else ""
}
main_type := {
types := main_types(input)
if length(types) == 0 then ""
else if includes("Creature", array:types)
then "Creature"
else if includes("Land", array:types)
then "Land"
else types[0]
}
main_types := {
types := break_text(input, match:"(Land|Instant|Sorcery|Artifact|Enchantment|Creature|Planeswalker)")
types[0] or else ""
types or else [""]
}
######################## Mainframe mana
use_v_mana := {contains(set.custom_mana_symbol_name, match:".png")}
@@ -1413,6 +1442,20 @@ use_color_v_mana := { use_v_mana() and chosen(set.mana_symbol_options, choice:"c
use_hybrid_v_mana := { use_v_mana() and chosen(set.mana_symbol_options, choice:"hybrid with colors")}
v_mana_name := {if not use_v_mana() then "" else replace(set.custom_mana_symbol_name, match:"(.+/|\\.png)", replace:"")}
v_mana_loc := {if not use_v_mana() then "" else replace(set.custom_mana_symbol_name, match:"{v_mana_name()}\\.png", replace:"")}
v_mana_num := {max(to_number(set.number_hybrid_variants),0) or else -1}
use_custom_stamp := {contains(set.custom_stamp_name, match:".png")}
c_stamp_name := {
if not use_custom_stamp() then ""
else if card.stamp == "custom" then set.custom_stamp_name
else if card.stamp == "custom color" then replace(set.custom_stamp_name, match:"(.+/|\\.png)", replace:"")
else ""
}
c_stamp_loc := {
if card.stamp != "custom color" or not use_custom_stamp() then ""
else replace(set.custom_stamp_name, match:"{c_stamp_name()}\\.png", replace:"")
}
searchPull := filter_text@(match:"search(name|mana|type|rules|flavor|text|notes)")
searchSnip := replace@(match:"search(name|mana|type|rules|flavor|text|notes)_", replace:"")