Commit f3c8f982 authored by twanvl's avatar twanvl

New card color system, based on a multiple choice field

parent 4e777bf3
mse version: 0.3.3 mse version: 0.3.4
short name: Magic short name: Magic
full name: Magic the Gathering full name: Magic the Gathering
icon: card-back.png icon: card-back.png
version: 2007-05-05 version: 2007-07-01
position hint: 1 position hint: 1
############################################################## Functions & filters ############################################################## Functions & filters
# General functions # General functions
init script: init script:
############################################################## Sorting mana symbols
# 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 a mana symbol (no guild mana)
...@@ -54,6 +57,8 @@ init script: ...@@ -54,6 +57,8 @@ init script:
replace: "" replace: ""
) + { tap_filter() + mana_filter() } ) + { tap_filter() + mana_filter() }
############################################################## Determine card color
# Names of colors # Names of colors
color_name := { color_name := {
if input = "W" then "white" if input = "W" then "white"
...@@ -63,8 +68,13 @@ init script: ...@@ -63,8 +68,13 @@ init script:
else if input = "G" then "green" else if input = "G" then "green"
else "" else ""
} }
color_names_1 := { color_name(colors.0) }
color_names_2 := { color_name(colors.0) + ", " + color_name(colors.1) }
color_names_3 := { color_name(colors.0) + ", " + color_name(colors.1) + ", " + color_name(colors.2) }
color_names_4 := { color_name(colors.0) + ", " + color_name(colors.1) + ", " + color_name(colors.2) + ", " + color_name(colors.3) }
color_names_5 := { color_name(colors.0) + ", " + color_name(colors.1) + ", " + color_name(colors.2) + ", " + color_name(colors.3) + ", " + color_name(colors.4) }
# color based on mana cost, input = a mana cost # color based on mana cost, input = a mana cost
color_filter := sort_rule(order: "<WUBRG>") + sort_rule(order: "(WUBRG)") color_filter := sort_rule(order: "<WUBRG>")
color_filterH := sort_rule(order: "</>") color_filterH := sort_rule(order: "</>")
mana_to_color := { mana_to_color := {
colors := color_filter() colors := color_filter()
...@@ -73,19 +83,19 @@ init script: ...@@ -73,19 +83,19 @@ init script:
if hybrid == "" then if hybrid == "" then
# not a hybrid # not a hybrid
if count == 0 then "colorless" if count == 0 then "colorless"
else if count == 1 then color_name(colors[0]) else if count == 1 then color_names_1()
else if set.set_info.use_gradient_multicolor == "no" then "multicolor" # stop here else if set.set_info.use_gradient_multicolor == "no" then "multicolor" # stop here
else if count == 2 then "multicolor 2 color " + color_name(colors[0]) + " / " + color_name(colors[1]) else if count == 2 then color_names_2() + ", multicolor"
else if set.set_info.use_gradient_multicolor != "yes" then "multicolor" # stop here else if set.set_info.use_gradient_multicolor != "yes" then "multicolor" # stop here
else if count == 3 then "multicolor 3 color " + color_name(colors[0]) + " / " + color_name(colors[1]) + " / " + color_name(colors[2]) else if count == 3 then color_names_3() + ", multicolor"
else if count == 4 then "multicolor 4 color " + color_name(colors[0]) + " / " + color_name(colors[1]) + " / " + color_name(colors[2]) + " / " + color_name(colors[3]) else if count == 4 then color_names_4() + ", multicolor"
else if count == 5 then "multicolor 5 color " + color_name(colors[0]) + " / " + color_name(colors[1]) + " / " + color_name(colors[2]) + " / " + color_name(colors[3]) + " / " + color_name(colors[4]) else if count == 5 then color_names_5() + ", multicolor"
else "multicolor" else "multicolor"
else else
# hybrid # hybrid
if count == 2 then "hybrid 2 color " + color_name(colors[0]) + " / " + color_name(colors[1]) if count == 2 then color_names_2() + ", hybrid"
else if count == 3 then "hybrid 3 color " + color_name(colors[0]) + " / " + color_name(colors[1]) + " / " + color_name(colors[2]) else if count == 3 then color_names_3() + ", hybrid"
else "multicolor" else "multicolor"
} }
# color based on land text box, input = textbox contents # color based on land text box, input = textbox contents
...@@ -100,40 +110,26 @@ init script: ...@@ -100,40 +110,26 @@ init script:
filter_rule(match: "<sym[^>]*>([^<]+)") + color_filter; filter_rule(match: "<sym[^>]*>([^<]+)") + color_filter;
land_to_color := { land_to_color := {
# Based on watermark # Based on watermark
if card.watermark = "mana symbol white" then "land 1 color white" if card.watermark = "mana symbol white" then "white, land"
else if card.watermark = "mana symbol blue" then "land 1 color blue" else if card.watermark = "mana symbol blue" then "blue, land"
else if card.watermark = "mana symbol black" then "land 1 color black" else if card.watermark = "mana symbol black" then "black, land"
else if card.watermark = "mana symbol red" then "land 1 color red" else if card.watermark = "mana symbol red" then "red, land"
else if card.watermark = "mana symbol green" then "land 1 color green" else if card.watermark = "mana symbol green" then "green, land"
else ( else (
# Based on colors in text box # Based on colors in text box
colors := color_text_filter(input: card.rule_text); colors := color_text_filter(input: card.rule_text);
if colors = "" then "land" count := number_of_items(in: colors)
else if colors = "W" then "land 1 color white" if count == 0 then "land"
else if colors = "U" then "land 1 color blue" else if count == 1 then color_names_1() + ", land"
else if colors = "B" then "land 1 color black" else if count == 2 then color_names_2() + ", land"
else if colors = "R" then "land 1 color red"
else if colors = "G" then "land 1 color green"
else if colors = "WU" then "land 2 color white / blue"
else if colors = "UB" then "land 2 color blue / black"
else if colors = "BR" then "land 2 color black / red"
else if colors = "RG" then "land 2 color red / green"
else if colors = "GW" then "land 2 color green / white"
else if colors = "WB" then "land 2 color white / black"
else if colors = "UR" then "land 2 color blue / red"
else if colors = "BG" then "land 2 color black / green"
else if colors = "RW" then "land 2 color red / white"
else if colors = "GU" then "land 2 color green / blue"
else "land 1 color multicolor"
) )
}; };
# Index for sorting, white cards are first, so white->A, blue->B, .. , # Index for sorting, white cards are first, so white->A, blue->B, .. ,
# multi->F, hybrid->G, arti->H, land->J, basic land->I # multi->F, hybrid->G, arti->H, land->J, basic land->I
is_multicolor := match_rule(match: "^multicolor") is_multicolor := { chosen(choice: "multicolor") }
is_hybrid := match_rule(match: "^hybrid") is_hybrid := { chosen(choice: "hybrid") }
is_colorless := match_rule(match: "^colorless") is_colorless := { not chosen(choice: "land") }
is_artifact := match_rule(match: "^artifact")
sort_index := { sort_index := {
if card.casting_cost_2 !="" and card.card_color != card.card_color_2 then "H" if card.casting_cost_2 !="" and card.card_color != card.card_color_2 then "H"
else if card.card_color=="white" then "A" else if card.card_color=="white" then "A"
...@@ -143,8 +139,8 @@ init script: ...@@ -143,8 +139,8 @@ init script:
else if card.card_color=="green" then "E" else if card.card_color=="green" then "E"
else if is_multicolor(card.card_color) then "F" else if is_multicolor(card.card_color) then "F"
else if is_hybrid (card.card_color) then "G" else if is_hybrid (card.card_color) then "G"
else if is_colorless (card.card_color) or is_artifact (card.card_color) then "I" else if is_colorless (card.card_color) then "I"
else if card.rarity!="basic land" then "J" else if card.rarity!="basic land" then "J"
else "K" else "K"
}; };
...@@ -159,6 +155,31 @@ init script: ...@@ -159,6 +155,31 @@ init script:
else mana_color else mana_color
}; };
# Number of colors in a card_color
card_color_color_count := {
chosen(choice:"white") + chosen(choice:"blue") + chosen(choice:"black") + chosen(choice:"red") + chosen(choice:"green") + chosen(choice:"artifact")
}
# Clean up color field
card_color_filter := {
colors := card_color_color_count()
if colors > 2 then
input := remove_choice(choice: "overlay")
if colors > 1 then (
input := require_choice(choice1: "multicolor", choice2: "hybrid", choice3: "land", choice4: "artifact")
input := exclusive_choice(choice1: "multicolor", choice2: "hybrid")
input := require_exclusive_choice(choice1: "radial", choice2: "horizontal", choice3: "vertical", choice4: "overlay")
) else
input := remove_choice(choice1: "radial", choice2: "horizontal", choice3: "vertical", choice4: "overlay", choice5: "hybrid", choice6: "reversed")
if chosen(choice:"overlay") then
input := remove_choice(choice: "reversed")
input
}
# needed by all style files anyway
include file: /magic-blends.mse-include/new-blends
############################################################## Utilities for keywords
# replaces — correctly # replaces — correctly
add := "" # default is nothing add := "" # default is nothing
for_mana_costs := format_cost := { for_mana_costs := format_cost := {
...@@ -179,6 +200,8 @@ init script: ...@@ -179,6 +200,8 @@ init script:
has_cc := { card.casting_cost != "" } has_cc := { card.casting_cost != "" }
has_pt := { card.pt != "" } has_pt := { card.pt != "" }
############################################################## The text box
# Filters for the text box # Filters for the text box
# context in which mana symbols are found # context in which mana symbols are found
mana_context := mana_context :=
...@@ -211,7 +234,7 @@ init script: ...@@ -211,7 +234,7 @@ init script:
tag_remove_rule(tag: "<i-auto>") + tag_remove_rule(tag: "<i-auto>") +
# step 2 : reminder text for keywords # step 2 : reminder text for keywords
expand_keywords_rule( expand_keywords_rule(
default_expand: { contains(match:mode, set.automatic_reminder_text) }, default_expand: { chosen(choice:mode, set.automatic_reminder_text) },
combine: { combine: {
if mode == "pseudo" then "<i-auto>{keyword}</i-auto>" if mode == "pseudo" then "<i-auto>{keyword}</i-auto>"
else "{keyword}<atom-reminder-{mode}> ({process_english_hints(reminder)})</atom-reminder-{mode}>" } else "{keyword}<atom-reminder-{mode}> ({process_english_hints(reminder)})</atom-reminder-{mode}>" }
...@@ -268,6 +291,8 @@ init script: ...@@ -268,6 +291,8 @@ init script:
replace: { to_upper() }) + replace: { to_upper() }) +
curly_quotes curly_quotes
############################################################## Other boxes
#character filter for title line #character filter for title line
name_filter := name_filter :=
# step 1 : Æ replacement rule # step 1 : Æ replacement rule
...@@ -351,17 +376,32 @@ init script: ...@@ -351,17 +376,32 @@ init script:
type_over_pt := replace_rule(match:"/$", replace:"") type_over_pt := replace_rule(match:"/$", replace:"")
type_over_type := replace_rule(match:" ?-$", replace:"") type_over_type := replace_rule(match:" ?-$", replace:"")
# Shape of cards, can be changed in style files
card_shape := { "normal" }
############################################################## Statistics utilities
# Converted mana cost # Converted mana cost
cmc := { cmc := to_text + {
1 * number_of_items(in: sort(order:"SWUBRG")) # colored mana 1 * number_of_items(in: sort(order:"SWUBRG")) # colored mana
- 1 * number_of_items(in: sort(order:"/")) # guild mana, W/U -> 2 - 1 - 1 * number_of_items(in: sort(order:"/")) # guild mana, W/U -> 2 - 1
+ 1 * sort(order: "[0123456789]") # colorless mana + 1 * sort(order: "[0123456789]") # colorless mana
} }
colored_mana := { colored_mana := to_text + {
number_of_items(in: sort(order: "WUBRG")) # colored mana number_of_items(in: sort(order: "WUBRG")) # colored mana
- number_of_items(in: sort(order:"/")) # guild mana, W/U -> 2 - 1 - number_of_items(in: sort(order:"/")) # guild mana, W/U -> 2 - 1
} }
primary_card_color := filter_rule(match:"^[^ ]+") primary_card_color := {
artifact := chosen(choice:"artifact")
land := chosen(choice:"land")
multi := chosen(choice:"multicolor")
hybrid := chosen(choice:"hybrid")
if land then "land"
else if multi and input != "artifact, multicolor" then "multicolor"
else if hybrid then "hybrid"
else if artifact then "artifact"
else input
}
# TODO : somewhere else? # TODO : somewhere else?
#card to conversion: #card to conversion:
...@@ -497,6 +537,28 @@ default set style: ...@@ -497,6 +537,28 @@ default set style:
############################################################## Card fields ############################################################## Card fields
############################# Automatic fields
# The 'shape' of the card (flip, split, etc.)
card field:
type: choice
name: shape
save value: false
show statistics: false
editable: false
choice: normal
choice: token
choice: flip
choice: split
script: card_shape() # determined by the style
card field:
type: text
name: full name
save value: false
show statistics: false
editable: false
script: if card_shape() == "split" then card.name + "/" + card.name_2 else card.name
############################# Background stuff ############################# Background stuff
card field: card field:
type: color type: color
...@@ -516,12 +578,12 @@ card field: ...@@ -516,12 +578,12 @@ card field:
color: rgb(200,180,0) color: rgb(200,180,0)
show statistics: false show statistics: false
card field: card field:
type: choice type: multiple choice
name: card color name: card color
icon: stats/card_color.png
# Specify the colors somewhere else, to keep things clean
include file: magic-blends.mse-include/card-colors include file: magic-blends.mse-include/card-colors
default: card_color(casting_cost: card.casting_cost) default: card_color(casting_cost: card.casting_cost)
show statistics: false
#needed for FPM temps???
card field: card field:
type: choice type: choice
name: font color name: font color
...@@ -878,8 +940,26 @@ card field: ...@@ -878,8 +940,26 @@ card field:
else else
forward_editor(field: card.copyright_2) forward_editor(field: card.copyright_2)
############################################################## Card list
card list color script:
input := card.card_color
if input == "white" then rgb(156,134,90)
else if input == "blue" then rgb(0,64,168)
else if input == "black" then rgb(0,0,0)
else if input == "red" then rgb(168,0,0)
else if input == "green" then rgb(0,168,0)
else (
artifact := chosen(choice:"artifact")
land := chosen(choice:"land")
multi := chosen(choice:"multicolor")
hybrid := chosen(choice:"hybrid")
if land then rgb(109,62,39) # land
else if multi and input != "artifact, multicolor" then rgb(120,120,0) # multicolor
else if hybrid then rgb(115,0,160) # hybrid
else if artifact then rgb(72,90,100) # artifact
else rgb(119,83,83) # colorless
)
...@@ -889,31 +969,32 @@ card field: ...@@ -889,31 +969,32 @@ card field:
############################################################## Statistics categories ############################################################## Statistics categories
#statistics dimension: statistics dimension:
# name: card color2 name: card color
# script: primary_card_color(card.card_color) position hint: -1
# icon: stats/card_color.png script: primary_card_color(card.card_color)
# colors: icon: stats/card_color.png
# white : rgb(255,237,202) colors:
# blue : rgb(42,141,255) white : rgb(255,237,202)
# black : rgb(33,33,33) blue : rgb(42,141,255)
# red : rgb(255,52,0) black : rgb(33,33,33)
# green : rgb(138,230,0) red : rgb(255,52,0)
# colorless : rgb(122,85,85) green : rgb(138,230,0)
# artifact : rgb(188,192,195) colorless : rgb(122,85,85)
# multicolor : rgb(255,188,14) artifact : rgb(188,192,195)
# land : rgb(109,62,39) multicolor : rgb(255,188,14)
# hybrid : rgb(243,26,136) land : rgb(109,62,39)
# group: white hybrid : rgb(243,26,136)
# group: blue group: white
# group: black group: blue
# group: red group: black
# group: green group: red
# group: colorless group: green
# group: artifact group: colorless
# group: multicolor group: artifact
# group: land group: multicolor
# group: hybrid group: land
group: hybrid
statistics dimension: statistics dimension:
name: converted mana cost name: converted mana cost
...@@ -938,12 +1019,6 @@ statistics dimension: ...@@ -938,12 +1019,6 @@ statistics dimension:
# type: word count # type: word count
# display: list # display: list
#statistics dimension:
# name: toughness2
# script: card.toughness
# numeric: true
# icon: stats/toughness.png
statistics category: statistics category:
name: color / rarity name: color / rarity
type: stack type: stack
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment