diff --git a/data/magic-mana-beveled.mse-symbol-font/symbol-font b/data/magic-mana-beveled.mse-symbol-font/symbol-font index 133bd9b6..e2cd825b 100644 --- a/data/magic-mana-beveled.mse-symbol-font/symbol-font +++ b/data/magic-mana-beveled.mse-symbol-font/symbol-font @@ -273,7 +273,7 @@ symbol: image: mana_infinite.png symbol: image: mana_circle.png - code: [0-9]+|. + code: [0-9]+(?!/2)|. regex: yes draw text: 0 text font: diff --git a/data/magic-mana-future.mse-symbol-font/symbol-font b/data/magic-mana-future.mse-symbol-font/symbol-font index ee98e874..5517ab7d 100644 --- a/data/magic-mana-future.mse-symbol-font/symbol-font +++ b/data/magic-mana-future.mse-symbol-font/symbol-font @@ -187,7 +187,7 @@ symbol: symbol: image: mana_circle_w.png enabled: { colorless_color() == "w" } - code: .|[0-9]+|. + code: [0-9]+(?!/2)|. regex: yes draw text: 0 text font: @@ -203,7 +203,7 @@ symbol: symbol: image: mana_circle_u.png enabled: { colorless_color() == "u" } - code: .|[0-9]+|. + code: [0-9]+(?!/2)|. regex: yes draw text: 0 text font: @@ -219,7 +219,7 @@ symbol: symbol: image: mana_circle_b.png enabled: { colorless_color() == "b" } - code: .|[0-9]+|. + code: [0-9]+(?!/2)|. regex: yes draw text: 0 text font: @@ -235,7 +235,7 @@ symbol: symbol: image: mana_circle_r.png enabled: { colorless_color() == "r" } - code: .|[0-9]+|. + code: [0-9]+(?!/2)|. regex: yes draw text: 0 text font: @@ -251,7 +251,7 @@ symbol: symbol: image: mana_circle_g.png enabled: { colorless_color() == "g" } - code: .|[0-9]+|. + code: [0-9]+(?!/2)|. regex: yes draw text: 0 text font: @@ -266,7 +266,7 @@ symbol: text margin bottom: 0.1 symbol: image: mana_circle.png - code: .|[0-9]+|. + code: [0-9]+(?!/2)|. regex: yes draw text: 0 text font: diff --git a/data/magic-mana-large.mse-symbol-font/symbol-font b/data/magic-mana-large.mse-symbol-font/symbol-font index 080aab84..9fe78936 100644 --- a/data/magic-mana-large.mse-symbol-font/symbol-font +++ b/data/magic-mana-large.mse-symbol-font/symbol-font @@ -290,7 +290,7 @@ symbol: text margin right: .20 text margin top: -.15 text margin bottom: -.06 - code: [0-9]+|. + code: [0-9]+(?!/2)|. regex: yes draw text: 0 text font: diff --git a/data/magic-mana-small-grey.mse-symbol-font/symbol-font b/data/magic-mana-small-grey.mse-symbol-font/symbol-font index b745ab35..c5c232f7 100644 --- a/data/magic-mana-small-grey.mse-symbol-font/symbol-font +++ b/data/magic-mana-small-grey.mse-symbol-font/symbol-font @@ -293,7 +293,7 @@ symbol: image: mana_infinite.png symbol: image: mana_circle.png - code: [0-9]+|. + code: [0-9]+(?!/2)|. regex: yes draw text: 0 text margin left: .26 diff --git a/data/magic-mana-small.mse-symbol-font/symbol-font b/data/magic-mana-small.mse-symbol-font/symbol-font index 56e734f8..7452bf17 100644 --- a/data/magic-mana-small.mse-symbol-font/symbol-font +++ b/data/magic-mana-small.mse-symbol-font/symbol-font @@ -293,7 +293,7 @@ symbol: image: mana_z.png symbol: image: mana_circle.png - code: [0-9]+|. + code: [0-9]+(?!/2)|. regex: yes draw text: 0 text margin left: .26 diff --git a/data/magic.mse-game/game b/data/magic.mse-game/game index 0e5c3322..171c1dd1 100644 --- a/data/magic.mse-game/game +++ b/data/magic.mse-game/game @@ -489,17 +489,28 @@ init script: ############################################################## Statistics utilities # Converted mana cost - cmc := to_text + { - 1 * number_of_items(in: sort_text(order:"SWUBRG")) # colored mana - - 1 * number_of_items(in: sort_text(order:"/")) # guild mana, W/U -> 2 - 1 - + 1 * filter_text(match: "^[0123456789]+(?!/)") # colorless mana, but not 1/2 - + 1 * (length(sort_text(order:"compound(1/2)")) / 3) # compensate for 1/2. Should actually be 1.5 * + is_half_mana := match_rule(match: "1/2|[|][WUBRGS]") + is_zero_slash := match_rule(match: "^0/") + is_colored_mana := match_rule(match: "[WUBRG]") + only_numbers := filter_rule(match: "^[0123456789]+") + cmc_split := break_rule(match: "(?ix) 1/2 | [|][WUBRG] | ([0-9]+(?!/2)|[WUBRGS])(/[WUBRGS])\{0,4} ") + cmc := to_text + { 0 + + for each sym in cmc_split() do ( + numbers := only_numbers(sym) + if is_half_mana(sym) then 0.5 + else if is_zero_slash(sym) then 1 # 0/C + else if numbers != "" then 1 * numbers + else 1 # all other symbols are 1 + ) } - colored_mana := to_text + { - number_of_items(in: sort_text(order: "WUBRG")) # colored mana - - number_of_items(in: sort_text(order:"/")) # guild mana, W/U -> 2 - 1 - + 1 * (length(sort_text(order:"compound(1/2)")) / 3) # compensate for 1/2. + colored_mana := to_text + { 0 + + for each sym in cmc_split() do ( + numbers := only_numbers(sym) + if is_colored_mana(sym) then + if is_half_mana(sym) then 0.5 else 1 + else 0 + ) } primary_card_color := { artifact := chosen(choice:"artifact") diff --git a/src/data/symbol_font.cpp b/src/data/symbol_font.cpp index 86252c46..f545ee9f 100644 --- a/src/data/symbol_font.cpp +++ b/src/data/symbol_font.cpp @@ -176,7 +176,7 @@ IMPLEMENT_REFLECTION(SymbolInFont) { REFLECT(regex); REFLECT_IF_READING if (regex) - code_regex.Compile(code); + code_regex.Compile(code, wxRE_ADVANCED); REFLECT(draw_text); REFLECT(text_font); REFLECT(text_alignment);