mse version: 0.3.4
short name: Magic
full name: Magic the Gathering
icon: card-back.png
version: 2007-07-01
position hint: 1

############################################################## Functions & filters

# General functions
init script:
	
	############################################################## Sorting mana symbols
	
	# Used in FPM and Future Sight
	brush_sort := sort_rule(order: "OP")
	# correctly sort a mana symbol (no guild mana)
	mana_sort       := sort_rule(order: "XYZ[0123456789]S(WUBRG)")
	# correctly sort guild mana
	mana_sort_guild := replace_rule( # swap these:
				match: "U/W|B/U|R/B|G/R|W/G|B/W|R/U|G/B|W/R|U/G",
				in_context: "(^|[^/])<match>($|[^/])",
				replace: {input[2] + "/" + input[0]}) +
			   replace_rule(
				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",
				in_context: "(^|[^/])<match>($|[^/])",
				replace: {input[0] + "/" + input[4] + "/" + input[2]}) +
			   replace_rule(
				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?
	# A mana cost can contain both normal and guild mana
	mana_filter := to_upper + {
		if mana_has_guild()!="" then mana_sort_guild()
		else                         mana_sort()
	}
	# Like mana filter, only also allow tap symbols:
	tap_filter := sort_rule(order: "<T>")
	mana_filter_t := replace_rule(               # 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                     ""
	}
	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_rule(order: "<WUBRG>")
	color_filterH := sort_rule(order: "</>")
	mana_to_color := {
		colors := color_filter()
		hybrid := color_filterH()
		count  := number_of_items(in: colors)
		if hybrid == "" then
			# not a hybrid
			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
			# hybrid
			if      count == 2 then  color_names_2() + ", hybrid"
			else if count == 3 then  color_names_3() + ", hybrid"
			else                     "multicolor"
	}
	
	# color based on land text box, input = textbox contents
	color_text_filter :=
		# remove activation costs
		replace_rule(
			match: "<sym[^>]*>[^<]+</sym[^>]*>"
			in_context: "(?ix)<match>(,|:)|(pays?|additional|costs?)[ ]<match>",
			replace: ""
		) +
		# keep only mana
		filter_rule(match: "<sym[^>]*>([^<]+)") + color_filter;
	land_to_color := {
		# Based on watermark
		if      card.watermark = "mana symbol white" then "white, land"
		else if card.watermark = "mana symbol blue"  then "blue, land"
		else if card.watermark = "mana symbol black" then "black, land"
		else if card.watermark = "mana symbol red"   then "red, land"
		else if card.watermark = "mana symbol green" then "green, land"
		else (
			# Based on colors in text box
			colors := color_text_filter(input: card.rule_text);
			count  := number_of_items(in: colors)
			if      count == 0 then "land"
			else if count == 1 then color_names_1() + ", land"
			else if count == 2 then color_names_2() + ", land"
		)
	};
	
	# Index for sorting, white cards are first, so white->A, blue->B, .. ,
	#  multi->F, hybrid->G, arti->H, land->J, basic land->I
	is_multicolor := { chosen(choice: "multicolor") }
	is_hybrid     := { chosen(choice: "hybrid") }
	is_colorless  := { not chosen(choice: "land") }
	sort_index := {
		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=="blue"         then "B"
		else if card.card_color=="black"        then "C"
		else if card.card_color=="red"          then "D"
		else if card.card_color=="green"        then "E"
		else if is_multicolor(card.card_color)  then "F"
		else if is_hybrid    (card.card_color)  then "G"
		else if is_colorless (card.card_color)  then "I"
		else if card.rarity!="basic land"       then "J"
		else                                         "K"
	};
	
	# The color of a card
	is_artifact := match_rule(match: "(?i)Artifact")
	is_land     := match_rule(match: "(?i)Land")
	card_color := {
		# usually the color of mana
		mana_color := mana_to_color(casting_cost);
		if      mana_color == "colorless" and is_land    (input: card.super_type)  then land_to_color()
		else if mana_color == "colorless" and is_artifact(input: card.super_type)  then "artifact"
		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
	add := "" # default is nothing
	for_mana_costs := format_cost := {
		if input.separator_before == "—" then
			"<param-cost>{input.param}</param-cost>"
		else
			"{add}<param-mana>{input.param}</param-mana>"
	}
	alternative_cost := replace_rule(match:"^[A-Z]", replace: { to_lower() })
	format_alt_cost := {
		if input.separator_before == "—" then
			alternative_cost(input.param)
		else
			input.param
	}
	long_dash := replace_rule(match:"-", replace:"—")
	# Utilities for keywords
	has_cc := { card.casting_cost != "" }
	has_pt := { card.pt           != "" }
	
	############################################################## The text box
	
	# Filters for the text box
	# context in which mana symbols are found
	mana_context :=
		"(?ix)				# case insensitive, ignore whitespace
		 (^|[[:space:]\"(“'])		# start of a word
		 (  <match>:			# G: something
		 |  <match>,			# G, tap: something
		 |  <match>[ ]can[ ]be[ ]pay
		 |  (pays?|additional|costs?|the	# pay X. creatures cost 1 less. pay an additional G.
		    |adds?|pay(ed)?[ ](with|using)
		    )
		    ([ ]either)?			 # pay either X or Y
		    ([ ]<sym[^>]*>[STXYZWUBRG0-9/|]+</sym[^>]*>[ ](and|or|and/or))* # pay X or Y
		    [ ]<match> 
		    ([,.)]|$				# (end of word)
		    |[ ][^ .,]*$			# still typing...
		    |[ ]( or | and | in | less | more | to ) # or next word is ...
		    )
	         )
		 |  <param-mana><match></param-mana>		# keyword argument that is declared as mana
		 |  <param-cost>[ ]*<match></param-cost>		# keyword argument that is declared as cost
		 |  <param-cost><match>,		# keyword argument that is declared as cost
		 ";
	# the rule text filter
	#  - adds mana symbols
	#  - makes text in parentheses italic
	text_filter :=
		# step 1 : remove all automatic tags
		tag_remove_rule(tag: "<sym-auto>") +
		tag_remove_rule(tag: "<i-auto>")   +
		# step 2 : reminder text for keywords
		expand_keywords_rule(
			default_expand: { chosen(choice:mode, set.automatic_reminder_text) },
			combine:        {
				if mode == "pseudo" then "<i-auto>{keyword}</i-auto>"
				else "{keyword}<atom-reminder-{mode}> ({process_english_hints(reminder)})</atom-reminder-{mode}>" }
			) +
		# step 2b : move action keywords' reminder text to the end of the line
		replace_rule(
			match: "(<atom-reminder-action>(?:(?!<kw-).)*</atom-reminder-action></kw[^>]*>)(((?!<atom-reminder| ?<kw-)[^\n(])+)",
			replace: "\\2\\1"
			) +
		# step 2c : remove duplicate reminder text
		replace_rule(
			match: "(<atom-reminder-[^>]*>[^)]+[)]</atom-reminder-[^>]*>)([^\n]+)\\1"
			replace: "\\2\\1"
			) +
		# step 3a : expand shortcut words ~ and CARDNAME
		replace_rule(
			match: "~|~THIS~|CARDNAME",
			in_context: "(^|[[:space:]]|\\()<match>", # TODO: Allow any punctuation before
			replace: "<atom-cardname></atom-cardname>"
			) +
		# step 3b : fill in atom fields
		tag_contents_rule(
			tag: "<atom-cardname>",
			contents: { if card_name=="" then "CARDNAME" else card_name }
			) +
		# step 4 : explict non mana symbols
		replace_rule(
			match: "\\][STXYZWUBRG0-9/|]+\\[",
			replace: {"<nosym>" + mana_filter_t() + "</nosym>"} ) +
		# step 5 : add mana & tap symbols
		replace_rule(
			match: "[STXYZWUBRG0-9/|]+",
			in_context: mana_context,
			replace: {"<sym-auto>" + mana_filter_t() + "</sym-auto>"} ) +
		# step 5b : add explict mana symbols
		replace_rule(
			match: "\\[[STXYZWUBRG0-9/|]+\\]",
			replace: {"<sym>" + mana_filter_t() + "</sym>"} ) +
		# step 6 : longdash
		replace_rule(
			match: "--",
			replace: "—") +
		replace_rule(
			match: " - ",
			replace: " — ") +
		# step 6b : Æ replacement
		replace_rule(
			match: "AE",
			replace: "Æ" ) +
		# step 7 : italic reminder text
		replace_rule(
		 	match: "[(][^)\n]*[)]?",
			in_context: "(^|[[:space:]])<match>|<atom-keyword><match></",
		 	replace: "<i-auto>&</i-auto>") +
		# step 8 : automatic capitalization
		replace_rule(
			match: "[a-z]",
			in_context: "[(](<param-[a-z]*>)?<match>|[ ]*: <param-cost><match>|—<match>| — <match>",
			replace: { to_upper() }) +
		curly_quotes
	
	############################################################## Other boxes
	
	#character filter for title line
	name_filter :=
		# step 1 : Æ replacement rule
		replace_rule(
			match: "AE",
			replace: "Æ") +
		# step 2 : longdash for keywords
		replace_rule(
			match: "--",
			replace: "—") +
		replace_rule(
			match: " - ",
			replace: " — ")
	
	#character filter for copyright line
	copyright_filter :=
		# step 1 : Æ replacement rule
		replace_rule(
			match: "AE",
			replace: "Æ") +
		# step 2 : longdash for keywords
		replace_rule(
			match: "--",
			replace: "—") +
		replace_rule(
			match: " - ",
			replace: " — ") +
		# step 3 : trademark symbol
		replace_rule(
			match: "TM",
			replace: "™") +
		# step 4 : copyright symbol
		replace_rule(
			match: "CR|\\(C\\)",
			replace: "©")
	
	# the flavor text filter
	#  - makes all text italic
	flavor_text_filter :=
		# step 1 : Æ replacement rule
		replace_rule(
			match: "AE",
			replace: "Æ") +
		# step 2 : remove italic tags
		tag_remove_rule(tag: "<i-flavor>")   +
		# step 3 : surround by <i> tags
		{ "<i-flavor>" + input + "</i-flavor>" } +
		# curly quotes
		curly_quotes
	# Used in FPM and Future Sight
	brush_context :=
		"(?ix)				# case insensitive, ignore whitespace
		 (^|[[:space:]\"(])		# start of a word
		 (  (^)<match>(A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|Æ)
	         )
		 ";
	# Used in FPM and Future Sight
	artist_line_filter :=
		tag_remove_rule(tag: "<sym-auto>") +
		replace_rule(
			match: "\\][OP]+\\[",
			replace: {"<nosym>" + brush_sort() + "</nosym>"} ) +
		replace_rule(
			match: "[OP|]+",
			in_context: brush_context,
			replace: {"<sym-auto>" + brush_sort() + "</sym-auto>"} ) +
		replace_rule(
			match: "\\[[OP]+\\]",
			replace: {"<sym>" + brush_sort() + "</sym>"} ) +
		replace_rule(
			match: "AE",
			replace: "Æ") +
		replace_rule(
			match: "--",
			replace: "—") +
		replace_rule(
			match: " - ",
			replace: " — ");
	
	# Move the cursor past the separator in the p/t and type boxes
	type_over_pt   := 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
	cmc := to_text + {
		  1 * number_of_items(in: sort(order:"SWUBRG")) # colored mana
		- 1 * number_of_items(in: sort(order:"/"))      # guild mana, W/U -> 2 - 1
		+ 1 * sort(order: "[0123456789]")               # colorless mana
	}
	colored_mana := to_text + {
		  number_of_items(in: sort(order: "WUBRG"))     # colored mana
		- number_of_items(in: sort(order:"/"))          # guild mana, W/U -> 2 - 1
	}
	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?
#card to conversion:
#	name: MTGnews.com forums
#	script:
#		"[b]" + card.name + "[/b]\n" +
#		card.sub_type + " - " + card.super_type + "\n" +
#		card.rules_text + "\n"
#		card.pt + "\n"
#		"[i]" + card.flavor_text + "[/i]"

############################################################## Set fields

set field:
	type: info
	name: Set Information
set field:
	type: text
	name: title
set field:
	type: text
	name: description
	multi line: true
set field:
	type: text
	name: artist
set field:
	type: text
	name: copyright
	script: copyright_filter(value)
set field:
	type: symbol
	name: symbol
	description: The symbol for this set, double click to edit
set field:
	type: info
	name: Defaults and Automation
set field:
	type: color
	name: border color
	description: The default border color for cards
	choice:
		name: black
		color: rgb(0,0,0)
	choice:
		name: white
		color: rgb(255,255,255)
	choice:
		name: silver
		color: rgb(128,128,128)
	choice:
		name: gold
		color: rgb(200,180,0)
set field:
	type: multiple choice
	name: automatic reminder text
	choice: old
	choice: core
	choice: expert
	choice: pseudo
	choice: action
	choice: custom
	initial: old, core, expert, pseudo, action, custom
	# Convert from older mse versions
	script:
		if value = "yes" then "old, core, expert, custom"
		else if value = "no" then ""
		else value
	description: For which kinds of keywords should reminder text be added by default? Note: you can enable/disable reminder text by right clicking the keyword.
set field:
	type: boolean
	name: automatic card numbers
	description: Should card numbers be shown on the cards?
set field:
	type: boolean
	name: mark errors
	description: Marks errors on cards, for example wording and spelling errors, non unique card names, etc.
set field:
	type: choice
	name: use gradient multicolor
	choice: yes
	choice: only for two color cards
	choice: no
	description: Use gradients on multicolor cards by default, you can always change it be clicking on the card border.
	initial: no

############################# Default style

default set style:
	title:
		padding left: 2
		font:
			size: 16
	symbol:
		variation:
			name: common
			border radius: 0.10
			fill type: solid
			fill color:   rgb(0,0,0)
			border color: rgb(255,255,255)
		variation:
			name: uncommon
			border radius: 0.05
			fill type: linear gradient
			fill color 1:   rgb(224,224,224)
			fill color 2:   rgb(84, 84, 84)
			border color 1: rgb(0,  0,  0)
			border color 2: rgb(0,  0,  0)
		variation:
			name: rare
			border radius: 0.05
			fill type: linear gradient
			fill color 1:   rgb(214,196,94)
			fill color 2:   rgb(95, 84, 40)
			border color 1: rgb(0,  0,  0)
			border color 2: rgb(0,  0,  0)
		variation:
			name: special
			border radius: 0.10
			fill type: linear gradient
			fill color 1:   rgb(224,170,247)
			fill color 2:   rgb(58,7,80)
			border color 1: rgb(255,255,255)
			border color 2: rgb(255,255,255)
	automatic reminder text:
		render style: checklist
		direction: vertical
	use gradient multicolor:
		render style: both
		choice images:
			yes: script: built_in_image("bool_yes")
			no:  script: built_in_image("bool_no")

############################################################## 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
card field:
	type: color
	name: border color
	default: set.border_color
	choice:
		name: black
		color: rgb(0,0,0)
	choice:
		name: white
		color: rgb(255,255,255)
	choice:
		name: silver
		color: rgb(128,128,128)
	choice:
		name: gold
		color: rgb(200,180,0)
	show statistics: false
card field:
	type: multiple choice
	name: card color
	empty choice: colorless
	choice: white
	choice: blue
	choice: black
	choice: red
	choice:
		name: green
		line below: true
	choice: artifact
	choice: land
	choice: multicolor
	choice:
		name: hybrid
		enabled: { card_color_color_count(card.card_color) >= 2 }
		line below: true
	choice:
		name: horizontal
		enabled: { card_color_color_count(card.card_color) >= 2 }
		type: radio
	choice:
		name: vertical
		enabled: { card_color_color_count(card.card_color) >= 2 }
		type: radio
	choice:
		name: radial
		enabled: { card_color_color_count(card.card_color) >= 2 }
		type: radio
	choice:
		name: overlay
		enabled: { card_color_color_count(card.card_color) == 2 and chosen(choice:"hybrid",card.card_color) }
		type: radio
	choice:
		name: reversed
		enabled: { card_color_color_count(card.card_color) >= 2 and not chosen(choice:"overlay",card.card_color) }
	script: card_color_filter(value)
	default: card_color(casting_cost: card.casting_cost)
	show statistics: false
#needed for FPM temps???
card field:
	type: choice
	name: font color
	choice: black
	choice: white
	description: Font color for the typeline and textbox
	show statistics: false
	save value: true

############################# Name line
card field:
	type: text
	name: name
	script: name_filter(value)
	identifying: true
	show statistics: false
	card list visible: true
	card list column: 1
	card list width: 150
	description: The name of the card
card field:
	type: text
	name: casting cost
	icon: stats/casting_cost.png
	script: mana_filter(value)
	move cursor with sort: true
	card list visible: true
	card list column: 2
	card list alignment: right
	card list width: 50
	card list name: CC
	description: The casting cost of the card
card field:
	type: choice
	name: card symbol
	icon: stats/card_symbol.png
	choice: none
	choice: tombstone
	description: Symbol for this card (tombstone)

############################# Image
card field:
	type: image
	name: image
	show statistics: false

############################# Card type
card field:
	type: text
	name: super type
	icon: stats/creature_type.png
	editable: false
	script: type_over_type(value)
card field:
	type: text
	name: sub type
	icon: stats/creature_type.png
	editable: false
card field:
	type: text
	name: type
	icon: stats/creature_type.png
	save value: false
	script:
		# Either just supertype, or subtype - supertype
		combined_editor(
			field1: card.super_type,
			separator: " — ",
			field2: card.sub_type,
			soft_before_empty: true,
			hide_when_empty:   true
		)
	card list visible: true
	card list column:4
	description: The type of this card, type - to go the sub type
card field:
	type: choice
	name: rarity
	icon: stats/rarity.png
	choice: basic land
	choice: common
	choice: uncommon
	choice: rare
	choice: special
	initial: common
	card list visible: true
	card list column: 6
	description: The rarity of the card, to edit the symbol switch to the 'set info' tab
	choice colors:
		basic land: rgb(109,62,39)
		common:     rgb(33,33,33)
		uncommon:   rgb(224,224,224)
		rare:       rgb(255,207,52)
		special:    rgb(190,0,255)

############################# Text box
card field:
	type: text
	name: rule text
	script: text_filter(input: value, card_name: card.name)
	show statistics: false
card field:
	type: text
	name: flavor text
	script: flavor_text_filter(value)
	editable: false
	show statistics: false
card field:
	type: text
	name: text
	multi line: true
	save value: false
	show statistics: false
	script:
		combined_editor(field1: card.rule_text, separator: "<line>\n</line>", field2: card.flavor_text)
card field:
	type: choice
	name: watermark
	icon: stats/watermark.png
	include file: magic-watermarks.mse-include/watermark-names
	description: A watermark for below the textbox, this can be a big mana symbol used on basic lands, or a guild symbol

############################# PT
card field:
	type: text
	name: power
	icon: stats/power.png
	script: type_over_pt(value)
card field:
	type: text
	name: toughness
	icon: stats/toughness.png
card field:
	type: text
	name: pt
	save value: false
	script: 
		combined_editor(
			field1: card.power,
			separator: "/",
			field2: card.toughness,
			soft_before_empty: true,
			hide_when_empty:   true
		)
	card list visible: true
	card list column: 5
	card list width: 50
	card list name: P/T
	description: Power/toughness
	show statistics: false

############################# Card sorting / numbering
card field:
	type: text
	name: card number
	save value: false
	script:
		position(
			of: card
			in: set
			order_by: { sort_index() + card.name }
			) + 1
		+ "/" +
		number_of_items(in: set)
	card list visible: true
	card list column: 10
	card list width: 50
	card list name: #
	card list alignment: right
	editable: false
	show statistics: false

############################# Copyright stuff
card field:
	type: text
	name: illustrator
	script: artist_line_filter(value)
	icon: stats/illustrator.png
	default: set.artist
	description: Illustrator of this card, the default value can be changed on the 'set info' tab
card field:
	type: text
	name: copyright
	script: copyright_filter(value)
	default: set.copyright
	editable: false
	show statistics: false
card field:
	type: text
	name: copyright line
	save value: false
	show statistics: false
	script:
		if set.automatic_card_numbers then
			combined_editor(field1: card.copyright, separator: " ", field2: card.card_number)
		else
			forward_editor(field: card.copyright)
	description: Copyright of this card and cardnumber, the default value can be changed on the 'set info' tab

############################################################## Duplicate fields (split/flip cards)
# Based on flip templates by Wolfwood
# These are a direct copy of the fields above, only with a 2


card field:
	type: multiple choice
	name: card color 2
	icon: stats/card_color.png
	empty choice: colorless
	choice: white
	choice: blue
	choice: black
	choice: red
	choice:
		name: green
		line below: true
	choice: artifact
	choice: land
	choice: multicolor
	choice:
		name: hybrid
		enabled: { card_color_color_count(card.card_color_2) >= 2 }
		line below: true
	choice:
		name: horizontal
		enabled: { card_color_color_count(card.card_color_2) >= 2 }
		type: radio
	choice:
		name: vertical
		enabled: { card_color_color_count(card.card_color_2) >= 2 }
		type: radio
	choice:
		name: radial
		enabled: { card_color_color_count(card.card_color_2) >= 2 }
		type: radio
	choice:
		name: overlay
		enabled: { card_color_color_count(card.card_color_2) == 2 and chosen(choice:"hybrid",card.card_color_2) }
		type: radio
	choice:
		name: reversed
		enabled: { card_color_color_count(card.card_color) >= 2 and not chosen(choice:"overlay",card.card_color_2) }
	script: card_color_filter(value)
	default: card_color(casting_cost: card.casting_cost_2)
	show statistics: false
card field:
	type: text
	name: name 2
	script: name_filter(value)
	identifying: true
	show statistics: false
card field:
	type: text
	name: casting cost 2
	icon: stats/casting_cost.png
	script: mana_filter(value)
	move cursor with sort: true
	card list alignment: right
	card list width: 50
	card list name: CC
	show statistics: false
card field:
	type: choice
	name: card symbol 2
	icon: stats/card_symbol.png
	choice: none
	choice: tombstone
	show statistics: false
card field:
	type: image
	name: image 2
	show statistics: false
card field:
	type: text
	name: super type 2
	icon: stats/creature_type.png
	editable: false
	show statistics: false
	script: type_over_type(value)
card field:
	type: text
	name: sub type 2
	icon: stats/creature_type.png
	editable: false
	show statistics: false
card field:
	type: text
	name: type 2
	save value: false
	script:
		combined_editor(
			field1: card.super_type_2,
			separator: " — ",
			field2: card.sub_type_2,
			soft_before_empty: true,
			hide_when_empty:   true
		)
	show statistics: false
card field:
	type: choice
	name: rarity 2
	icon: stats/rarity.png
	choice: basic land
	choice: common
	choice: uncommon
	choice: rare
	choice: special
	initial: common
	# Both rarities will be the same
	script: card.rarity
	editable: false
	show statistics: false
card field:
	type: text
	name: rule text 2
	script: text_filter(input: value, card_name: card.name_2)
	editable: false
	show statistics: false
card field:
	type: text
	name: flavor text 2
	script: flavor_text_filter(value)
	editable: false
	show statistics: false
card field:
	type: text
	name: text 2
	multi line: true
	save value: false
	show statistics: false
	script:
		combined_editor(field1: card.rule_text_2, separator: "<line>\n</line>", field2: card.flavor_text_2)
card field:
	type: choice
	name: watermark 2
	include file: magic-watermarks.mse-include/watermark-names
	icon: stats/watermark.png
	description: A watermark for below the textbox, this can be a big mana symbol used on basic lands, a special symbol, or a guild symbol
card field:
	type: text
	name: power 2
	icon: stats/power.png
	show statistics: false
	script: type_over_pt(value)
card field:
	type: text
	name: toughness 2
	icon: stats/toughness.png
	show statistics: false
card field:
	type: text
	name: pt 2
	save value: false
	script:
		combined_editor(
			field1: card.power_2,
			separator: "/",
			field2: card.toughness_2,
			soft_before_empty: true,
			hide_when_empty:   true
		)
	card list width: 50
	card list name: P/T2
	show statistics: false
card field:
	type: text
	name: illustrator 2
	script: artist_line_filter(value)
	icon: stats/illustrator.png
	default: set.artist
	show statistics: false
card field:
	type: text
	name: copyright 2
	script: copyright_filter(value)
	default: set.copyright
	editable: false
	show statistics: false
card field:
	type: text
	name: copyright line 2
	save value: false
	show statistics: false
	script:
		if set.automatic_card_numbers then
			combined_editor(field1: card.copyright_2, separator: " ", field2: card.card_number)
		else
			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
	)







############################################################## Statistics categories

statistics dimension:
	name:   card color
	position hint: -1
	script: primary_card_color(card.card_color)
	icon: stats/card_color.png
	colors:
		white		: rgb(255,237,202)
		blue		: rgb(42,141,255)
		black		: rgb(33,33,33)
		red		: rgb(255,52,0)
		green		: rgb(138,230,0)
		colorless	: rgb(122,85,85)
		artifact	: rgb(188,192,195)
		multicolor	: rgb(255,188,14)
		land		: rgb(109,62,39)
		hybrid		: rgb(243,26,136)
	group: white
	group: blue
	group: black
	group: red
	group: green
	group: colorless
	group: artifact
	group: multicolor
	group: land
	group: hybrid

statistics dimension:
	name:   converted mana cost
	script: cmc(card.casting_cost)
	numeric: true
	icon: stats/casting_cost.png

statistics dimension:
	name:   colored mana cost
	script: colored_mana(card.casting_cost)
	numeric: true
	icon: stats/colored_casting_cost.png

#statistics dimension:
#	name: p/t
#	script: card.pt
#	numeric: true
#	icon: stats/power.png

#statistics dimension:
#	name: word count
#	type: word count
#	display: list

statistics category:
	name: color / rarity
	type: stack
	icon: stats/color_rarity.png
	dimension: card color
	dimension: rarity

#statistics category:
#	name: power / toughness
#	type: scatter
#	icon: stats/pt.png
#	dimension: power
#	dimension: toughness

#statistics category:
#	name: power / toughness / color
#	type: scatter pie
#	icon: stats/pt.png
#	dimension: power
#	dimension: toughness
#	dimension: card color

statistics category:
	name: power / toughness
	type: scatter pie
	icon: stats/pt.png
	dimension: power
	dimension: toughness
	dimension: rarity

#statistics category:
#	name: color / cost
#	type: scatter
#	dimension: card color
#	dimension: converted mana cost

statistics category:
	name: color / cost
	type: scatter pie
	icon: stats/color_cost.png
	dimension: card color
	dimension: converted mana cost
	dimension: rarity

statistics category:
	name: color / colored cost
	type: scatter
	dimension: card color
	dimension: colored mana cost

statistics category:
	name: cost / colored cost
	type: scatter pie
	dimension: converted mana cost
	dimension: colored mana cost
	dimension: card color

#statistics field:
#	name: creature type
#	data 1:
#		if card.super_type == "Creature" or card.super_type == "Legendary Creature" then
#			split(around:" ", input: card.sub_type)

#statistics field:
#	name: converted mana cost
#	graph style: bar
#	data 1:
#		card.casting_cost
#		# TODO

#statistics field:
#	name: color / rarity
#	graph style: cross
#	data 1: card.card_color
#	data 2: card.rarity

# The following (until keywords) doesn't do anything yet

############################################################## Word lists

#word list:
#	name: card types
#	word: Creature
#	word: Artifact
#	word: Enchantment
#	word: Instant
#	word: Sorcery
#	word: Land
#	word: Legendary Creature
#	word: Legendary Artifact
#	word: Legendary Enchantment
#	word: Legendary Land

#word list:
#	name: creature types
#	word: Goblin
#	word: Elf
#	word: Wizard
#	word: Human

#word list:
#	name: enchantment types
#	word:
#	word: Aura



############################################################## Add multiple cards

#set template:
#	name: Base set (??? cards)
#set template:
#	name: Expansion set (134 cards)
#set template:
#	name: 5 color cycle
#	field: rarity
#set template:
#	name: 3 rarities cycle

############################################################## Card packs

pack type:
	name: Starter pack
pack type:
	name: Tournament pack
	card type:
		name: Rare
		amount: 3
		filter: card.rarity == "rare"
	card type:
		name: Uncommon
		amount: 9
		filter: card.rarity == "uncommon"
	card type:
		name: Common
		amount: 33
		filter: card.rarity == "common"
	card type:
		name: Plains
		amount: 6
		filter: card.type == "Plains"
	card type:
		name: Island
		amount: 6
		filter: card.type == "Island"
	card type:
		name: Swamp
		amount: 6
		filter: card.type == "Swamp"
	card type:
		name: Mountain
		amount: 6
		filter: card.type == "Mountain"
	card type:
		name: Forest
		amount: 6
		filter: card.type == "Forest"
pack type:
	name: Booster pack
	card type:
		name: Rare
		amount: 1
		filter: card.rarity == "rare"
	card type:
		name: Uncommon
		amount: 3
		filter: card.rarity == "uncommon"
	card type:
		name: Common
		amount: 11
		filter: card.rarity == "common"




############################################################## Keywords

############################# Keyword rules

has keywords: true

keyword match script: name_filter(value)
#keyword preview: {keyword} <i>({reminder})</i>

keyword mode:
	name: old
	description: Old keywords (Banding, Phasing, etc.)
keyword mode:
	name: core
	description: Core set keywords (Flying, Haste, etc.)
keyword mode:
	name: expert
	description: Expert level keywords (Cycling, Vanishing, etc.)
keyword mode:
	name: pseudo
	description: Pseudo keyword / ability word (Hellbent, Threshold, etc.)
keyword mode:
	name: action
	description: Keyword actions, reminder text at end of line (Scry, Regenerate, etc.)
keyword mode:
	is default: true
	name: custom
	description: Custom keywords

keyword parameter type:
	name: mana
	match: [STXYZ0-9WUBRG/|]+
	refer script:
		name: normal
		description: No changes made
		script: \{{input}\}
	refer script:
		name: converted mana cost
		description: Converts mana to number
		# "0" left in so users can easily see how to edit script.
		script: \{cmc({input}) + 0\}
# By pichoro and bunnierein
keyword parameter type:
	name: cost
	match: [ ][STXYZ0-9WUBRG/|]*|[-—][^(\n]*
	separator before is: [ —-]
	separator after is: [.]
	optional: false
	# note: the separator is part of match
	refer script:
		name: normal
		description: When using mana only costs, doesn't include anything extra in the reminder text
		script: \{{input}\}
	refer script:
		name: add "pay an additional " for mana costs
		description: When using mana only costs, words the reminder text as "pay an additional <cost>"
		script: \{for_mana_costs(add:"pay an additional ",{input})\}
	refer script:
		name: add "pay " for mana costs
		description: When using mana only costs, words the reminder text as "pay <cost>"
		script: \{for_mana_costs(add:"pay ",{input})\}
	reminder script: format_alt_cost()
	separator script: long_dash()
keyword parameter type:
	name: number
	match: [XYZ0-9]+
	refer script:
		name: normal
		description: (1,2,3)
		script: \{{input}\}
	refer script:
		name: as words
		description: (one, two, three)
		script: \{english_number({input})\}
	refer script:
		name: as words, use "a" for 1
		description: (a, two, three)
		script: \{english_number_a({input})\}
	refer script:
		name: as words, use "" for 1
		description: (, two, three)
		script: \{english_number_multiple({input})\}
keyword parameter type:
	name: action
	match: [^(,\n]+
keyword parameter type:
	name: name
	match: [^(.,\n—-]+
	refer script:
		name: normal
		description: No changes made.
		script: \{{input}\}
	refer script:
		name: singular
		description: Removes plurality from words.
		script: \{english_singular({input})\}
keyword parameter type:
	name: prefix
	description: Prefix for things like "<something>walk"
	optional: false
	match: [A-Z][a-z, ]*
	example: Forest

############################# All Magic keywords
# By JrEye and Neko_Asakami, Updated by Pichoro and Buttock1234

keyword:
	keyword: Flying
	match: Flying
	mode: core
	reminder: This creature can’t be blocked except by creatures with flying or reach.
keyword:
	keyword: First strike
	match: First strike
	mode: core
	reminder: This creature deals combat damage before creatures without first strike.
keyword:
	keyword: Trample
	match: Trample
	mode: core
	reminder: If this creature would deal enough combat damage to its blockers to destroy them, you may have it deal the rest of its damage to defending player.
keyword:
	keyword: Banding
	match: Banding
	mode: old
	reminder: When declaring attackers or blockers this creature may group with other creatures with banding and one creature without banding. When damage is dealt, you decide where damage is dealt.
keyword:
	keyword: Landwalk
	match: <atom-param>prefix</atom-param>walk
	mode: core
	reminder: This creature is unblockable as long as defending player controls a {param1}.
keyword:
	keyword: Protection from
	match: Protection from <atom-param>name</atom-param>
	mode: core
	reminder: This creature can’t be blocked, targeted, dealt damage, enchanted, or equipped by anything {english_singular(param1)}.
keyword:
	keyword: Regeneration
	match: Regenerate
	mode: action
	reminder: The next time {if has_pt() then "this creature" else "this"} would be destroyed this turn, it isn't.{if has_pt() then " Instead tap it, remove all damage from it, and remove it from combat." else ""}
keyword:
	keyword: Bands with other
	match: Bands with other <atom-param>name</atom-param>
	mode: old
	reminder: When declaring attackers or blockers this creature may group with other creatures with banding or bands with {param1}. When damage is dealt, you decide where damage is dealt.
keyword:
	keyword: Rampage
	match: Rampage <atom-param>number</atom-param>
	mode: old
	reminder: Whenever this creature becomes blocked, it gets +{param1}/+{param1} until end of turn for each creature blocking it beyond the first.
keyword:
	keyword: Cumulative upkeep
	match: Cumulative upkeep <atom-param>cost</atom-param>
	mode: old
	reminder: At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.
keyword:
	keyword: Phasing
	match: Phasing
	mode: old
	reminder: At the beginning of your upkeep, put this and any cards and/or counters attached to it in the phased-out zone. If this is already in the phased-out zone, return it and any cards and/or counters attached to it to play. This ability does not cause comes-into-play or leaves-play abilities to trigger.
keyword:
	keyword: Flanking
	match: Flanking
	mode: old
	reminder: Whenever a creature without flanking blocks this creature, the blocking creature gets -1/-1 until end of turn.
keyword:
	keyword: Shadow
	match: Shadow
	mode: expert
	reminder: This creature can block or be blocked by only creatures with shadow.
keyword:
	keyword: Denimwalk
	match: Denimwalk
	mode: old
	reminder: If defending player is wearing any clothing made of denim, this creature is unblockable.
keyword:
	keyword: Buyback
	match: Buyback <atom-param>cost</atom-param>
	mode: expert
	reminder: You may {for_mana_costs(add:"pay an additional ",param1)} as you play this spell. If you do, put this card into your hand as it resolves.
keyword:
	keyword: Echo
	match: Echo <atom-param>cost</atom-param>
	mode: expert
	reminder: At the beginning of your upkeep, if this came under your control since the beginning of your last upkeep, sacrifice it unless you pay its echo cost.
keyword:
	keyword: Cycling
	match: Cycling <atom-param>cost</atom-param>
	mode: expert
	reminder: {param1}, Discard this card: Draw a card.
keyword:
	keyword: Haste
	match: Haste
	mode: core
	reminder: This creature can attack and tap the turn it comes under your control.
keyword:
	keyword: Horsemanship
	match: Horsemanship
	mode: old
	reminder: This creature can’t be blocked except by creatures with horsemanship.
keyword:
	keyword: Fading
	match: Fading <atom-param>number</atom-param>
	mode: expert
	reminder: This comes into play with {english_number_a(param1)} fade counter(s) on it. At the beginning of your upkeep, remove a fade counter from it. If you can’t, sacrifice it.
keyword:
	keyword: Kicker
	match: Kicker <atom-param>mana</atom-param> and/or <atom-param>mana</atom-param>
	mode: expert
	reminder: You may pay an additional {param1} and/or {param2} as you play this spell.
keyword:
	keyword: Kicker
	match: Kicker <atom-param>cost</atom-param>
	mode: expert
	reminder: You may {for_mana_costs(add:"pay an additional ",param1)} as you play this spell.
keyword:
	keyword: Flashback
	match: Flashback <atom-param>cost</atom-param>
	mode: expert
	reminder: You may play this card from your graveyard for its flashback cost. Then remove it from the game.
keyword:
	keyword: Threshold
	match: Threshold
	mode: pseudo
keyword:
	keyword: Madness
	match: Madness <atom-param>cost</atom-param>
	mode: expert
	reminder: If you discard this card, you may play it for its madness cost instead of putting it into your graveyard.
keyword:
	keyword: Morph
	match: Morph <atom-param>cost</atom-param>
	mode: expert
	reminder: You may play this face down as a 2/2 creature for <sym>3</sym>. Turn it face up any time for its morph cost.
keyword:
	keyword: Fear
	match: Fear
	mode: core
	reminder: This creature can’t be blocked except by artifact creatures and/or black creatures.
keyword:
	keyword: Amplify
	match: Amplify <atom-param>number</atom-param>
	mode: expert
	reminder: As this card comes into play, put {english_number_a(param1)} +1/+1 counter(s) on it for each creature that shares a type with this that you reveal in your hand.
keyword:
	keyword: Double strike
	match: Double strike
	mode: expert
	reminder: This creature deals both first-strike and regular combat damage.
keyword:
	keyword: Provoke
	match: Provoke
	mode: expert
	reminder: When this attacks, you may have target creature defending player controls untap and block it if able.
keyword:
	keyword: Typecycling
	match: <atom-param>prefix</atom-param>cycling <atom-param>cost</atom-param>
	mode: expert
	reminder: {param2}, Discard this card: Search your library for a {param1} card, reveal it, and put it into your hand. Then shuffle your library.
keyword:
	keyword: Storm
	match: Storm
	mode: expert
	reminder: When you play this spell, copy it for each spell played before it this turn. You may choose new targets for the copies.
keyword:
	keyword: Affinity for
	match: Affinity for <atom-param>name</atom-param>
	mode: expert
	reminder: This spell costs <sym>1</sym> less to play for each {english_singular(param1)} you control.
keyword:
	keyword: Entwine
	match: Entwine <atom-param>cost</atom-param>
	mode: expert
	reminder: Choose both if you pay the entwine cost.
keyword:
	keyword: Equip
	match: Equip <atom-param>cost</atom-param>
	mode: core
	reminder: {param1}: Attach to target creature you control. Equip only as a sorcery.
keyword:
	keyword: Imprint
	match: Imprint — <atom-param>action</atom-param>
	mode: expert
	reminder: The removed card is imprinted on this artifact.
keyword:
	keyword: Modular
	match: Modular <atom-param>number</atom-param>
	mode: expert
	reminder: This comes into play with {english_number_a(param1)} +1/+1 counter(s) on it. When it’s put into a graveyard, you may put its +1/+1 counters on target artifact creature.
keyword:
	keyword: Scry
	match: Scry <atom-param>number</atom-param>
	mode: action
	reminder:
		To scry {param1}, look at the top {
		 if param1.value==1 then "card of your library, then you may put that card on the bottom of your library."
		 else "{english_number(param1)} cards of your library. Put any number of them on the bottom of your library in any order and the rest on top in any order."
		}
keyword:
	keyword: Sunburst
	match: Sunburst
	mode: expert
	reminder: This comes into play with a {if has_pt() then "+1/+1" else "charge"} counter on it for each color of mana used to pay its cost.
keyword:
	keyword: Gotcha
	match: Gotcha
	mode: pseudo
keyword:
	keyword: Splice
	match: Splice onto <atom-param>name</atom-param> <atom-param>cost</atom-param>
	mode: expert
	reminder: As you play a {param1} spell, you may reveal this card from your hand and pay its splice cost. If you do, add this card’s effects to that spell.
keyword:
	keyword: Bushido
	match: Bushido <atom-param>number</atom-param>
	mode: expert
	reminder: When this blocks or becomes blocked, it gets +{param1}/+{param1} until end of turn.
keyword:
	keyword: Soulshift
	match: Soulshift <atom-param>number</atom-param>
	mode: expert
	reminder: When this is put into a graveyard from play, you may return target Spirit card with converted mana cost {param1} or less from you graveyard to your hand.
keyword:
	keyword: Enchant
	match: Enchant <atom-param>name</atom-param>
	mode: core
	reminder: Target a {param1} as you play this. This card comes into play attached to that {param1}.
keyword:
	keyword: Vigilance
	match: Vigilance
	mode: core
	reminder: Attacking doesn’t cause this creature to tap.
keyword:
	keyword: Defender
	match: Defender
	mode: core
	reminder: This creature can’t attack.
keyword:
	keyword: Offering
	match: <atom-param>prefix</atom-param> offering
	mode: expert
	reminder: You may play this card any time you could play an instant by sacrificing a {param1} and paying the difference in mana costs between this and the sacrificed {param1}. Mana cost includes color.
keyword:
	keyword: Ninjutsu
	match: Ninjutsu <atom-param>cost</atom-param>
	mode: expert
	reminder: {param1}, Return an unblocked attacker you control to hand: Put this card into play from your hand tapped and attacking.
keyword:
	keyword: Epic
	match: Epic
	mode: expert
	reminder: For the rest of the game, you can’t play spells. At the beginning of each of your upkeeps, copy this spell except for its epic ability. If the spell has any targets, you may choose new targets for the copy.
keyword:
	keyword: Channel
	match: Channel
	mode: pseudo
keyword:
	keyword: Sweep
	match: Sweep
	mode: pseudo
keyword:
	keyword: Convoke
	match: Convoke
	mode: expert
	reminder: Each creature you tap while playing this spell reduces its cost by <sym>1</sym> or by one mana of that creature’s color.
keyword:
	keyword: Transmute
	match: Transmute <atom-param>cost</atom-param>
	mode: expert
	reminder: {param1}, Discard this card: Search your library for a card with the same converted mana cost as this card, reveal it, and put it into your hand. Then shuffle your library. Play only as a sorcery.
keyword:
	keyword: Dredge
	match: Dredge <atom-param>number</atom-param>
	mode: expert
	reminder: If you would draw a card, instead you may put exactly {english_number(param1)} card(s) from the top of your library into your graveyard. If you do, return this card from your graveyard to your hand. Otherwise, draw a card.
keyword:
	keyword: Radiance
	match: Radiance
	mode: pseudo
keyword:
	keyword: Haunt
	match: Haunt
	mode: expert
	reminder: When this card is put into a graveyard from play, remove it from the game haunting target creature.
keyword:
	keyword: Bloodthirst
	match: Bloodthirst <atom-param>number</atom-param>
	mode: expert
	reminder: If an opponent was dealt damage this turn, this creature comes into play with {english_number_a(param1)} +1/+1 counter(s) on it.
keyword:
	keyword: Replicate
	match: Replicate <atom-param>cost</atom-param>
	mode: expert
	reminder: When you play this spell, copy it for each time you paid its replicate cost. You may choose new targets for the copies.
keyword:
	keyword: Graft
	match: Graft <atom-param>number</atom-param>
	mode: expert
	reminder: {if has_pt() then "This creature" else "This permanent"} comes into play with {english_number_a(param1)} +1/+1 counter(s) on it. Whenever {if has_pt() then "another" else "a"} creature comes into play, you may move a +1/+1 counter from {if has_pt() then "this creature" else "this permanent"} onto it.
keyword:
	keyword: Forecast
	match: Forecast — <atom-param>mana</atom-param>, Reveal <atom-param>name</atom-param> from your hand: <atom-param>action</atom-param>
	mode: expert
	reminder: Play this ability only during your upkeep and only once each turn.
keyword:
	keyword: Hellbent
	match: Hellbent
	mode: pseudo
keyword:
	keyword: Recover
	match: Recover <atom-param>cost</atom-param>
	mode: expert
	reminder: When a creature is put into your graveyard from play, you may {for_mana_costs(add:"pay ",param1)}. If you do, return this card from your graveyard to your hand. Otherwise, remove this card from the game.
keyword:
	keyword: Ripple
	match: Ripple <atom-param>number</atom-param>
	mode: expert
	reminder: When you play this spell, you may reveal the top {english_number_multiple(param1)} card(s) of your library. You may play any revealed cards with the same name as this spell without paying their mana costs. Put the rest on the bottom of your library.
keyword:
	keyword: Flash
	match: Flash
	mode: core
	reminder: You may play this spell anytime you could play an instant.
keyword:
	keyword: Split second
	match: Split second
	mode: expert
	reminder: As long as this spell is on the stack, players can't play spells or activated abilities that aren't mana abilities.
keyword:
	keyword: Suspend
	match: Suspend <atom-param>mana</atom-param>—<atom-param>cost</atom-param>
	mode: expert
	reminder: Rather than play this card from your hand,{if has_cc() then " you may" else ""} pay {param2} and remove it from the game with {english_number_a(param1)} time counter(s) on it. At the beginning of your upkeep, remove a time counter. When the last is removed, play it without paying its mana cost.{if has_pt() then " It has haste." else ""}
keyword:
	keyword: Vanishing
	match: Vanishing <atom-param>number</atom-param>
	mode: expert
	reminder: This permanent comes into play with {english_number_a(param1)} time counter(s) on it. At the beginning of your upkeep, remove a time counter from it. When the last is removed, sacrifice it.
keyword:
	keyword: Grandeur
	match: Grandeur
	mode: pseudo
keyword:
	keyword: Deathtouch
	match: Deathtouch
	mode: expert
	reminder: Whenever this creature deals damage to a creature, destroy that creature.
keyword:
	keyword: Reach
	match: Reach
	mode: core
	reminder: This creature can block creatures with flying.
keyword:
	keyword: Gravestorm
	match: Gravestorm
	mode: expert
	reminder: When you play this spell, copy it for each permanent put into a graveyard this turn. You may choose new targets for the copies.
keyword:
	keyword: Lifelink
	match: Lifelink
	mode: core
	reminder: Whenever this creature deals damage, you gain that much life.
keyword:
	keyword: Absorb
	match: Absorb <atom-param>number</atom-param>
	mode: expert
	reminder: If a source would deal damage to this creature, prevent {param1} of that damage.
keyword:
	keyword: Fateseal
	match: Fateseal <atom-param>number</atom-param>
	mode: action
	reminder:
		Look at the top {
		 if param1.value==1 then "card of an opponent's library, then you may put it on the bottom of that player's library."
		 else "{english_number(param1)} cards of an opponent's library, then put any number of them on the bottom of that player's library and the rest on top in any order."
		}
keyword:
	keyword: Transfigure
	match: Transfigure <atom-param>cost</atom-param>
	mode: expert
	reminder: {param1}, Sacrifice this creature: Search your library for a creature card with the same converted mana cost as this creature and put that card into play. Then shuffle your library. Play only as a sorcery.
keyword:
	keyword: Aura swap
	match: Aura swap <atom-param>cost</atom-param>
	mode: expert
	reminder: {param1}: Exchange this Aura with an Aura card in your hand.
keyword:
	keyword: Frenzy
	match: Frenzy <atom-param>number</atom-param>
	mode: expert
	reminder: Whenever this creature attacks and isn't blocked, it gets +{param1}/+0 until end of turn.
keyword:
	keyword: Delve
	match: Delve
	mode: expert
	reminder: You may remove any number of cards in your graveyard from the game as you play this spell. It costs <sym>1</sym> less to play for each card removed this way.
keyword:
	keyword: Poisonous
	match: Poisonous <atom-param>number</atom-param>
	mode: expert
	reminder: Whenever this creature deals combat damage to a player, that player gets {english_number_a(param1)} poison counter(s). A player with ten or more poison counters loses the game.
keyword:
	keyword: Shroud
	match: Shroud
	mode: core
	reminder: This permanent can't be the target of spells or abilities.
keyword:
	keyword: Fortify
	match: Fortify <atom-param>cost</atom-param>
	mode: expert
	reminder: {param1}: Attach to target land you control. Fortify only as a sorcery. This card comes into play unattached and stays in play if the land leaves play.
