mse version: 0.3.2
game: magic
full name: FPM's Token Magic
short name: FPM Token
icon: card-sample.png
position hint: 421

card width: 375
card height: 523
card dpi: 300

############################################################## Extra scripts

init script:
	green_template := {
		if input == "g" then (
			if   styling.green_style == "light" then "lg"
			else                                     "g"
		) else input
	}
	suffix := [card: "card.jpg", textbox: "textbox.png", typeline: "typeline.png"]
	template      := { green_template() + suffix[type] }
	land_template := { (if input == "a" then "c" else green_template()) + "l" + suffix[type] }
	
	# Use the normal tap symbol
	mana_t := {
		if      styling.tap_symbol == "old"        then "old"
		else if styling.tap_symbol == "diagonal T" then "older"
		else                                            "new"
	}
	
	# Use guild mana symbols?
	guild_mana := { styling.use_guild_mana_symbols }
	
	# Only white cards use a black font
	# TODO: also for some overlays involving white
	font_colors_white := { input != "w" }
	
	paintbrush_color := { if font_white() then "white" else "black" }

############################################################## Extra style
styling field:
	type: choice
	name: cardname font
	description: Use Matrix or MatrixBoldSmallCaps for the cardname font?
	initial: Matrix
	choice: Matrix
	choice: MatrixBoldSmallCaps
styling field:
	type: boolean
	name: beveled mana symbols
	description: Use the symbols of the casting cost line inside the text box as well
	initial: no
styling field:
	type: boolean
	name: use guild mana symbols
	description: Use the Ravnica guild symbols instead of the official half/half circles for hybrid mana.
	initial: no
styling field:
	type: choice
	name: green style
	description: Choose the style of green: light or dark.
	initial: dark
	choice: light
	choice: dark
styling field:
	type: choice
	name: tap symbol
	description: What tap symbol should be used on cards?
	initial: modern
	choice: modern
	choice: old
	choice: diagonal T
styling field:
	type: choice
	name: center text
	description: When to center text (short text only means only on one-line cards with no flavor text)
	choice: always
	choice: short text only
	choice: never
	initial: never

styling style:
	green style:
		render style: both
		choice images:
			light: lgcard.jpg
			dark:  gcard.jpg
	use guild mana symbols:
		choice images:
			yes: /magic-mana-small.mse-symbol-font/mana_guild_rg.png
			no:  /magic-mana-small.mse-symbol-font/mana_rg.png
	beveled mana symbols:
		choice images:
			yes: /magic-mana-beveled.mse-symbol-font/mana_w.png
			no:  /magic-mana-small.mse-symbol-font/mana_w.png
	tap symbol:
		render style: both
		choice images:
			modern:     /magic-mana-small.mse-symbol-font/mana_t.png
			old:        /magic-mana-small.mse-symbol-font/mana_t_old.png
			diagonal T: /magic-mana-small.mse-symbol-font/mana_t_older.png

