From a1c5fd57dbfa9b906d6ab5f9a07cd54142e5d2fc Mon Sep 17 00:00:00 2001 From: cajun <12363371+CajunAvenger@users.noreply.github.com> Date: Fri, 26 Sep 2025 02:30:15 -0500 Subject: [PATCH] Fix #154 --- data/magic.mse-game/script | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/data/magic.mse-game/script b/data/magic.mse-game/script index 970deff90..2c1a5edba 100644 --- a/data/magic.mse-game/script +++ b/data/magic.mse-game/script @@ -431,13 +431,13 @@ crop_multi_image := { ############################################################## Sorting mana symbols #### correctly sort a mana symbol (no guild mana) -mana_sort := sort_text@(order: "\\?XYZI[0123456789]VLHSFCAIE(WUBRG)") +mana_sort := sort_text@(order: "\\?XYZI[0123456789]VHSFCAI(EKPLO)(WUBRG)") #### correctly sort wedge mana -mana_sort_wedge := sort_text@(order: "\\?XYZI[0123456789]VLHSFCAIE(WBGUR)") +mana_sort_wedge := sort_text@(order: "\\?XYZI[0123456789]VHSFCAI(EPOKL)(WBGUR)") #### sort nothing -mana_unsort := sort_text@(order:"[/\\?XYZI0123456789VLHSCAIEOPKMWUBRG]") +mana_unsort := sort_text@(order:"[/\\?XYZI0123456789VHSCAIEKPLOMWUBRG]") #### correctly sort guild mana -mana_sort_guild := sort_text@(order: "[\\?XYZI01234567890VLHSFCAIEWUBRG/|]") + +mana_sort_guild := sort_text@(order: "[\\?XYZI01234567890VHSFCAIEKPLOWUBRG/|]") + replace@( #### No lookbehind :( #match: "(?{alternative_cost(input.param, trim:combined_cost, s:action)}" #### "add" mana else "{alternative_cost(input.param, trim:combined_cost, s:action)}{non}" #### else cost "non" ) else if contains(input.param, match: ",") then ( #### three+ parts - if match(match: "^[VLHSCAIETKQ\\?XYZIWUBRG0-9/|]+,", input.param) then #### starts with mana + if match(match: "^[VHSCAIETKPLOQ\\?XYZIWUBRG0-9/|]+,", input.param) then #### starts with mana "{add}{alternative_cost(input.param, trim:long_cost, s:action)}" #### "add" mana with long formatting else "{alternative_cost(input.param, trim:long_nomana_cost, s:action)}{non}" #### else cost "non" with long formatting ) else @@ -1153,7 +1153,7 @@ for_mana_costs := { }@(non:" in addition to any other costs", action:false, add:"") #### return bool; is the input is a simple mana cost? is_mana_cost := { - match(match: "^[VLHSCAIETKQ\\?XYZIWUBRG0-9/|]+$", input.param) + match(match: "^[VHSCAIETKPLOQ\\?XYZIWUBRG0-9/|]+$", input.param) } #### Convert extra costs long_cost := replace@(match:", [A-Z]", replace: { to_lower() } ) @@ -1162,7 +1162,7 @@ long_nomana_cost := replace@(match:"[A-Z]", replace: { to_lower() }) lower_first := replace@(match:"^[A-Z]", replace: { to_lower() }) combined_cost := replace@(match:", [A-Z]", replace: { to_lower() })+ replace@(match:",", replace:" and")+ - replace@(match:"^[VLHSCETKQ\\?XYZIWUBRG0-9/|]+", in_context: "(^|[[:space:]])(?![a-z])", replace: "&")+ + replace@(match:"^[VHSCETKPLOQ\\?XYZIWUBRG0-9/|]+", in_context: "(^|[[:space:]])(?![a-z])", replace: "&")+ replace@(match:"^[A-Z]", replace: { to_lower() }) alternative_cost := { input := trim(input) @@ -1433,8 +1433,8 @@ mana_context := | [ ]can[ ]be[ ]paid | (pays?|additional|costs?|the|adds?|pay(ed)?[ ](with|using)) #### pay X. creatures cost 1 less. pay an additional G. ([ ]either)? #### pay either X or Y - ([ ](]*>)?[-+=]?[VLHSCETKQ\\?XYZIEWUBRG0-9/|]+(]*>)?,)* #### pay X, Y or Z - ([ ](]*>)?[-+=]?[VLHSCETKQ\\?XYZIEWUBRG0-9/|]+(]*>)?[ ](and|or|and/or))* #### pay X or Y + ([ ](]*>)?[-+=]?[VHSCETKPLOQ\\?XYZIEWUBRG0-9/|]+(]*>)?,)* #### pay X, Y or Z + ([ ](]*>)?[-+=]?[VHSCETKPLOQ\\?XYZIEWUBRG0-9/|]+(]*>)?[ ](and|or|and/or))* #### pay X or Y [ ] ( [,.)\"”]|$ #### (end of word) @@ -1801,7 +1801,7 @@ text_filter := } + #### step 4 : explict non mana symbols replace@( - match: "\\][-+=]?[VLHSCETQ\\?XYZIWUBRG0-9/|]+\\[", + match: "\\][-+=]?[VHSCEKPLOTQ\\?XYZIWUBRG0-9/|]+\\[", replace: {"" + mana_filter_t() + ""} ) + #### step 5 : add mana & tap symbols @@ -1816,19 +1816,19 @@ text_filter := replace: {"" + _1 + "" + _3} ) + replace@( - match: "\\b[VLHSCETQ\\?XYZIWUBRG0-9/|]+\\b", + match: "\\b[VHSCEKPLOTQ\\?XYZIWUBRG0-9/|]+\\b", in_context: mana_context, replace: {"" + mana_filter_t() + ""} ) + #### step 5b : remove false positive mana & tap symbols replace@( - match: "([VLHSCETQ\\?XYZIWUBRG0-9/|]+)", + match: "([VHSCEKPLOTQ\\?XYZIWUBRG0-9/|]+)", in_context: mana_un_context, replace: "\\1" ) + #### step 5c : add explicit mana symbols replace@( - match: "\\[[-+=]?[VLHSCETQE\\?XYZIWUBRG0-9/|]+\\]", + match: "\\[[-+=]?[VHSCEKPLOTQ\\?XYZIWUBRG0-9/|]+\\]", replace: {"" + mana_filter_t() + ""} ) + #### step 6 : curly quotes