Handle strings and keys involving orange

This commit is contained in:
Sebastian Lundegård Kylander
2026-03-29 20:46:55 +02:00
parent c3e31a3c00
commit 071d11941f
4 changed files with 60 additions and 24 deletions

View File

@@ -31,6 +31,7 @@ watermark_colors := {
else if trim_colors(check_colors) == "black" then "bb"
else if trim_colors(check_colors) == "red" then "rr"
else if trim_colors(check_colors) == "green" then "gg"
else if trim_colors(check_colors) == "orange" then "oo"
else if contains(check_colors, match:"multi") or
contains(check_colors, match:"hybrid") or
contains(check_colors, match:", land") then hybrid_color(face:face)
@@ -45,22 +46,32 @@ hybrid_color := {
else if trimmed == "white, black" then "wb"
else if trimmed == "white, red" then "rw"
else if trimmed == "white, green" then "gw"
else if trimmed == "white, orange" then "wo"
else if trimmed == "blue, black" then "ub"
else if trimmed == "blue, red" then "ur"
else if trimmed == "blue, green" then "gu"
else if trimmed == "blue, orange" then "uo"
else if trimmed == "black, red" then "br"
else if trimmed == "black, green" then "bg"
else if trimmed == "black, orange" then "bo"
else if trimmed == "red, green" then "rg"
else if trimmed == "red, orange" then "ro"
else if trimmed == "green, orange" then "go"
else if trimmed == "white, blue, reversed" then "uw"
else if trimmed == "white, black, reversed" then "bw"
else if trimmed == "white, red, reversed" then "wr"
else if trimmed == "white, green, reversed" then "wg"
else if trimmed == "white, orange, reversed" then "ow"
else if trimmed == "blue, black, reversed" then "bu"
else if trimmed == "blue, red, reversed" then "ru"
else if trimmed == "blue, green, reversed" then "ug"
else if trimmed == "blue, orange, reversed" then "ou"
else if trimmed == "black, red, reversed" then "rb"
else if trimmed == "black, green, reversed" then "bg"
else if trimmed == "black, green, reversed" then "gb"
else if trimmed == "black, orange, reversed" then "ob"
else if trimmed == "red, green, reversed" then "gr"
else if trimmed == "red, orange, reversed" then "or"
else if trimmed == "green, orange, reversed" then "og"
else "mm"
}@(face:"")
########################################################################
@@ -824,6 +835,7 @@ blend_colors := {
+ (if chosen(choice:"black" ) then "b")
+ (if chosen(choice:"red" ) then "r")
+ (if chosen(choice:"green" ) then "g")
+ (if chosen(choice:"orange") then "o")
)
if multi and (hybrid or colors == "") then (
colors := colors + "m"
@@ -1110,6 +1122,7 @@ font_white := {
+ (if chosen(choice:"black" ) then "b")
+ (if chosen(choice:"red" ) then "r")
+ (if chosen(choice:"green" ) then "g")
+ (if chosen(choice:"orange" ) then "o")
) + (if artifact then "a")
font_colors_white(
if chosen(choice:"land") then "l"

View File

@@ -850,7 +850,7 @@ languages := [
is_cda_colorless : match@(match: "(?i)is colorless")
is_cda_all_colors : match@(match: "(?i)is all colors")
cda_colors : filter_text@(match: "is (white|blue|black|red|green)((,|, and| and) (white|blue|black|red|green))*")
cda_colors : filter_text@(match: "is (white|blue|black|red|green|orange)((,|, and| and) (white|blue|black|red|green|orange))*")
white : "White"
blue : "Blue"

View File

@@ -438,6 +438,7 @@ colors_from_mana_symbols := {
if contains(input, match:"B") then str := str + ["black"]
if contains(input, match:"R") then str := str + ["red"]
if contains(input, match:"G") then str := str + ["green"]
if contains(input, match:"O") then str := str + ["orange"]
join(str, sep:", ")
}
@@ -590,6 +591,7 @@ colorless_color := {
else if cc == "black" then "b"
else if cc == "red" then "r"
else if cc == "green" then "g"
else if cc == "orange" then "o"
else "c"
}
@@ -620,6 +622,7 @@ color_name := {
else if input == "B" then "black"
else if input == "R" then "red"
else if input == "G" then "green"
else if input == "O" then "orange"
else ""
}
mana_name := {
@@ -628,6 +631,7 @@ mana_name := {
else if input == "black" then "B"
else if input == "red" then "R"
else if input == "green" then "G"
else if input == "orange" then "O"
else "C"
}
color_names_1 := { color_name(colors.0) }
@@ -701,6 +705,7 @@ land_to_color := {
else if watermark == "mana symbol black" then "black, land"
else if watermark == "mana symbol red" then "red, land"
else if watermark == "mana symbol green" then "green, land"
else if watermark == "mana symbol orange" then "orange, land"
else land_multicolor(colors:color_text_filter(input: rules))
}@(rules:card.rule_text)
@@ -708,7 +713,7 @@ land_to_color := {
text_to_color := {
#### Note: running filter_text is quite slow, do a quick 'contains' check first
if contains(match: card_name + " is") then (
text := filter_text(match: "is (colorless|all colors|((blue|white|green|red|black)((,|,? and) (blue|white|green|red|black))*))", in_context: regex_escape(card_name)+"(</[-a-z]+>)* <match>\\.")
text := filter_text(match: "is (colorless|all colors|((blue|white|green|red|black|orange)((,|,? and) (blue|white|green|red|black|orange))*))", in_context: regex_escape(card_name)+"(</[-a-z]+>)* <match>\\.")
if text != "" then (
if contains(text, match: "all colors") then (
colors := "WUBRG"
@@ -721,6 +726,7 @@ text_to_color := {
if contains(text, match: "black") then colors := colors + "B"
if contains(text, match: "red") then colors := colors + "R"
if contains(text, match: "green") then colors := colors + "G"
if contains(text, match: "orange") then colors := colors + "O"
if land == true then land_multicolor()
else mana_to_color(hybrid: "")
)
@@ -743,7 +749,7 @@ card_color := {
else text_color
};
#### Number of colors in a card_color
card_color_color_count := count_chosen@(choices: "white,blue,black,red,green,artifact")
card_color_color_count := count_chosen@(choices: "white,blue,black,red,green,orange,artifact")
#### Clean up color field
card_color_filter := {
colors := card_color_color_count()
@@ -777,6 +783,7 @@ card_color_to_letters := {
+(if contains(color_string, match:"black") then "B" else "")
+(if contains(color_string, match:"red") then "R" else "")
+(if contains(color_string, match:"green") then "G" else "")
+(if contains(color_string, match:"orange") then "O" else "")
}
card_color_field := { if input <= 1 then card.card_color else card["card_color_" + input] }
@@ -1059,6 +1066,7 @@ write_wubrg := {(if match(input, match:"white") then "W" else "")
+ (if match(input, match:"black") then "B" else "")
+ (if match(input, match:"red") then "R" else "")
+ (if match(input, match:"green") then "G" else "")
+ (if match(input, match:"orange") then "O" else "")
}
colored_mana := {to_number(
for each sym in cmc_split(to_text()) do (
@@ -1084,6 +1092,7 @@ primary_card_color := {
or chosen(choice:"black")
or chosen(choice:"red")
or chosen(choice:"green")
or chosen(choice:"orange")
)
land := chosen(choice:"land")
multi := chosen(choice:"multicolor")
@@ -1104,6 +1113,7 @@ primary_card_color := {
else if black then "black"
else if red then "red"
else if green then "green"
else if orange then "orange"
else input
}
sparker_card_color := {
@@ -1113,6 +1123,7 @@ sparker_card_color := {
or chosen(choice:"black")
or chosen(choice:"red")
or chosen(choice:"green")
or chosen(choice:"orange")
)
land := chosen(choice:"land")
multi := chosen(choice:"multicolor")
@@ -1133,6 +1144,7 @@ sparker_card_color := {
else if black then "black"
else if red then "red"
else if green then "green"
else if orange then "orange"
else "colorless"
}
@@ -1153,6 +1165,7 @@ color_to_mana := replace@(match: "white", replace: "[W]")
+ replace@(match: "black", replace: "[B]")
+ replace@(match: "red", replace: "[R]")
+ replace@(match: "green", replace: "[G]")
+ replace@(match: "orange", replace: "[O]")
#### convert number word to digit
digital_number := {
@@ -2638,6 +2651,7 @@ card_new_color := {
else if card.card_color == "black" then "b"
else if card.card_color == "red" then "r"
else if card.card_color == "green" then "g"
else if card.card_color == "orange" then "o"
else if contains(card.card_color, match:"artifact") then "a"
else if contains(card.card_color, match:"multi") or contains(card.card_color, match:"hybrid") then "m"
else "c"
@@ -5568,6 +5582,7 @@ alias_colors := {
b: rgb(39, 38, 36),
r: rgb(168, 88, 81),
g: rgb(6, 120, 69),
o: rgb(253, 196, 41),
a: rgb(239, 238, 236),
m: rgb(243, 210, 105),
c: rgb(173, 151, 137)
@@ -5894,12 +5909,14 @@ skeleton_runner := {
,"black"
,"red"
,"green"
,"orange"
]
,letter_list:["W"
,"U"
,"B"
,"R"
,"G"
,"O"
]
,mana_list:"nope"
)

View File

@@ -225,6 +225,7 @@ face_color_category_statistic :=
or chosen(choice:"black")
or chosen(choice:"red")
or chosen(choice:"green")
or chosen(choice:"orange")
)
land := chosen(choice:"land")
multi := chosen(choice:"multicolor")
@@ -246,6 +247,7 @@ face_color_category_statistic :=
else if black then all_en_space_statistic(lang_setting("black"))
else if red then all_en_space_statistic(lang_setting("red"))
else if green then all_en_space_statistic(lang_setting("green"))
else if orange then all_en_space_statistic(lang_setting("orange"))
else all_en_space_statistic(lang_setting("colorless"))
}
@@ -298,12 +300,14 @@ cc_colored_pips_statistic :=
symbol_aggregate_statistic(cc, symbol: "B") +
symbol_aggregate_statistic(cc, symbol: "R") +
symbol_aggregate_statistic(cc, symbol: "G") +
symbol_aggregate_statistic(cc, symbol: "O") +
symbol_aggregate_statistic(cc, symbol: "C") +
symbol_aggregate_statistic(cc2, symbol: "W") +
symbol_aggregate_statistic(cc2, symbol: "U") +
symbol_aggregate_statistic(cc2, symbol: "B") +
symbol_aggregate_statistic(cc2, symbol: "R") +
symbol_aggregate_statistic(cc2, symbol: "G") +
symbol_aggregate_statistic(cc2, symbol: "O") +
symbol_aggregate_statistic(cc2, symbol: "C")
substring(result, begin: 1)
}
@@ -329,6 +333,7 @@ ability_colored_pips_statistic :=
symbol_aggregate_statistic(costs[x], symbol: "B") +
symbol_aggregate_statistic(costs[x], symbol: "R") +
symbol_aggregate_statistic(costs[x], symbol: "G") +
symbol_aggregate_statistic(costs[x], symbol: "O") +
symbol_aggregate_statistic(costs[x], symbol: "C")
)
substring(result, begin: 1))
@@ -389,6 +394,7 @@ devotion_filters_statistic := [
B: filter_text@(match:"B")
R: filter_text@(match:"R")
G: filter_text@(match:"G")
G: filter_text@(match:"O")
C: filter_text@(match:"C")
]
color_pip_break_statistic := break_text@(match:"([A-Z0-9]/|[|])*[WUBRG]")