############################################################## Card fields
card style:
	############################# Background stuff
	border color:
		left: 0
		top : 0
		width:	375
		height:	523
		radius: 18
		left width:   18
		right width:  18
		top width:    18
		bottom width: 18
		z index: 4
	card color:
		left:	0
		top:	0
		width:	375
		height:	523
		z index: -2
		render style: image
		popup style: in place
		image: { card_background() }

	############################# Name line
	name:
		left: 45
		top : 25
		width: 290
		height: 23
		alignment: bottom shrink-overflow
		padding bottom: 0
		z index: 1
		font:
			name: 
				{ if styling.cardname_font == "Matrix" then "Matrix"
				else if styling.cardname_font == "MatrixBoldSmallCaps" then "MatrixBoldSmallCaps"
				else "Matrix" }
			size: 20
			color: rgb(0,0,0)
	casting cost:
		left: 18
		top : 55
		width: 27
		height: 250
		alignment: top right
		direction: vertical
		symbol font:
			name: magic-mana-beveled
			size: 18
			scale down to: 18
			alignment: bottom right
		always symbol: true
		padding top:    0
		z index: 2
	card symbol:
		left: 30
		top : 27
		height: 20
		width: 14
		render style: image
		choice images:
			tombstone: tombstone.png

	############################# Image
	image:
		left:	50
		top:	67
		width:	306
		height:	437
		mask:	imagemask.png
		z index: 1

	############################# Card type

	type:
		left: 110
		top : 475
		width: 220
		height: 20
		alignment: top shrink-overflow
		z index: 3
		padding top: 2
		font:
			name: Matrix
			size: 10
			color: rgb(0,0,0)
			separator color: rgb(128,128,128)

	rarity:
		left: 
			{ if card.type != "" or card.illustrator != "" or card.copyright != "" then 75
			else 23 }
		top : 468
		width: 22
		height: 22
		z index: 3
		render style: image
		choice images:
			# Images based on the set symbol
			basic land: script: symbol_variation(symbol: set.symbol, variation: "common")
			common:     script: symbol_variation(symbol: set.symbol, variation: "common")
			uncommon:   script: symbol_variation(symbol: set.symbol, variation: "uncommon")
			rare:       script: symbol_variation(symbol: set.symbol, variation: "rare")
			special:	    script: symbol_variation(symbol: set.symbol, variation: "special")

	############################# Text box
	text:
		left: 56
		top : 410
		width: 290
		height: 46
		font:
			name: MPlantin
			italic name: MPlantin-Italic
			size: 14
			scale down to: 6
			color: rgb(0,0,0)
		symbol font:
			name:
				{ if styling.beveled_mana_symbols then "magic-mana-beveled"
				else "magic-mana-small" }
			size: 14
		alignment:
			script:
				if (styling.center_text == "short text only" and
				   not contains(match:"\n", card.rule_text) and
				   card.flavor_text == "<i-flavor></i-flavor>" and
				   card_style.text.content_lines <= 2) or
				   styling.center_text == "always"
				then "middle center"
				else "middle left"
		z index: 3
		padding left:   6
		padding top:    2
		padding right:  4
		padding bottom: 2
		line height hard: 1.2
		line height line: 1.5
		line height soft: 0.9
	watermark:
		left: 181
		top : 405
		width: 45
		height: 50
		z index: 3
		render style: image
		alignment: middle center
		visible: { card.rule_text != "" and card.flavor_text != "" }
		include file: magic-watermarks.mse-include/watermarks

	############################# PT
	power:
		z index: 4
		left:	24
		top:	361
		width:	19
		height:	50
		alignment: center middle
		font:
			name: Mplantin
			size: 18
			weight: bold
			color: rgb(255,255,255)
			shadow color: rgb(0,0,0)
			shadow displacement x: 1
			shadow displacement y: 1

	toughness:
		z index: 4
		left:	25
		top:	418
		width:	19
		height:	50
		alignment: center middle
		font:
			name: Mplantin
			size: 18
			weight: bold
			color: rgb(255,255,255)
			shadow color: rgb(0,0,0)
			shadow displacement x: 1
			shadow displacement y: 1

	############################# Copyright stuff

	illustrator:
		right: 350
		top : 460
		width: { max(20, card_style.illustrator.content_width) + 5 }
		height: 16
		z index: 3
		alignment: middle right
		font:
			name: MPlantin-Italic
			size: 8
			color: { font_color(card.card_color) }

	copyright line:
		left: 65
		top : 492
		width: 285
		height: 12
		z index: 3
		alignment: bottom right
		font:
			name: MPlantin
			size: 7
			color: { font_color(card.card_color) }


############################################################## Extra card fields

extra card field:
	type: choice
	name: pt symbols
	script: "shieldsword"
	editable: false
extra card field:
	type: choice
	name: textbox
	script: card.card_color
	show statistics: false
	editable: false
	save value: false
extra card field:
	type: choice
	name: typeline
	script: card.card_color
	show statistics: false
	editable: false
	save value: false
extra card field:
	type: choice
	name: paintbrush
	script: paintbrush_color(card.card_color)
	editable: false
	choice: black
	choice: white

extra card style:
	pt symbols:
		left:	25
		top:	362
		width:	19
		height:	103
		z index: 1
		visible: { card.power != "" or card.toughness != "" }
		render style: image
		choice images:
			shieldsword: ptshieldsword.png
	textbox:
		left: 52
		top: 405
		width: 299
		height: 55
		render style: image
		popup style: in place
		visible:
			{ card.rule_text != "" or
			  (number_of_items(in:"" + card.flavor_text) > 21) }
		image: { card_textbox() }
		z index: 2
	typeline:
		left: 53
		top: 463
		width: 304
		height: 41
		render style: image
		popup style: in place
		visible: { card.type != "" or card.illustrator != "" or card.copyright != "" }
		image: { card_typeline() }
		z index: 2
	paintbrush:
		right: { 350 - card_style.illustrator.content_width }
		top : 461
		width: 40
		height: 15
		z index: 3
		render style: image
		choice images:
			black: paintbrush.png
			white: paintbrush_w.png
