mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -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
|
image: mana_infinite.png
|
||||||
symbol:
|
symbol:
|
||||||
image: mana_circle.png
|
image: mana_circle.png
|
||||||
code: [0-9]+|.
|
code: [0-9]+(?!/2)|.
|
||||||
regex: yes
|
regex: yes
|
||||||
draw text: 0
|
draw text: 0
|
||||||
text font:
|
text font:
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ symbol:
|
|||||||
symbol:
|
symbol:
|
||||||
image: mana_circle_w.png
|
image: mana_circle_w.png
|
||||||
enabled: { colorless_color() == "w" }
|
enabled: { colorless_color() == "w" }
|
||||||
code: .|[0-9]+|.
|
code: [0-9]+(?!/2)|.
|
||||||
regex: yes
|
regex: yes
|
||||||
draw text: 0
|
draw text: 0
|
||||||
text font:
|
text font:
|
||||||
@@ -203,7 +203,7 @@ symbol:
|
|||||||
symbol:
|
symbol:
|
||||||
image: mana_circle_u.png
|
image: mana_circle_u.png
|
||||||
enabled: { colorless_color() == "u" }
|
enabled: { colorless_color() == "u" }
|
||||||
code: .|[0-9]+|.
|
code: [0-9]+(?!/2)|.
|
||||||
regex: yes
|
regex: yes
|
||||||
draw text: 0
|
draw text: 0
|
||||||
text font:
|
text font:
|
||||||
@@ -219,7 +219,7 @@ symbol:
|
|||||||
symbol:
|
symbol:
|
||||||
image: mana_circle_b.png
|
image: mana_circle_b.png
|
||||||
enabled: { colorless_color() == "b" }
|
enabled: { colorless_color() == "b" }
|
||||||
code: .|[0-9]+|.
|
code: [0-9]+(?!/2)|.
|
||||||
regex: yes
|
regex: yes
|
||||||
draw text: 0
|
draw text: 0
|
||||||
text font:
|
text font:
|
||||||
@@ -235,7 +235,7 @@ symbol:
|
|||||||
symbol:
|
symbol:
|
||||||
image: mana_circle_r.png
|
image: mana_circle_r.png
|
||||||
enabled: { colorless_color() == "r" }
|
enabled: { colorless_color() == "r" }
|
||||||
code: .|[0-9]+|.
|
code: [0-9]+(?!/2)|.
|
||||||
regex: yes
|
regex: yes
|
||||||
draw text: 0
|
draw text: 0
|
||||||
text font:
|
text font:
|
||||||
@@ -251,7 +251,7 @@ symbol:
|
|||||||
symbol:
|
symbol:
|
||||||
image: mana_circle_g.png
|
image: mana_circle_g.png
|
||||||
enabled: { colorless_color() == "g" }
|
enabled: { colorless_color() == "g" }
|
||||||
code: .|[0-9]+|.
|
code: [0-9]+(?!/2)|.
|
||||||
regex: yes
|
regex: yes
|
||||||
draw text: 0
|
draw text: 0
|
||||||
text font:
|
text font:
|
||||||
@@ -266,7 +266,7 @@ symbol:
|
|||||||
text margin bottom: 0.1
|
text margin bottom: 0.1
|
||||||
symbol:
|
symbol:
|
||||||
image: mana_circle.png
|
image: mana_circle.png
|
||||||
code: .|[0-9]+|.
|
code: [0-9]+(?!/2)|.
|
||||||
regex: yes
|
regex: yes
|
||||||
draw text: 0
|
draw text: 0
|
||||||
text font:
|
text font:
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ symbol:
|
|||||||
text margin right: .20
|
text margin right: .20
|
||||||
text margin top: -.15
|
text margin top: -.15
|
||||||
text margin bottom: -.06
|
text margin bottom: -.06
|
||||||
code: [0-9]+|.
|
code: [0-9]+(?!/2)|.
|
||||||
regex: yes
|
regex: yes
|
||||||
draw text: 0
|
draw text: 0
|
||||||
text font:
|
text font:
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ symbol:
|
|||||||
image: mana_infinite.png
|
image: mana_infinite.png
|
||||||
symbol:
|
symbol:
|
||||||
image: mana_circle.png
|
image: mana_circle.png
|
||||||
code: [0-9]+|.
|
code: [0-9]+(?!/2)|.
|
||||||
regex: yes
|
regex: yes
|
||||||
draw text: 0
|
draw text: 0
|
||||||
text margin left: .26
|
text margin left: .26
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ symbol:
|
|||||||
image: mana_z.png
|
image: mana_z.png
|
||||||
symbol:
|
symbol:
|
||||||
image: mana_circle.png
|
image: mana_circle.png
|
||||||
code: [0-9]+|.
|
code: [0-9]+(?!/2)|.
|
||||||
regex: yes
|
regex: yes
|
||||||
draw text: 0
|
draw text: 0
|
||||||
text margin left: .26
|
text margin left: .26
|
||||||
|
|||||||
@@ -489,17 +489,28 @@ init script:
|
|||||||
############################################################## Statistics utilities
|
############################################################## Statistics utilities
|
||||||
|
|
||||||
# Converted mana cost
|
# Converted mana cost
|
||||||
cmc := to_text + {
|
is_half_mana := match_rule(match: "1/2|[|][WUBRGS]")
|
||||||
1 * number_of_items(in: sort_text(order:"SWUBRG")) # colored mana
|
is_zero_slash := match_rule(match: "^0/")
|
||||||
- 1 * number_of_items(in: sort_text(order:"/")) # guild mana, W/U -> 2 - 1
|
is_colored_mana := match_rule(match: "[WUBRG]")
|
||||||
+ 1 * filter_text(match: "^[0123456789]+(?!/)") # colorless mana, but not 1/2
|
only_numbers := filter_rule(match: "^[0123456789]+")
|
||||||
+ 1 * (length(sort_text(order:"compound(1/2)")) / 3) # compensate for 1/2. Should actually be 1.5 *
|
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 + {
|
colored_mana := to_text + { 0 +
|
||||||
number_of_items(in: sort_text(order: "WUBRG")) # colored mana
|
for each sym in cmc_split() do (
|
||||||
- number_of_items(in: sort_text(order:"/")) # guild mana, W/U -> 2 - 1
|
numbers := only_numbers(sym)
|
||||||
+ 1 * (length(sort_text(order:"compound(1/2)")) / 3) # compensate for 1/2.
|
if is_colored_mana(sym) then
|
||||||
|
if is_half_mana(sym) then 0.5 else 1
|
||||||
|
else 0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
primary_card_color := {
|
primary_card_color := {
|
||||||
artifact := chosen(choice:"artifact")
|
artifact := chosen(choice:"artifact")
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ IMPLEMENT_REFLECTION(SymbolInFont) {
|
|||||||
REFLECT(regex);
|
REFLECT(regex);
|
||||||
REFLECT_IF_READING
|
REFLECT_IF_READING
|
||||||
if (regex)
|
if (regex)
|
||||||
code_regex.Compile(code);
|
code_regex.Compile(code, wxRE_ADVANCED);
|
||||||
REFLECT(draw_text);
|
REFLECT(draw_text);
|
||||||
REFLECT(text_font);
|
REFLECT(text_font);
|
||||||
REFLECT(text_alignment);
|
REFLECT(text_alignment);
|
||||||
|
|||||||
Reference in New Issue
Block a user