mse version: 0.3.8
short name: Cockatrice
full name: Updated Full Exporter
position hint: 007
icon: icon.png
version: 2018-09-29
installer group: magic/Export/cockatrice
depends on:
package: magic.mse-game
version: 2009-07-23
game: magic
create directory: true
file type: *.xml|*.xml|*.*|*.*
# By K'yoril, edited by Advent, Updated by Reuben Covington, Updated by Cajun
# Based on code by Pichoro, Idle Muse, Innuendo and Seeonee
option field:
type: choice
name: reminder
choice: Include Set Code if planning to work with other sets
option field:
type: text
name: set Code
description: Set Code
option field:
type: text
name: images Location
description: Location of the Card Images
option field:
type: boolean
name: append set code
description: Adds the set code to token names to differentiate them
initial: no
script:
#####replace@(match:"\n", replace:"\\n \")+
#####replace@(match:";", replace:"\\n \")
token_export := {contains(card.shape, match:"token") or contains(card.shape, match:"emblem") or contains(card.shape, match:"rulestip")}
#Removes commas from DFC walkers
remove_commas := replace@(match:":", replace:"")+
replace@(match:"<(/|\\\\)?i>", replace:"")+
replace@(match:"[\<>:\\\\/\"\\*\\?\\|]", replace:"")
exporter_name_filter := filter_text@(match:"!exporte?r?name [^\n\<]+")
exporter_name_grabber := replace@(match:"!exporte?r?name ", replace:"")
card_name := { if exporter_name_grabber(exporter_name_filter(card.notes)) != "" then exporter_name_grabber(exporter_name_filter(card.notes)) else card.name }
convert_related := replace@(match: "!related ?(\n)?", replace:"\n")+
replace@(match:"!",replace: "")+
replace@(match:" ?; ?", replace:"\n")+
replace@(match:"(^[^\r\n\<]+)", replace:{" \" + _1 + "\"})+
replace@(match:"\([^\r\n\<]+)\\<([0-9]+)>", replace:{"\" + _1 + "\"})
remove_empty := replace@(match:"\\", replace:"")
filter_related := filter_text@(match:"!relate ?[^!]+!?")
write_normal := {
"\n"+"\"
# Name
+"\n "+"\"+remove_commas(card_name())+"\"
# Set
+"\n "+"\"+options.set_Code+"\"
# Color
+"\n "+"\"
+(if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") then "M"
else if contains(card.card_color, match:"white") then "W"
else if contains(card.card_color, match:"blue") then "U"
else if contains(card.card_color, match:"black") then "B"
else if contains(card.card_color, match:"red") then "R"
else if contains(card.card_color, match:"green") then "G"
else "")
+"\"
# Mana Cost
+"\n "+"\"+card.casting_cost+"\"
# Type
+"\n "+"\"+replace(card.type, match:"—", replace:"-")+"\"
# P/T
+(if contains(card.type, match:"Creature") then "\n ")
+(if contains(card.type, match:"Creature") then "\")
+(if contains(card.type, match:"Creature") then card.pt)
+(if contains(card.type, match:"Creature") then "\")
# Tablerow
+"\n "+"\"
+(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3"
else if contains(card.type, match:"Creature") then "2"
else if contains(card.type, match:"Land") then "0"
else "1")
+"\"
# Rules Text
+"\n "+"\"+(if card.special_text != "" then card.special_text else card.rule_text)+"\"
+"\n"+"\"
}
write_token := {
"\n"+"\"
# Name
+"\n "+"\"+remove_commas(card_name())+(if options.append_set_code then " " + options.set_Code else "")+"\"
# Set
+"\n "+"\"+options.set_Code+"\"
# Color
+"\n "+"\"
+(if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") then "M"
else if contains(card.card_color, match:"white") then "W"
else if contains(card.card_color, match:"blue") then "U"
else if contains(card.card_color, match:"black") then "B"
else if contains(card.card_color, match:"red") then "R"
else if contains(card.card_color, match:"green") then "G"
else "")
+"\"
# Type
+"\n "+"\"+replace(card.type, match:"—", replace:"-")+"\"
# P/T
+(if contains(card.type, match:"Creature") then "\n ")
+(if contains(card.type, match:"Creature") then "\")
+(if contains(card.type, match:"Creature") then card.pt)
+(if contains(card.type, match:"Creature") then "\")
# Tablerow
+"\n "+"\"
+(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3"
else if contains(card.type, match:"Creature") then "2"
else if contains(card.type, match:"Land") then "0"
else "1")
+"\"
# Rules Text
+"\n "+"\"+card.rule_text+"\"
# Token
+ "\n \1\"
# Reverse Related
+ convert_related(filter_related(card.notes))
+"\n"+"\"
}
write_flip := {
"\n"+"\"
# Name
+"\n "+"\"+remove_commas(card_name())
#+" // "+remove_commas(card.name_2)
+"\"
# Set
+"\n "+"\"+options.set_Code+"\"
# Color
+"\n "+"\"
+(if contains(card.shape, match:"flip") then
(if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") then "M"
else if contains(card.card_color, match:"white") then "W"
else if contains(card.card_color, match:"blue") then "U"
else if contains(card.card_color, match:"black") then "B"
else if contains(card.card_color, match:"red") then "R"
else if contains(card.card_color, match:"green") then "G"
else "")
else if card.card_color != "" and card.card_color != "land" and card.card_color != "artifact" and card.card_color_2 != "" and card.card_color_2 != "land" and card.card_color_2 != "artifact"then
(if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") or card.card_color != card.card_color_2 then "M"
else if contains(card.card_color, match:"white") and contains(card.card_color_2, match:"white") then "W"
else if contains(card.card_color, match:"blue") and contains(card.card_color_2, match:"blue") then "U"
else if contains(card.card_color, match:"black") and contains(card.card_color_2, match:"black") then "B"
else if contains(card.card_color, match:"red") and contains(card.card_color_2, match:"red") then "R"
else if contains(card.card_color, match:"green") and contains(card.card_color_2, match:"green") then "G"
else "")
else
(if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") or contains(card.card_color_2, match:"multicolor") or contains(card.card_color_2, match:"hybrid") then "M"
else if contains(card.card_color, match:"white") or contains(card.card_color_2, match:"white") then "W"
else if contains(card.card_color, match:"blue") or contains(card.card_color_2, match:"blue") then "U"
else if contains(card.card_color, match:"black") or contains(card.card_color_2, match:"black") then "B"
else if contains(card.card_color, match:"red") or contains(card.card_color_2, match:"red") then "R"
else if contains(card.card_color, match:"green") or contains(card.card_color_2, match:"green") then "G"
else "")
)
+"\"
# Mana Cost
+"\n "+"\"+card.casting_cost
+(if card.casting_cost_2 != "" then " // "+card.casting_cost_2)
+"\"
# Type
+"\n "+"\"+replace(card.type, match:"—", replace:"-")+" // "+replace(card.type_2, match:"—", replace:"-")+"\"
# P/T
+(if contains(card.type, match:"Creature") or contains(card.type_2, match:"Creature") then "\n ")
+(if contains(card.type, match:"Creature") or contains(card.type_2, match:"Creature") then "\")
+(if contains(card.type, match:"Creature") then card.pt)
+(if contains(card.type, match:"Creature") and contains(card.type_2, match:"Creature") then " // ")
+(if contains(card.type_2, match:"Creature") then card.pt_2)
+(if contains(card.type, match:"Creature") or contains(card.type_2, match:"Creature") then "\")
# Tablerow
+"\n "+"\"
+(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") or contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type, match:"Creature") or contains(card.type_2, match:"Creature") then "2"
else if contains(card.type, match:"Land") or contains(card.type_2, match:"Land") then "0"
else "1")
+"\"
# Rules Text
+"\n "+"\"+card.rule_text+"\n--- \n"+card.rule_text_2+"\"
+"\n"+"\"
}
write_double := {
"\n"+"\"
# Name
+"\n "+"\"+remove_commas(card_name())
#+" | ("+remove_commas(card.name_2)+")"
+"\"
# Set
+"\n "+"\"+options.set_Code+"\"
# Color
+"\n "+"\"
+(if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") then "M"
else if contains(card.card_color, match:"white") then "W"
else if contains(card.card_color, match:"blue") then "U"
else if contains(card.card_color, match:"black") then "B"
else if contains(card.card_color, match:"red") then "R"
else if contains(card.card_color, match:"green") then "G"
else "")
+"\"
# Name of the related card
+"\n "+"\"+remove_commas(card.name_2)+"\"
# Mana Cost
+"\n "+"\"+card.casting_cost+"\"
# Type
+"\n "+"\"+replace(card.type, match:"—", replace:"-")+"\"
# P/T
+(if contains(card.type, match:"Creature") then "\n ")
+(if contains(card.type, match:"Creature") then "\")
+(if contains(card.type, match:"Creature") then card.pt)
+(if contains(card.type, match:"Creature") then "\")
# Tablerow
+"\n "+"\"
+(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3"
else if contains(card.type, match:"Creature") then "2"
else if contains(card.type, match:"Land") then "0"
else "1")
+"\"
# Rules Text
+"\n "+"\"+(if card.special_text != "" then card.special_text else card.rule_text)
+"\n---\n(Back): "+remove_commas(card.name_2)+"\"
+"\n"+"\"
+"\n"+"\"
# Name II
+"\n "+"\"
#+"("+remove_commas(card_name())+") | "
+remove_commas(card.name_2)
+"\"
# Set II
+"\n "+"\"+options.set_Code+"\"
# Color II
+"\n "+"\"
+(if contains(card.card_color_2, match:"multicolor") or contains(card.card_color_2, match:"hybrid") then "M"
else if contains(card.card_color_2, match:"white") then "W"
else if contains(card.card_color_2, match:"blue") then "U"
else if contains(card.card_color_2, match:"black") then "B"
else if contains(card.card_color_2, match:"red") then "R"
else if contains(card.card_color_2, match:"green") then "G"
else "")
+"\"
# Mana Cost II
+"\n "+"\"+card.casting_cost_2+"\"
# Type II
+"\n "+"\"+replace(card.type_2, match:"—", replace:"-")+"\"
# P/T II
+(if contains(card.type_2, match:"Creature") then "\n ")
+(if contains(card.type_2, match:"Creature") then "\")
+(if contains(card.type_2, match:"Creature") then card.pt_2)
+(if contains(card.type_2, match:"Creature") then "\")
# Tablerow II
+"\n "+"\"
+(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type_2, match:"Creature") then "2"
else if contains(card.type_2, match:"Land") then "0"
else "1")
+"\"
# Rules Text II
+"\n "+"\"+(if card.special_text_2 != "" then card.special_text_2 else card.rule_text_2)
+"\n---\n(Front): "+remove_commas(card_name())+"\"
+"\n"+"\"
}
# Count the number of paragraphs to detect number of walker abilities.
paragraph_count := replace@(match:"\n", replace:"•")+
filter_text@(match:"•")
write_walker := {
"\n"+"\"
# Name
+"\n "+"\"+remove_commas(card_name())+"\"
# Set
+"\n "+"\"+options.set_Code+"\"
# Color
+"\n "+"\"
+(if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") then "M"
else if contains(card.card_color, match:"white") then "W"
else if contains(card.card_color, match:"blue") then "U"
else if contains(card.card_color, match:"black") then "B"
else if contains(card.card_color, match:"red") then "R"
else if contains(card.card_color, match:"green") then "G"
else "")
+"\"
# Mana Cost
+"\n "+"\"+card.casting_cost+"\"
# Type
+"\n "+"\"+replace(card.type, match:"—", replace:"-")+"\"
# Loyalty
+"\n "+"\"+card.loyalty+"\"
# Tablerow
+"\n "+"\"+"1"+"\"
# Rules Text
+"\n "+"\"
+(if card.special_text or else "" != "" then card.special_text else
card.loyalty_cost_1
+(if card.loyalty_cost_1 !="" then ": ")
+split_text(match:"\n", card.rule_text).0
+(if contains(paragraph_count(card.rule_text), match:"•") then "\n")
+card.loyalty_cost_2
+(if card.loyalty_cost_2 !="" then ": ")
+(if contains(paragraph_count(card.rule_text), match:"•") then split_text(match:"\n", card.rule_text).1)
+(if contains(paragraph_count(card.rule_text), match:"••") then "\n")
+card.loyalty_cost_3
+(if card.loyalty_cost_3 !="" then ": ")
+(if contains(paragraph_count(card.rule_text), match:"••") then split_text(match:"\n", card.rule_text).2)
+(if contains(paragraph_count(card.rule_text), match:"•••") then "\n")
+card.loyalty_cost_4
+(if card.loyalty_cost_4 !="" then ": ")
+(if contains(paragraph_count(card.rule_text), match:"•••") then split_text(match:"\n", card.rule_text).3))
+"\"
+"\n"+"\"
}
write_double_walker := {
"\n"+"\"
# Name
+"\n "+"\"+remove_commas(card_name())
#+" | ("+remove_commas(card.name_2)+")"
+"\"
# Set
+"\n "+"\"+options.set_Code+"\"
# Color
+"\n "+"\"
+(if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") then "M"
else if contains(card.card_color, match:"white") then "W"
else if contains(card.card_color, match:"blue") then "U"
else if contains(card.card_color, match:"black") then "B"
else if contains(card.card_color, match:"red") then "R"
else if contains(card.card_color, match:"green") then "G"
else "")
+"\"
# Name of the related card
+"\n "+"\"+remove_commas(card.name_2)+"\"
# Mana Cost
+"\n "+"\"+card.casting_cost+"\"
# Type
+"\n "+"\"+replace(card.type, match:"—", replace:"-")+"\"
# Loyalty
+(if contains(card.type, match:"Planeswalker") then "\n "+"\"+card.loyalty+"\")
# P/T
+(if contains(card.type, match:"Creature") then "\n "+"\"+card.pt+"\")
# Tablerow
+"\n "+"\"
+(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type_2, match:"Creature") then "2"
else if contains(card.type_2, match:"Land") then "0"
else "1")
+"\"
# Rules Text
+"\n "+"\"
+(if card.special_text or else "" != "" then card.special_text else
card.loyalty_cost_1
+(if card.loyalty_cost_1 !="" then ": ")
+split_text(match:"\n", card.rule_text).0
+(if contains(paragraph_count(card.rule_text), match:"•") then "\n")
+card.loyalty_cost_2
+(if card.loyalty_cost_2 !="" then ": ")
+(if contains(paragraph_count(card.rule_text), match:"•") then split_text(match:"\n", card.rule_text).1)
+(if contains(paragraph_count(card.rule_text), match:"••") then "\n")
+card.loyalty_cost_3
+(if card.loyalty_cost_3 !="" then ": ")
+(if contains(paragraph_count(card.rule_text), match:"••") then split_text(match:"\n", card.rule_text).2)
+(if contains(paragraph_count(card.rule_text), match:"•••") then "\n"))
+"\n---\n(Back): "+remove_commas(card.name_2)+"\"
+"\n"+"\"
+"\n"+"\"
# Name II
+"\n "+"\"
#+remove_commas(card_name())+") | "
+remove_commas(card.name_2)+"\"
# Set II
+"\n "+"\"+options.set_Code+"\"
# Color II
+"\n "+"\"
+(if contains(card.card_color_2, match:"multicolor") or contains(card.card_color_2, match:"hybrid") then "M"
else if contains(card.card_color_2, match:"white") then "W"
else if contains(card.card_color_2, match:"blue") then "U"
else if contains(card.card_color_2, match:"black") then "B"
else if contains(card.card_color_2, match:"red") then "R"
else if contains(card.card_color_2, match:"green") then "G"
else "")
+"\"
# Mana Cost II
+"\n "+"\"+card.casting_cost_2+"\"
# Type II
+"\n "+"\"+replace(card.type_2, match:"—", replace:"-")+"\"
# Loyalty II
+(if contains(card.type_2, match:"Planeswalker") then "\n "+"\"+card.loyalty_2+"\")
# P/T II
+(if contains(card.type_2, match:"Creature") then "\n "+"\"+card.pt_2+"\")
# Tablerow II
+"\n "+"\"
+(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type_2, match:"Creature") then "2"
else if contains(card.type_2, match:"Land") then "0"
else "1")
+"\"
# Rules Text II
+"\n "+"\"
+(if card.special_text_2 or else "" != "" then card.special_text_2 else
card.loyalty_cost_4
+(if card.loyalty_cost_4 !="" then ": ")
+split_text(match:"\n", card.rule_text_2).0
+(if contains(paragraph_count(card.rule_text_2), match:"•") then "\n")
+card.loyalty_cost_5
+(if card.loyalty_cost_5 !="" then ": ")
+(if contains(paragraph_count(card.rule_text_2), match:"•") then split_text(match:"\n", card.rule_text_2).1)
+(if contains(paragraph_count(card.rule_text_2), match:"••") then "\n")
+card.loyalty_cost_6
+(if card.loyalty_cost_6 !="" then ": ")
+(if contains(paragraph_count(card.rule_text_2), match:"••") then split_text(match:"\n", card.rule_text_2).2)
+(if contains(paragraph_count(card.rule_text_2), match:"•••") then "\n"))
+"\n---\n(Front): "+remove_commas(card_name())+"\"
+"\n"+"\"
}
write_sparker := {
"\n"+"\"
# Name
+"\n "+"\"+remove_commas(card_name())
#+" | ("+remove_commas(card.name_2)+")"
+"\"
# Set
+"\n "+"\"+options.set_Code+"\"
# Color
+"\n "+"\"
+(if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") then "M"
else if contains(card.card_color, match:"white") then "W"
else if contains(card.card_color, match:"blue") then "U"
else if contains(card.card_color, match:"black") then "B"
else if contains(card.card_color, match:"red") then "R"
else if contains(card.card_color, match:"green") then "G"
else "")
+"\"
# Name of the related card
+"\n "+"\"+remove_commas(card.name_2)+"\"
# Mana Cost
+"\n "+"\"+card.casting_cost+"\"
# Type
+"\n "+"\"+replace(card.type, match:"—", replace:"-")+"\"
# P/T
+(if contains(card.type, match:"Creature") then "\n ")
+(if contains(card.type, match:"Creature") then "\")
+(if contains(card.type, match:"Creature") then card.pt)
+(if contains(card.type, match:"Creature") then "\")
# Tablerow
+"\n "+"\"
+(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3"
else if contains(card.type, match:"Creature") then "2"
else if contains(card.type, match:"Land") then "0"
else "1")
+"\"
# Rules Text
+"\n "+"\"+(if card.special_text != "" then card.special_text else card.rule_text)
+"\n---\n(Back): "+remove_commas(card.name_2)+"\"
+"\n"+"\"
+"\n"+"\"
# Name II
+"\n "+"\"
#+remove_commas(card_name())+") | "
+remove_commas(card.name_2)+"\"
# Set II
+"\n "+"\"+options.set_Code+"\"
# Color II
+"\n "+"\"
+(if contains(card.card_color_2, match:"multicolor") or contains(card.card_color_2, match:"hybrid") then "M"
else if contains(card.card_color_2, match:"white") then "W"
else if contains(card.card_color_2, match:"blue") then "U"
else if contains(card.card_color_2, match:"black") then "B"
else if contains(card.card_color_2, match:"red") then "R"
else if contains(card.card_color_2, match:"green") then "G"
else "")
+"\"
# Mana Cost II
+"\n "+"\"+card.casting_cost_2+"\"
# Type II
+"\n "+"\"+replace(card.type_2, match:"—", replace:"-")+"\"
# Loyalty II
+(if contains(card.type_2, match:"Planeswalker") then "\n "+"\"+card.loyalty_2+"\")
# P/T II
+(if contains(card.type_2, match:"Creature") then "\n "+"\"+card.pt_2+"\")
# Tablerow II
+"\n "+"\"
+(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type_2, match:"Creature") then "2"
else if contains(card.type_2, match:"Land") then "0"
else "1")
+"\"
# Rules Text II
+"\n "+"\"
+(if card.special_text_2 or else "" != "" then card.special_text_2 else
card.loyalty_cost_4
+(if card.loyalty_cost_4 !="" then ": ")
+split_text(match:"\n", card.rule_text_2).0
+(if contains(paragraph_count(card.rule_text_2), match:"•") then "\n")
+card.loyalty_cost_5
+(if card.loyalty_cost_5 !="" then ": ")
+(if contains(paragraph_count(card.rule_text_2), match:"•") then split_text(match:"\n", card.rule_text_2).1)
+(if contains(paragraph_count(card.rule_text_2), match:"••") then "\n")
+card.loyalty_cost_6
+(if card.loyalty_cost_6 !="" then ": ")
+(if contains(paragraph_count(card.rule_text_2), match:"••") then split_text(match:"\n", card.rule_text_2).2)
+(if contains(paragraph_count(card.rule_text_2), match:"•••") then "\n"))
+"\n---\n(Front): "+remove_commas(card_name())+"\"
+"\n"+"\"
}
write_sacrificer := {
"\n"+"\"
# Name
+"\n "+"\"+remove_commas(card_name())
#+" | ("+remove_commas(card.name_2)+")"
+"\"
# Set
+"\n "+"\"+options.set_Code+"\"
# Color
+"\n "+"\"
+(if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") then "M"
else if contains(card.card_color, match:"white") then "W"
else if contains(card.card_color, match:"blue") then "U"
else if contains(card.card_color, match:"black") then "B"
else if contains(card.card_color, match:"red") then "R"
else if contains(card.card_color, match:"green") then "G"
else "")
+"\"
# Name of the related card
+"\n "+"\"+remove_commas(card.name_2)+"\"
# Mana Cost
+"\n "+"\"+card.casting_cost+"\"
# Type
+"\n "+"\"+replace(card.type, match:"—", replace:"-")+"\"
# Loyalty
+(if contains(card.type, match:"Planeswalker") then "\n "+"\"+card.loyalty+"\")
# P/T
+(if contains(card.type, match:"Creature") then "\n "+"\"+card.pt+"\")
# Tablerow
+"\n "+"\"
+(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type_2, match:"Creature") then "2"
else if contains(card.type_2, match:"Land") then "0"
else "1")
+"\"
# Rules Text
+"\n "+"\"
+(if card.special_text or else "" != "" then card.special_text else
card.loyalty_cost_1
+(if card.loyalty_cost_1 !="" then ": ")
+split_text(match:"\n", card.rule_text).0
+(if contains(paragraph_count(card.rule_text), match:"•") then "\n")
+card.loyalty_cost_2
+(if card.loyalty_cost_2 !="" then ": ")
+(if contains(paragraph_count(card.rule_text), match:"•") then split_text(match:"\n", card.rule_text).1)
+(if contains(paragraph_count(card.rule_text), match:"••") then "\n")
+card.loyalty_cost_3
+(if card.loyalty_cost_3 !="" then ": ")
+(if contains(paragraph_count(card.rule_text), match:"••") then split_text(match:"\n", card.rule_text).2)
+(if contains(paragraph_count(card.rule_text), match:"•••") then "\n"))
+"\n---\n(Back): "+remove_commas(card.name_2)+"\"
+"\n"+"\"
+"\n"+"\"
# Name II
+"\n "+"\"
#+"("+remove_commas(card_name())+") | "
+remove_commas(card.name_2)
+"\"
# Set II
+"\n "+"\"+options.set_Code+"\"
# Color II
+"\n "+"\"
+(if contains(card.card_color_2, match:"multicolor") or contains(card.card_color_2, match:"hybrid") then "M"
else if contains(card.card_color_2, match:"white") then "W"
else if contains(card.card_color_2, match:"blue") then "U"
else if contains(card.card_color_2, match:"black") then "B"
else if contains(card.card_color_2, match:"red") then "R"
else if contains(card.card_color_2, match:"green") then "G"
else "")
+"\"
# Mana Cost II
+"\n "+"\"+card.casting_cost_2+"\"
# Type II
+"\n "+"\"+replace(card.type_2, match:"—", replace:"-")+"\"
# P/T II
+(if contains(card.type_2, match:"Creature") then "\n ")
+(if contains(card.type_2, match:"Creature") then "\")
+(if contains(card.type_2, match:"Creature") then card.pt_2)
+(if contains(card.type_2, match:"Creature") then "\")
# Tablerow II
+"\n "+"\"
+(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type_2, match:"Creature") then "2"
else if contains(card.type_2, match:"Land") then "0"
else "1")
+"\"
# Rules Text II
+"\n "+"\"+(if card.special_text_2 != "" then card.special_text_2 else card.rule_text_2)
+"\n---\n(Front): "+remove_commas(card_name())+"\"
+"\n"+"\"
}
write_leveler := {
"\n"+"\"
# Name
+"\n "+"\"+remove_commas(card_name())+"\"
# Set
+"\n "+"\"+options.set_Code+"\"
# Color
+"\n "+"\"
+(if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") then "M"
else if contains(card.card_color, match:"white") then "W"
else if contains(card.card_color, match:"blue") then "U"
else if contains(card.card_color, match:"black") then "B"
else if contains(card.card_color, match:"red") then "R"
else if contains(card.card_color, match:"green") then "G"
else "")
+"\"
# Mana Cost
+"\n "+"\"+card.casting_cost+"\"
# Type
+"\n "+"\"+replace(card.type, match:"—", replace:"-")+"\"
# P/T
+(if contains(card.type, match:"Creature") then "\n ")
+(if contains(card.type, match:"Creature") then "\")
+(if contains(card.type, match:"Creature") then card.pt)
+(if contains(card.type, match:"Creature") then "\")
# Tablerow
+"\n "+"\"
+(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3"
else if contains(card.type, match:"Creature") then "2"
else if contains(card.type, match:"Land") then "0"
else "1")
+"\"
# Rules Text
+"\n "+"\"+ if card.special_text != "" then card.special_text else ""
#Level I
+card.rule_text
# Level II
+"\nLEVEL " + card.level_1
+(if card.pt_2 != "" then "\n"+card.pt_2)
+"\n"+card.rule_text_2
# Level III
+"\nLEVEL " + card.level_2
+(if card.pt_3 != "" then "\n"+card.pt_3)
+"\n"+card.rule_text_3
+"\"
+"\n"+"\"
}
write_card := { if token_export() then ""
else if contains(card.shape, match:"double") and contains(card.type, match:"Planeswalker") and contains(card.type_2, match:"Planeswalker") then write_double_walker()
else if contains(card.shape, match:"double") and card.loyalty_2 != "" then write_sparker()
else if contains(card.shape, match:"double") and card.loyalty != "" then write_sacrificer()
else if contains(card.shape, match:"double") then write_double()
else if card.name_2 != "" then write_flip()
else if card.loyalty != "" then write_walker()
else if contains(card.shape, match:"leveler") then write_leveler()
else write_normal()
}
write_tokens := { if token_export() then write_token()}
write_images := for each card in sort_list(cards, order_by: {card.card_number}) do write_image_file(card, directory: "{options.set_Code}", file:"{remove_commas(card_name())+(if token_export() and options.append_set_code then " " + options.set_Code else "")}.full.jpg", width: (if contains(card.shape, match:"double") then 752 else 375), height: 523)
write_cards := to_text(for each card in sort_list(cards, order_by: {input.card_number}) do write_card())
write_all_tokens := to_text(for each card in sort_list(cards, order_by: {input.card_number}) do write_tokens())
write_text_file(file:"tokens" + options.set_Code + ".xml", to_string("\n\n\n"+write_all_tokens+"\n\n\n"))
to_string("\n\n\n\n"+options.set_Code+"\n"+set.title+"\n\n\n\n"+write_cards+"\n\n\n")