mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Converted mana cost script now works with 2/C costs.
A mana cost of "31/2" is now broken up as "3","1/2". git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@920 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user