Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ############################################################## Localization
- include file: language
- ############################################################## Sorting mana symbols
- # correctly sort a mana symbol (no guild mana)
- mana_sort := sort_text@(order: "XYZI[0123456789]HSC(D)(WUBRG)")
- # correctly sort wedge mana
- mana_sort_wedge := sort_text@(order: "XYZI[0123456789]HSC(WBGUR)")
- # correctly sort guild mana
- mana_sort_guild := sort_text@(order: "[XYZI01234567890HSCWUBRG/|]") +
- replace@(
- # No lookbehind :(
- #match: "(?<!/)(./.|././.|./././.|.[|])(?!/)",
- match: "./.|././.|./././.|.[|]",
- in_context: "(^|[^/])<match>($|[^/])",
- replace: {sort_text(order:"in_place((D)(WUBRG)")}
- )
- mana_has_guild := match@(match: "[/|]") # Is there guild or half mana in the input?
- mana_is_wedge := { set.wedge_mana_costs and ( number_of_items(in: sort_text(order:"<WUBRG>", card.casting_cost), filter: "<WUBRG>") == 3 ) }
- # A mana cost can contain both normal and guild mana
- mana_filter := to_upper + {
- if mana_has_guild() then mana_sort_guild()
- else if mana_is_wedge() then mana_sort_wedge()
- else mana_sort()
- }
- # Like mana filter, only also allow tap symbols:
- tap_filter := sort_text@(order: "<TQ>")
- mana_filter_t := replace@( # Remove [] used for forcing mana symbols
- match: "[\\[\\]]",
- replace: ""
- ) + { tap_filter() + mana_filter() }
- ############################################################## Determine card color
- # Names of colors
- color_name := {
- if input = "W" then "white"
- else if input = "U" then "blue"
- else if input = "B" then "black"
- else if input = "R" then "red"
- else if input = "G" then "green"
- else if input = "P" then "purp"
- 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_filter := sort_text@(order: "<WUBRG>")
- color_filterH := sort_text@(order: "</>")
- mana_to_color := {
- count := number_of_items(in: colors)
- if hybrid == "" and contains(type, match:"Artifact") then
- # not a hybrid, but artifact
- if count == 0 then "artifact"
- else if count == 1 then color_names_1() + ", artifact"
- else if set.set_info.use_gradient_multicolor == "no" then "artifact, multicolor" # stop here
- else if count == 2 then color_names_2() + ", artifact, multicolor"
- else if set.set_info.use_gradient_multicolor != "yes" then "artifact, multicolor" # stop here
- else if count == 3 then color_names_3() + ", artifact, multicolor"
- else if count == 4 then color_names_4() + ", artifact, multicolor"
- else if count == 5 then color_names_5() + ", artifact, multicolor"
- else "artifact, multicolor"
- else if hybrid == "" then
- # not a hybrid, not artifact
- if count == 0 then "colorless"
- else if count == 1 then color_names_1()
- else if set.set_info.use_gradient_multicolor == "no" then "multicolor" # stop here
- else if count == 2 then color_names_2() + ", multicolor"
- else if set.set_info.use_gradient_multicolor != "yes" then "multicolor" # stop here
- else if count == 3 then color_names_3() + ", multicolor"
- else if count == 4 then color_names_4() + ", multicolor"
- else if count == 5 then color_names_5() + ", multicolor"
- else "multicolor"
- else if contains(type, match:"Artifact") then
- # hybrid, but artifact
- if count == 0 then "artifact"
- else if count == 1 then color_names_1() + ", artifact"
- else if count == 2 then color_names_2() + ", artifact"
- else "artifact, multicolor"
- else
- # hybrid, not artifact
- if count == 0 then "colorless"
- else if count == 1 then color_names_1()
- else if count == 2 then color_names_2() + ", hybrid"
- else "multicolor"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement