Advertisement
Guest User

Untitled

a guest
May 6th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. ############################################################## Localization
  2.  
  3. include file: language
  4.  
  5. ############################################################## Sorting mana symbols
  6.  
  7. # correctly sort a mana symbol (no guild mana)
  8. mana_sort := sort_text@(order: "XYZI[0123456789]HSC(D)(WUBRG)")
  9. # correctly sort wedge mana
  10. mana_sort_wedge := sort_text@(order: "XYZI[0123456789]HSC(WBGUR)")
  11. # correctly sort guild mana
  12. mana_sort_guild := sort_text@(order: "[XYZI01234567890HSCWUBRG/|]") +
  13. replace@(
  14. # No lookbehind :(
  15. #match: "(?<!/)(./.|././.|./././.|.[|])(?!/)",
  16. match: "./.|././.|./././.|.[|]",
  17. in_context: "(^|[^/])<match>($|[^/])",
  18. replace: {sort_text(order:"in_place((D)(WUBRG)")}
  19. )
  20. mana_has_guild := match@(match: "[/|]") # Is there guild or half mana in the input?
  21. mana_is_wedge := { set.wedge_mana_costs and ( number_of_items(in: sort_text(order:"<WUBRG>", card.casting_cost), filter: "<WUBRG>") == 3 ) }
  22. # A mana cost can contain both normal and guild mana
  23. mana_filter := to_upper + {
  24. if mana_has_guild() then mana_sort_guild()
  25. else if mana_is_wedge() then mana_sort_wedge()
  26. else mana_sort()
  27. }
  28. # Like mana filter, only also allow tap symbols:
  29. tap_filter := sort_text@(order: "<TQ>")
  30. mana_filter_t := replace@( # Remove [] used for forcing mana symbols
  31. match: "[\\[\\]]",
  32. replace: ""
  33. ) + { tap_filter() + mana_filter() }
  34.  
  35.  
  36. ############################################################## Determine card color
  37.  
  38. # Names of colors
  39. color_name := {
  40. if input = "W" then "white"
  41. else if input = "U" then "blue"
  42. else if input = "B" then "black"
  43. else if input = "R" then "red"
  44. else if input = "G" then "green"
  45. else if input = "P" then "purp"
  46. else ""
  47. }
  48. color_names_1 := { color_name(colors.0) }
  49. color_names_2 := { color_name(colors.0) + ", " + color_name(colors.1) }
  50. color_names_3 := { color_name(colors.0) + ", " + color_name(colors.1) + ", " + color_name(colors.2) }
  51. color_names_4 := { color_name(colors.0) + ", " + color_name(colors.1) + ", " + color_name(colors.2) + ", " + color_name(colors.3) }
  52. color_names_5 := { color_name(colors.0) + ", " + color_name(colors.1) + ", " + color_name(colors.2) + ", " + color_name(colors.3) + ", " + color_name(colors.4) }
  53. # color based on mana cost, input = a mana cost
  54. color_filter := sort_text@(order: "<WUBRG>")
  55. color_filterH := sort_text@(order: "</>")
  56. mana_to_color := {
  57. count := number_of_items(in: colors)
  58. if hybrid == "" and contains(type, match:"Artifact") then
  59. # not a hybrid, but artifact
  60. if count == 0 then "artifact"
  61. else if count == 1 then color_names_1() + ", artifact"
  62. else if set.set_info.use_gradient_multicolor == "no" then "artifact, multicolor" # stop here
  63. else if count == 2 then color_names_2() + ", artifact, multicolor"
  64. else if set.set_info.use_gradient_multicolor != "yes" then "artifact, multicolor" # stop here
  65. else if count == 3 then color_names_3() + ", artifact, multicolor"
  66. else if count == 4 then color_names_4() + ", artifact, multicolor"
  67. else if count == 5 then color_names_5() + ", artifact, multicolor"
  68. else "artifact, multicolor"
  69. else if hybrid == "" then
  70. # not a hybrid, not artifact
  71. if count == 0 then "colorless"
  72. else if count == 1 then color_names_1()
  73. else if set.set_info.use_gradient_multicolor == "no" then "multicolor" # stop here
  74. else if count == 2 then color_names_2() + ", multicolor"
  75. else if set.set_info.use_gradient_multicolor != "yes" then "multicolor" # stop here
  76. else if count == 3 then color_names_3() + ", multicolor"
  77. else if count == 4 then color_names_4() + ", multicolor"
  78. else if count == 5 then color_names_5() + ", multicolor"
  79. else "multicolor"
  80. else if contains(type, match:"Artifact") then
  81. # hybrid, but artifact
  82. if count == 0 then "artifact"
  83. else if count == 1 then color_names_1() + ", artifact"
  84. else if count == 2 then color_names_2() + ", artifact"
  85. else "artifact, multicolor"
  86. else
  87. # hybrid, not artifact
  88. if count == 0 then "colorless"
  89. else if count == 1 then color_names_1()
  90. else if count == 2 then color_names_2() + ", hybrid"
  91. else "multicolor"
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement