Adventure Overhaul +custom border +paritions (#47)

ADVENTURE OVERHAUL
* Adventures can now customize both halves of the card, allowing for two pages.
* Each side can be an Adventure page, an Adventure page with only a name, a full text page, a flattened Adventure page, a flattened page with only the name, or blank.
* A decorations field has been set up, which allows adding additional flair around the pages to help set variants apart.
* Also we have better page images now.

PARTITIONS
* Partitions are finally live!
* Frames can add the card field "partition select" to access partition code, no additional scripting is needed.
* MSE handles partitions 0-9 and A-Z. Assign cards partitions 0-9 to sort before the default count at A, B-M to sort after it, and N-Z to sort after it and not be counted in the main set count, for card numbers like 301/300.
* The Set field "last main partition" allows the user to change the behavior by putting a replacement for M in the option.
* Card numbers default to the March of the Machine numbering of "0001" now
* But 001/099, 001, 1/99, 1, and 1000/0099 are now supported, with a second option to set overcounted cards to display with or without the main set count.
* Currently this is supported on M15 Mainframe and M15 Adventures. The rest are coming soon.

EXTRA THING
* Added Custom Border support to M15 Mainframe and M15 Adventures, which let you use magic-mainframe-extras to set up an additional border frame akin to Nyx and Vehicle. This is the finalized version used for Revolution's Ruin and Colorless frames.

BACKEND STUFF
* Adventures is trying out some new backend stuff that will get expanded upon in the coming patches:
* retooled the Landless array to be less jank
* retooled the template script a little to make it easier to hook out images with complicated links, most notably user-submitted ones like custom crowns and custom borders
* blend masks are now in their own folder
* discovered that 'styling.name or else ""' is legal code in script, which means we can make adding style options to frames *way* easier. the entire custom font code is now offloaded to scripts, and templates can access it without needing to copy paste anything beyond the styling field.

---------

Co-authored-by: cajun <12363371+CajunAvenger@users.noreply.github.com>
This commit is contained in:
cajun
2024-05-11 03:08:50 -05:00
committed by GitHub
parent 3b97d6c2f0
commit e43fb95077
317 changed files with 1147 additions and 520 deletions

View File

@@ -477,7 +477,7 @@ card field:
name: card number
save value: false
script: card_number() + "/" + card_count()
sort script: rarity_sort() + card.card_number
sort script: rarity_partition_sort() + card_number_mom()
card list visible: true
card list column: 10
card list width: 50
@@ -607,6 +607,48 @@ card field:
default: card_color(casting_cost: card.casting_cost_2, type: card.super_type_2, rules_text: card.rule_text_2, watermark: card.watermark_2, card_name: card.name_2, default: "colorless")
show statistics: false
description: The frame of a card
card field:
type: multiple choice
name: card color 3
icon: stats/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_3) >= 2 }
line below: true
choice:
name: horizontal
enabled: { card_color_color_count(card.card_color_3) >= 2 }
type: radio
choice:
name: vertical
enabled: { card_color_color_count(card.card_color_3) >= 2 }
type: radio
choice:
name: radial
enabled: { card_color_color_count(card.card_color_3) >= 2 }
type: radio
choice:
name: overlay
enabled: { card_color_color_count(card.card_color_3) == 2 and chosen(choice:"hybrid",card.card_color_3) }
type: radio
choice:
name: reversed
enabled: { card_color_color_count(card.card_color_3) >= 2 and not chosen(choice:"overlay",card.card_color_3) }
script: card_color_filter(value)
default: card_color(casting_cost: card.casting_cost_3, type: card.super_type_3, rules_text: card.rule_text_3, watermark: card.watermark_3, card_name: card.name_3, default: "colorless")
show statistics: false
description: The frame of a card
card field:
type: text
name: name 2
@@ -1359,6 +1401,69 @@ card field:
script: special_text2()
save value: true
description: Full text for exporting.
card field:
type: choice
name: partition select
show statistics: false
choice:
name: before normal
choice: 0
choice: 1
choice: 2
choice: 3
choice: 4
choice: 5
choice: 6
choice: 7
choice: 8
choice: 9
choice: A
choice:
name: after normal, main set
choice: B
choice: C
choice: D
choice: E
choice: F
choice: G
choice: H
choice: I
choice: J
choice: K
choice: L
choice: M
choice:
name: after main set
choice: N
choice: O
choice: P
choice: Q
choice: R
choice: S
choice: T
choice: U
choice: V
choice: W
choice: X
choice: Y
choice: Z
choice:
name: help
choice: This is the partition selecter
choice: You can use this to sort cards in different sublayers
choice: 0-9 go before the main count, like face commanders
choice: A is the main count
choice: B-M go after, but still count in the set total
choice: N-Z go over the set total, like #301/300
choice: You can change the flip point in the Set tab if you need to
choice: with option "Last main partition", which defaults to M
initial: A
description: The partition index for card sorting.
card field:
type: text
name: partition
script: partition_index()
save value: false
card field:
type: text
name: time modified

View File

@@ -7,7 +7,8 @@ include file: /magic-blends.mse-include/new-blends
include file: statistics_script
############################################################## version check
version_date := {"2023-02-21"}
version_date := {"2024-05-10 Mainframe 1.3.a Showcase Catchup: Adventures"}
version := version_date
############################################################## Sorting mana symbols
# correctly sort a mana symbol (no guild mana)
@@ -338,27 +339,61 @@ color_of_card := {
)
}
token_shape := {
case input of
"token": true,
"emblem": true,
"counter": true,
"rulestip": true,
"checklist": true,
else: false;
}
rarity_sort := {
if card.shape == "token" then "T1"
if is_unsorted() then "R0"
else if card.shape == "token" then "T1"
else if card.shape == "emblem" then "T2"
else if card.shape == "rulestip" then "T3"
else if card.shape == "counter" then "T4"
else if card.shape == "checklist" then "T5"
else if is_masterpiece() then "T6"
else if set.sort_special_rarity == "with the rest" or card.rarity != "special" then " "
else "S"
else if set.sort_special_rarity == "separate numbering" and card.rarity == "special" then "S1"
else if set.sort_special_rarity == "with the rest" or card.rarity != "special" then "R1"
else "R2"
}
card_partition := {"A"}
rarity_partition_sort := {
main := rarity_sort()
main.0 + partition_index() + main.1
}
card_partition := {
if styling.card_number_partition or else "" != ""
then styling.card_number_partition
else "A"
}
## MSE doesn't do "A" > "B" like some languages do
## Originally this put partition_index() and mn_pos in an array and sorted that
## but that crashed mse on startup once it was added to sort the card number column
## but you also couldn't use position() because it inherits order_by and filter from card_number()
## and MSE yells at you if you do that and you're not sorting a set
## and replacing them with nil doesn't work, it still complains if they're nil???
## so instead hard-coded map of indices
## you'll never catch me i'm behind seven workarounds
partition_scores := [
0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9,
A:10, B:11, C:12, D:13, E:14, F:15, G:16, H:17, I:18,
J:19, K:20, L:21, M:22, N:23, O:24, P:25, Q:26, R:27,
S:28, T:29, U:30, V:31, W:32, X:33, Y:34, Z:35
]
over_partition := {
my_pos := number_partition()
mn_pos := if set.last_main_partition == "" then "M" else to_upper(substring(set.last_main_partition, end:1))
posis := [my_pos, mn_pos]
higher := sort_list(posis).0
my_pos != higher
partition_scores[partition_index()] > partition_scores[mn_pos]
}
partition_filter := replace@(match:"(before normal|after normal, main set|after main set|secret|help.*) ?", replace:"")
partition_index := {
ind := partition_filter(card.partition_select)
if ind == "" then ind := "A"
ind
}
number_partition := { to_upper(substring(card_partition(), end:1)) }
set_filter := {
# TODO: what about rulestips?
if is_unsorted() then
{ is_unsorted() }
else if card.shape == "token" or card.shape == "emblem" then
@@ -369,14 +404,37 @@ set_filter := {
{ card.shape == "counter" }
else if card.shape == "checklist" then
{ card.shape == "checklist" }
else if is_masterpiece() and card.shape != "token" and card.shape != "emblem" then
{ is_masterpiece() and card.shape != "token" and card.shape != "emblem" }
else if is_masterpiece() and not token_shape(card.shape) then
{ is_masterpiece() and not token_shape(card.shape) }
else if set.sort_special_rarity != "separate numbering" then
{ not over_partition() and not is_unsorted() and card.shape != "token" and not is_masterpiece() and card.shape != "emblem" and card.shape != "rulestip" and card.shape != "counter" and card.shape != "checklist"}
{ not is_unsorted() and not token_shape(card.shape) }
else if card.rarity == "special" then
{ not over_partition() and not is_unsorted() and card.shape != "token" and not is_masterpiece() and card.shape != "emblem" and card.shape != "rulestip" and card.shape != "counter" and card.shape != "checklist" and card.rarity == "special" }
{ not is_unsorted() and not token_shape(card.shape) and card.rarity == "special" }
else
{ not over_partition() and not is_unsorted() and card.shape != "token" and not is_masterpiece() and card.shape != "emblem" and card.shape != "rulestip" and card.shape != "counter" and card.shape != "checklist" and card.rarity != "special" }
{ not is_unsorted() and not token_shape(card.shape) and card.rarity != "special" }
}
## over-partition cards need to be counted during the card number count
## but need to be skipped during the card count count
## so this is a copy of set_filter but it skips over-partition cards
set_filter_under_partition := {
if is_unsorted() then
{ is_unsorted() }
else if card.shape == "token" or card.shape == "emblem" then
{ card.shape == "token" or card.shape == "emblem" and not over_partition() }
else if card.shape == "rulestip" then
{ card.shape == "rulestip" and not over_partition() }
else if card.shape == "counter" then
{ card.shape == "counter" and not over_partition() }
else if card.shape == "checklist" then
{ card.shape == "checklist" and not over_partition() }
else if is_masterpiece() and not token_shape(card.shape) then
{ is_masterpiece() and not token_shape(card.shape) and not over_partition() }
else if set.sort_special_rarity != "separate numbering" then
{ not is_unsorted() and not token_shape(card.shape) and not over_partition() }
else if card.rarity == "special" then
{ not is_unsorted() and not token_shape(card.shape) and card.rarity == "special" and not over_partition() }
else
{ not is_unsorted() and not token_shape(card.shape) and card.rarity != "special" and not over_partition() }
}
card_number_offset := {pull_comma_array(set.card_number_offsets, cell:0, end:false, default:0)}
set_number_offset := {pull_comma_array(set.card_number_offsets, cell:1, end:false, default:0)}
@@ -384,12 +442,12 @@ card_number := {
position (
of: card
in: set
order_by: { number_partition() + rarity_sort() + sort_index() + sort_name(card.name) + sort_name(export_name())}
order_by: { partition_index() + rarity_sort() + sort_index() + sort_name(card.name) + sort_name(export_name())}
filter: set_filter()
) + 1 + to_number(card_number_offset())
}
card_count := {
number_of_items(in: set, filter: set_filter()) + to_number(set_number_offset())
number_of_items(in: set, filter: set_filter_under_partition()) + to_number(set_number_offset())
}
#Starting with M15, zero digits in card numbers should be shown up to three.
@@ -397,18 +455,23 @@ card_number_m15 := { (if card_number() < 100 then "0" else "") + (if card_number
card_count_m15 := { (if card_count() < 100 then "0" else "") + (if card_count() < 10 then "0" else "") + card_count() }
#Starting with MOM, zero digits in card numbers should be shown up to four
card_number_mom := { (if card_number() < 1000 then "0" else "") + (if card_number() < 100 then "0" else "") + (if card_number() < 10 then "0" else "") + card_number() }
card_count_mom := { (if card_count() < 1000 then "0" else "") + (if card_count() < 100 then "0" else "") + (if card_count() < 10 then "0" else "") + card_count() }
use_auto_numbers := {set.automatic_card_numbers and not is_unsorted()}
# Use this in templates so we don't have to update 700 templates the next time they change the ordering
card_number_script_core := {
if is_unsorted() or not set.automatic_card_numbers then
if not use_auto_numbers() then
combined_editor(field1: card.custom_card_number, separator: " " + rarity_code() + " ", field2: card.card_code_text)
else if set.card_number_style == "0001/0099" then
forward_editor(prefix: rarity_code() + " " + card_number_mom() + (if over_partition() and set.over_partition_display == "100" then "" else "/" + card_count_mom()) + " ", field: card.card_code_text)
else if set.card_number_style == "0001" then
forward_editor(prefix: rarity_code() + " " + card_number_mom() + " ", field: card.card_code_text)
else if set.card_number_style == "001/099" then
forward_editor(prefix: card_number_m15() + (if over_partition() then "" else "/" + card_count_m15()) + " " + rarity_code() + " ", field: card.card_code_text)
forward_editor(prefix: card_number_m15() + (if over_partition() and set.over_partition_display == "100" then "" else "/" + card_count_m15()) + " " + rarity_code() + " ", field: card.card_code_text)
else if set.card_number_style == "001" then
forward_editor(prefix: card_number_m15() + " " + rarity_code() + " ", field: card.card_code_text)
else if set.card_number_style == "1/99" then
forward_editor(prefix: card_number() + (if over_partition() then "" else "/" + card_count()) + " " + rarity_code() + " ", field: card.card_code_text)
forward_editor(prefix: card_number() + (if over_partition() and set.over_partition_display == "100" then "" else "/" + card_count()) + " " + rarity_code() + " ", field: card.card_code_text)
else
forward_editor(prefix: card_number() + " " + rarity_code() + " ", field: card.card_code_text)
}
@@ -417,7 +480,6 @@ card_number_script_core := {
is_token_card := { card.shape == "token" or card.shape == "rulestip" or card.shape == "counter" or card.shape == "checklist" or card.shape == "emblem"}
is_shifted_card := { contains(card.shape, match:"shifted") }
is_masterpiece := { card.rarity == "masterpiece" }
is_nightbreak := { card.shape == "nightbreak" }
############################################################## Utilities for keywords
@@ -777,6 +839,7 @@ mana_context :=
(
<match>: # G: something
| <match>, # G, tap: something
| [+][ ]?<match>[ ]?— # Spree
| or[ ]<match> # Add X, Y, or Z.
| <match>[ ]to[ ]your # Add X, Y, or Z to your mana pool.
| you[ ]get[ ]<match> # You get E, you get TK
@@ -1053,7 +1116,7 @@ text_filter :=
replace: "<i-auto>&</i-auto>") +
# step 7b : indent bullets
replace@(
match: "^(• )([^•]+)",
match: "^(• |[+] ?)([^\n]+\n?)",
replace: {"<li><bullet>" + _1 + "</bullet>" + _2 + "</li>"}
)+
# step 7c : clean up modals
@@ -2148,14 +2211,14 @@ rare_width := {
}
### Customize fonts
swap_font := {false} ##{styling.apply_custom_fonts}
swap_font := {styling.apply_custom_fonts or else false}
split_font := split_text@(match:";")
pop_font_name := {split_font(input).0 or else ""}
pop_font_size := {split_font(input).1 or else ""}
pop_font_color := {split_font(input).2 or else ""}
pop_font_vertical := {split_font(input).3 or else ""}
pop_font_italic := {split_font(input).4 or else ""}
## General swap functions
swap_font_name := {
if swap_font() then (
test := pop_font_name(src)
@@ -2163,7 +2226,7 @@ swap_font_name := {
)
font_name
}@(font_name:"", src:"")
}
swap_font_size := {
if swap_font() then (
test := pop_font_size(src)
@@ -2171,7 +2234,7 @@ swap_font_size := {
)
font_size
}@(font_size:16, src:"")
}
swap_font_color := {
if swap_font() then (
test := pop_font_color(src)
@@ -2185,7 +2248,7 @@ swap_font_color := {
) else ""
font_color
}@(font_color:"", src:"")
}
swap_font_vertical := {
if swap_font() then (
test := pop_font_vertical(src)
@@ -2193,7 +2256,7 @@ swap_font_vertical := {
)
vertical
}@(vertical:0, src:"")
}
swap_font_italic := {
if swap_font() then (
test := pop_font_italic(src)
@@ -2203,10 +2266,249 @@ swap_font_italic := {
)
font_name
}@(font_name:"", src:"")
}
## defaults, can be changed in style
swap_fonts_name_default := [
name: {"Beleren Bold"},
size: {16},
color: {"black"},
vertical: {0},
italic: {""}
]
swap_fonts_name2_default := [
name: {"Beleren Bold"},
size: {16},
color: {"black"},
vertical: {0},
italic: {""}
]
swap_fonts_type_default := [
name: {"Beleren Bold"},
size: {13},
color: {"black"},
vertical: {0},
italic: {""}
]
swap_fonts_type2_default := [
name: {"Beleren Bold"},
size: {13},
color: {"white"},
vertical: {0},
italic: {""}
]
swap_fonts_body_default := [
name: {"MPlantin"},
size: {13},
color: {"black"},
vertical: {0},
italic: {"MPlantin-Italic"}
]
swap_fonts_pt_default := [
name: {"Beleren Bold"},
size: {16},
color: {"black"},
vertical: {0},
italic: {""}
]
swap_fonts_name_src := {styling.custom_name_font or else ""}
swap_fonts_name_src := {styling.custom_name_font or else ""}
swap_fonts_name2_src := {styling.custom_name_2_font or else ""}
swap_fonts_type_src := {styling.custom_type_font or else ""}
swap_fonts_type2_src := {styling.custom_type_2_font or else ""}
swap_fonts_body_src := {styling.custom_body_font or else ""}
swap_fonts_pt_src := {styling.custom_pt_font or else ""}
## specific swap functions
name_font := {
swap_font_name(
src: swap_fonts_name_src(),
font_name: swap_fonts_name_default.name()
)
}
name_font_size := {
swap_font_size(
src: swap_fonts_name_src(),
font_size: swap_fonts_name_default.size()
) - shrink_name()
}
name_font_color := {
swap_font_color(
src: swap_fonts_name_src(),
font_color: swap_fonts_name_default.color()
)
}
name_font_vertical := {
swap_font_vertical(
src: swap_fonts_name_src(),
vertical: swap_fonts_name_default.vertical()
)
}
name_font_italic := {
swap_font_italic(
src: swap_fonts_name_src(),
font_name: swap_fonts_name_default.italic()
)
}
name2_font := {
swap_font_name(
src: swap_fonts_name2_src(),
font_name: swap_fonts_name2_default.name()
)
}
name2_font_size := {
swap_font_size(
src: swap_fonts_name2_src(),
font_size: swap_fonts_name2_default.size()
) - shrink_name2()
}
name2_font_color := {
swap_font_color(
src: swap_fonts_name2_src(),
font_color: swap_fonts_name2_default.color()
)
}
name2_font_vertical := {
swap_font_vertical(
src: swap_fonts_name2_src(),
vertical: swap_fonts_name2_default.vertical()
)
}
name2_font_italic := {
swap_font_italic(
src: swap_fonts_name2_src(),
font_name: swap_fonts_name2_default.italic()
)
}
type_font := {
swap_font_name(
src: swap_fonts_type_src(),
font_name: swap_fonts_type_default.name()
)
}
type_font_size := {
swap_font_size(
src: swap_fonts_type_src(),
font_size: swap_fonts_type_default.size()
) - shrink_type()
}
type_font_color := {
swap_font_color(
src: swap_fonts_type_src(),
font_color: swap_fonts_type_default.color()
)
}
type_font_vertical := {
swap_font_vertical(
src: swap_fonts_type_src(),
vertical: swap_fonts_type_default.vertical()
)
}
type_font_italic := {
swap_font_italic(
src: swap_fonts_type_src(),
font_name: swap_fonts_type_default.italic()
)
}
type2_font := {
swap_font_name(
src: swap_fonts_type2_src(),
font_name: swap_fonts_type2_default.name()
)
}
type2_font_size := {
swap_font_size(
src: swap_fonts_type2_src(),
font_size: swap_fonts_type2_default.size()
) - shrink_type2()
}
type2_font_color := {
swap_font_color(
src: swap_fonts_type2_src(),
font_color: swap_fonts_type2_default.color()
)
}
type2_font_vertical := {
swap_font_vertical(
src: swap_fonts_type2_src(),
vertical: swap_fonts_type2_default.vertical()
)
}
type2_font_italic := {
swap_font_italic(
src: swap_fonts_type2_src(),
font_name: swap_fonts_type2_default.italic()
)
}
body_font := {
swap_font_name(
src: swap_fonts_body_src(),
font_name: swap_fonts_body_default.name()
)
}
body_font_size := {
swap_font_size(
src: swap_fonts_body_src(),
font_size: swap_fonts_body_default.size()
)
}
body_font_color := {
swap_font_color(
src: swap_fonts_body_src(),
font_color: swap_fonts_body_default.color()
)
}
body_font_vertical := {
swap_font_vertical(
src: swap_fonts_body_src(),
vertical: swap_fonts_body_default.vertical()
)
}
body_font_italic := {
swap_font_italic(
src: swap_fonts_body_src(),
font_name: swap_fonts_body_default.italic()
)
}
pt_font := {
swap_font_name(
src: swap_fonts_pt_src(),
font_name: swap_fonts_pt_default.name()
)
}
pt_font_size := {
swap_font_size(
src: swap_fonts_pt_src(),
font_size: swap_fonts_pt_default.size()
)
}
pt_font_color := {
swap_font_color(
src: swap_fonts_pt_src(),
font_color: swap_fonts_pt_default.color()
)
}
pt_font_vertical := {
swap_font_vertical(
src: swap_fonts_pt_src(),
vertical: swap_fonts_pt_default.vertical()
)
}
pt_font_italic := {
swap_font_italic(
src: swap_fonts_pt_src(),
font_name: swap_fonts_pt_default.italic()
)
}
shrink_name := {0}
shrink_type := {0}
shrink_name2 := {0}
shrink_type2 := {0}
#### Customize rarity symbol
alt_rarity := {""} ##{styling.alt_rarity_color}
alt_rarity := {styling.alt_rarity_color or else ""}
use_alt_rarity := {alt_rarity() != ""}
alt_rarity_color := {
string := "83,67,53:177,150,131:0,0,0:0,0,0:0.07:"

View File

@@ -143,6 +143,17 @@ set field:
choice: 001
choice: 1/99
choice: 1
choice: 0001/0099
set field:
type: text
name: last main partition
description: Card Number Partitions after this one aren't counted as the main part of the set, ex "301" or "301/300" rather than "301/900". Default is M.
set field:
type: choice
name: over partition display
description: How to display card numbers larger than the main set?
choice: 100
choice: 100/099
set field:
type: text
name: card number offsets
@@ -298,10 +309,6 @@ set field:
type: boolean
name: use flavor bar
description: Enables the flavor bar on Mainframe templates.
set field:
type: text
name: last main partition
description: Card Number Partitions after this one aren't counted as the main part of the set, ex "301" rather than "301/300" or "301/900". Default is M.
set field:
type: choice
name: default stamp