mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Split 'sort' script function into 'sort_text' and 'sort_list', use "cycle(WUBRG)" instead of "(WUBRG)".
Fixed bug in spoiler export template: mana symbols were always rendered as images. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@588 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -442,12 +442,12 @@ color_background := {
|
|||||||
if land and colored_lands then template := land_template # use land template instead?
|
if land and colored_lands then template := land_template # use land template instead?
|
||||||
|
|
||||||
# The selected colors
|
# The selected colors
|
||||||
colors := sort( order: "(wubrg)"
|
colors := sort_text( order: "(wubrg)"
|
||||||
, (if chosen(choice:"white") then "w")
|
, (if chosen(choice:"white") then "w")
|
||||||
+ (if chosen(choice:"blue") then "u")
|
+ (if chosen(choice:"blue") then "u")
|
||||||
+ (if chosen(choice:"black") then "b")
|
+ (if chosen(choice:"black") then "b")
|
||||||
+ (if chosen(choice:"red") then "r")
|
+ (if chosen(choice:"red") then "r")
|
||||||
+ (if chosen(choice:"green") then "g"))
|
+ (if chosen(choice:"green") then "g"))
|
||||||
if multi and (hybrid or colors == "") then (
|
if multi and (hybrid or colors == "") then (
|
||||||
colors := colors + "m"
|
colors := colors + "m"
|
||||||
multi := false
|
multi := false
|
||||||
@@ -531,18 +531,18 @@ font_color_positions := [
|
|||||||
font_white := {
|
font_white := {
|
||||||
hybrid := chosen(choice:"hybrid")
|
hybrid := chosen(choice:"hybrid")
|
||||||
artifact := chosen(choice:"artifact")
|
artifact := chosen(choice:"artifact")
|
||||||
colors := sort( order: "(wubrg)"
|
colors := sort_text( order: "(wubrg)"
|
||||||
, (if chosen(choice:"white") then "w")
|
, (if chosen(choice:"white") then "w")
|
||||||
+ (if chosen(choice:"blue") then "u")
|
+ (if chosen(choice:"blue") then "u")
|
||||||
+ (if chosen(choice:"black") then "b")
|
+ (if chosen(choice:"black") then "b")
|
||||||
+ (if chosen(choice:"red") then "r")
|
+ (if chosen(choice:"red") then "r")
|
||||||
+ (if chosen(choice:"green") then "g"))
|
+ (if chosen(choice:"green") then "g"))
|
||||||
+ (if artifact then "a")
|
+ (if artifact then "a")
|
||||||
font_colors_white(
|
font_colors_white(
|
||||||
if chosen(choice:"land") then "l"
|
if chosen(choice:"land") then "l"
|
||||||
else if input == "artifact, multicolor" then "a"
|
else if input == "artifact, multicolor" then "a"
|
||||||
else if chosen(choice:"multicolor") then "m"
|
else if chosen(choice:"multicolor") then "m"
|
||||||
else if artifact and not hybrid then "a"
|
else if artifact and not hybrid then "a"
|
||||||
else if colors == "" then "c"
|
else if colors == "" then "c"
|
||||||
else colors[
|
else colors[
|
||||||
font_color_positions
|
font_color_positions
|
||||||
|
|||||||
@@ -84,8 +84,10 @@ option style:
|
|||||||
sans-serif: /magic-spoiler.mse-export-template/sans-serif.png
|
sans-serif: /magic-spoiler.mse-export-template/sans-serif.png
|
||||||
|
|
||||||
script:
|
script:
|
||||||
symbol_font := "magic-mana-small"
|
if options.mana_symbols then (
|
||||||
symbol_font_size := 12
|
symbol_font := "magic-mana-small"
|
||||||
|
symbol_font_size := 12
|
||||||
|
)
|
||||||
write_card := {
|
write_card := {
|
||||||
if contains(options.images, match:"full card image") then
|
if contains(options.images, match:"full card image") then
|
||||||
card_image_file := write_image_file(card, file:"card{position(of:card,in:set)}.jpg")
|
card_image_file := write_image_file(card, file:"card{position(of:card,in:set)}.jpg")
|
||||||
|
|||||||
+21
-43
@@ -14,42 +14,21 @@ init script:
|
|||||||
|
|
||||||
# Used in FPM and Future Sight
|
# Used in FPM and Future Sight
|
||||||
brush_sort := sort_rule(order: "OP")
|
brush_sort := sort_rule(order: "OP")
|
||||||
# correctly sort a mana symbol (no guild mana)
|
# correctly sort mana symbols
|
||||||
mana_sort := sort_rule(order: "XYZ[0123456789]S(WUBRG)")
|
mana_sort := sort_rule(order: "ordered(XYZ)"
|
||||||
# correctly sort guild mana
|
+ "mixed(0123456789)"
|
||||||
mana_sort_guild := replace_rule( # swap these:
|
+ "ordered(S)"
|
||||||
match: "U/W|B/U|R/B|G/R|W/G|B/W|R/U|G/B|W/R|U/G",
|
+ "reverse_order("
|
||||||
in_context: "(^|[^/])<match>($|[^/])",
|
+ " pattern(./././. cycle(WUBRG))"
|
||||||
replace: {input[2] + "/" + input[0]}) +
|
+ " pattern(././. cycle(WUBRG))"
|
||||||
replace_rule(
|
+ " pattern(./. cycle(WUBRG))"
|
||||||
match: "W/B/U|W/R/B|U/R/B|U/G/R|B/G/R|B/W/G|R/W/G|R/U/W|G/U/W|G/B/U",
|
+ " pattern(|. WUBRG)|"
|
||||||
in_context: "(^|[^/])<match>($|[^/])",
|
+ " pattern(./ WUBRG)"
|
||||||
replace: {input[0] + "/" + input[4] + "/" + input[2]}) +
|
+ " pattern(/. WUBRG)"
|
||||||
replace_rule(
|
+ " cycle(WUBRG)"
|
||||||
match: "B/U/W|R/B/W|R/B/U|G/R/U|G/R/B|W/G/B|W/G/R|U/W/R|U/W/G|B/U/G",
|
+ ")")
|
||||||
in_context: "(^|[^/])<match>($|[^/])",
|
|
||||||
replace: {input[4] + "/" + input[2] + "/" + input[0]}) +
|
|
||||||
replace_rule(
|
|
||||||
match: "U/W/B|B/W/R|B/U/R|R/U/G|R/B/G|G/B/W|G/R/W|W/R/U|W/G/U|U/G/B",
|
|
||||||
in_context: "(^|[^/])<match>($|[^/])",
|
|
||||||
replace: {input[2] + "/" + input[0] + "/" + input[4]}) +
|
|
||||||
replace_rule(
|
|
||||||
match: "U/B/W|B/R/U|R/G/B|G/W/R|W/U/G|B/R/W|R/G/U|G/W/B|W/U/R|U/B/G",
|
|
||||||
in_context: "(^|[^/])<match>($|[^/])",
|
|
||||||
replace: {input[4] + "/" + input[0] + "/" + input[2]}) +
|
|
||||||
replace_rule(
|
|
||||||
match: "B/W/U|R/U/B|G/B/R|W/R/G|U/G/W|R/W/B|G/U/R|W/B/G|U/R/W|B/G/U",
|
|
||||||
in_context: "(^|[^/])<match>($|[^/])",
|
|
||||||
replace: {input[2] + "/" + input[4] + "/" + input[0]}) +
|
|
||||||
replace_rule(
|
|
||||||
match: "T", replace: ""
|
|
||||||
)
|
|
||||||
mana_has_guild := sort_rule(order: "</|>") # Is there guild or half mana in the input?
|
mana_has_guild := sort_rule(order: "</|>") # Is there guild or half mana in the input?
|
||||||
# A mana cost can contain both normal and guild mana
|
mana_filter := to_upper + mana_sort
|
||||||
mana_filter := to_upper + {
|
|
||||||
if mana_has_guild()!="" then mana_sort_guild()
|
|
||||||
else mana_sort()
|
|
||||||
}
|
|
||||||
# Like mana filter, only also allow tap symbols:
|
# Like mana filter, only also allow tap symbols:
|
||||||
tap_filter := sort_rule(order: "<T>")
|
tap_filter := sort_rule(order: "<T>")
|
||||||
mana_filter_t := replace_rule( # Remove [] used for forcing mana symbols
|
mana_filter_t := replace_rule( # Remove [] used for forcing mana symbols
|
||||||
@@ -217,7 +196,7 @@ init script:
|
|||||||
else "I" # Non of the above = Colorless/artifact
|
else "I" # Non of the above = Colorless/artifact
|
||||||
) else (
|
) else (
|
||||||
# use the casting cost
|
# use the casting cost
|
||||||
colors := sort(casting_cost, order: "<WUBRG>")
|
colors := sort_text(casting_cost, order: "<WUBRG>")
|
||||||
if colors == "" then "I" # Colorless
|
if colors == "" then "I" # Colorless
|
||||||
else if contains(casting_cost, match:"/") then "G" # Hybrid cost
|
else if contains(casting_cost, match:"/") then "G" # Hybrid cost
|
||||||
else if colors == "W" then "A" # White
|
else if colors == "W" then "A" # White
|
||||||
@@ -470,13 +449,13 @@ init script:
|
|||||||
|
|
||||||
# Converted mana cost
|
# Converted mana cost
|
||||||
cmc := to_text + {
|
cmc := to_text + {
|
||||||
1 * number_of_items(in: sort(order:"SWUBRG")) # colored mana
|
1 * number_of_items(in: sort_text(order:"SWUBRG")) # colored mana
|
||||||
- 1 * number_of_items(in: sort(order:"/")) # guild mana, W/U -> 2 - 1
|
- 1 * number_of_items(in: sort_text(order:"/")) # guild mana, W/U -> 2 - 1
|
||||||
+ 1 * sort(order: "[0123456789]") # colorless mana
|
+ 1 * sort_text(order: "[0123456789]") # colorless mana
|
||||||
}
|
}
|
||||||
colored_mana := to_text + {
|
colored_mana := to_text + {
|
||||||
number_of_items(in: sort(order: "WUBRG")) # colored mana
|
number_of_items(in: sort_text(order: "WUBRG")) # colored mana
|
||||||
- number_of_items(in: sort(order:"/")) # guild mana, W/U -> 2 - 1
|
- number_of_items(in: sort_text(order:"/")) # guild mana, W/U -> 2 - 1
|
||||||
}
|
}
|
||||||
primary_card_color := {
|
primary_card_color := {
|
||||||
artifact := chosen(choice:"artifact")
|
artifact := chosen(choice:"artifact")
|
||||||
@@ -592,17 +571,16 @@ default set style:
|
|||||||
font:
|
font:
|
||||||
size: 16
|
size: 16
|
||||||
symbol:
|
symbol:
|
||||||
|
max aspect ratio: 2.5
|
||||||
variation:
|
variation:
|
||||||
name: common
|
name: common
|
||||||
border radius: 0.10
|
border radius: 0.10
|
||||||
#max aspect ratio: 2.5
|
|
||||||
fill type: solid
|
fill type: solid
|
||||||
fill color: rgb(0,0,0)
|
fill color: rgb(0,0,0)
|
||||||
border color: rgb(255,255,255)
|
border color: rgb(255,255,255)
|
||||||
variation:
|
variation:
|
||||||
name: uncommon
|
name: uncommon
|
||||||
border radius: 0.05
|
border radius: 0.05
|
||||||
#max aspect ratio: 2.5
|
|
||||||
fill type: linear gradient
|
fill type: linear gradient
|
||||||
fill color 1: rgb(224,224,224)
|
fill color 1: rgb(224,224,224)
|
||||||
fill color 2: rgb(84, 84, 84)
|
fill color 2: rgb(84, 84, 84)
|
||||||
|
|||||||
Reference in New Issue
Block a user