From ddceedaddef5424b98da96196e0aceb13e576814 Mon Sep 17 00:00:00 2001
From: cajun <12363371+CajunAvenger@users.noreply.github.com>
Date: Sat, 18 Jan 2025 15:03:30 -0600
Subject: [PATCH] 3.0.7
Bug fix for Card Symbol on DFCs
Bug fix for Amass rt
Bug fixes for "this type" capitalization
Bug fixes for CARDNAME on planes
Adds THIS atom that gets the opposite value as CARDNAME
Adds Custom Border automization
---
data/magic-m15-adventure.mse-style/style | 9 +-
data/magic-m15-altered.mse-style/style | 6 +-
data/magic-m15-mainframe-dfc.mse-style/style | 16 +++-
.../style | 12 ++-
.../style | 12 ++-
.../style | 5 +-
.../style | 5 +-
data/magic.mse-game/keywords | 2 +-
data/magic.mse-game/script | 86 ++++++++++++++-----
data/magic.mse-game/set_fields | 14 +++
10 files changed, 132 insertions(+), 35 deletions(-)
diff --git a/data/magic-m15-adventure.mse-style/style b/data/magic-m15-adventure.mse-style/style
index 5488abea7..ef9dc4a97 100644
--- a/data/magic-m15-adventure.mse-style/style
+++ b/data/magic-m15-adventure.mse-style/style
@@ -413,8 +413,11 @@ init script:
"/magic-mainframe-extras.mse-include/" + src
}
custom_border_blend := { color_background(type:"custom_border", base_hybrid:card_hybrid, folder:"blend_masks/") }
- is_custom := {contains(styling.frames, match:"custom border") and contains(styling.custom_border_source, match:".png")}
-
+ is_custom_border := {
+ if chosen(styling.frames, choice:"custom border")
+ then has_png(styling.custom_border_source)
+ else auto_custom_border()
+ }
# this goes at the very end
harder_script := [
crown: module_crown_template,
@@ -1227,7 +1230,7 @@ extra card style:
render style: image
image: { custom_border_blend() }
z index: 0
- visible: {is_custom()}
+ visible: {is_custom_border()}
mask: {(if is_vehicle() or is_snow() or is_nyx() then "double_") + "frame_border_mask.png"}
nyx overlay:
left: 0
diff --git a/data/magic-m15-altered.mse-style/style b/data/magic-m15-altered.mse-style/style
index 6ceda9330..3787d05ac 100644
--- a/data/magic-m15-altered.mse-style/style
+++ b/data/magic-m15-altered.mse-style/style
@@ -290,9 +290,11 @@ init script:
is_leveler := {
chosen(styling.frames, choice:"leveler")
}
+
is_custom_border := {
- chosen(styling.frames, choice:"custom border")
- and contains(styling.custom_border_source, match:".png")
+ if chosen(styling.frames, choice:"custom border")
+ then has_png(styling.custom_border_source)
+ else auto_custom_border()
}
is_leveler := {chosen(styling.frames, choice:"leveler")}
is_legend := {
diff --git a/data/magic-m15-mainframe-dfc.mse-style/style b/data/magic-m15-mainframe-dfc.mse-style/style
index 9f1fa5eb1..3a657307f 100644
--- a/data/magic-m15-mainframe-dfc.mse-style/style
+++ b/data/magic-m15-mainframe-dfc.mse-style/style
@@ -499,7 +499,9 @@ init script:
)
}
front_custom_border := {
- chosen(styling.other_options, choice:"custom border front") and contains(styling.custom_border_source, match:".png")
+ if chosen(styling.other_options, choice:"custom border front")
+ then has_png(styling.custom_border_source)
+ else auto_custom_border()
}
front_draft := {
chosen(styling.other_options, choice:"draft matters front")
@@ -552,7 +554,9 @@ init script:
)
}
back_custom_border := {
- chosen(styling.other_options, choice:"custom border back")
+ if chosen(styling.other_options, choice:"custom border back")
+ then has_png(styling.custom_border_source)
+ else auto_custom_border_2()
}
back_draft := {
chosen(styling.other_options, choice:"draft matters back")
@@ -1525,6 +1529,12 @@ init script:
transform_symbol_offset_height_2 := {
if mainframe_walkerb() then 1 else 0
}
+ card_symbol_offset_top_1 := {
+ if front_normal() then 0 else -8
+ }
+ card_symbol_offset_top_2 := {
+ if front_normal() then 0 else -8
+ }
card_stamp_offset_top_1 := {
if mainframe_walker() and stamp_shape() == "triangle" then -3 else 0
}
@@ -1983,7 +1993,7 @@ card style:
size: { name_font_size() }
color: { name_font_color() }
name 2:
- left: { if back_map() then 442 else if back_normal() then ( if card.card_symbol_2 == "none" then 435 else 455) else if card.card_symbol_2 == "none" then 456 else 439 }
+ left: { if back_map() then 442 else if back_normal() then ( if card.card_symbol_2 == "none" then 435 else 455) else if card.card_symbol_2 == "none" then 439 else 456 }
top: { (if back_map() then 27 else if back_normal() then 30 else 22) - 0.5*shrink_name2() }
right: { (if back_map() then 719 else 714) - card_style.casting_cost_2.content_width }
height: { 23 - (0.5 * shrink_name2()) }
diff --git a/data/magic-m15-mainframe-planes-mini.mse-style/style b/data/magic-m15-mainframe-planes-mini.mse-style/style
index d547b4d2f..5065c1b73 100644
--- a/data/magic-m15-mainframe-planes-mini.mse-style/style
+++ b/data/magic-m15-mainframe-planes-mini.mse-style/style
@@ -66,7 +66,17 @@ init script:
alt_text_script := {
combined_editor(field1:card.rule_text, separator1:"\n", field2:card.rule_text_2)
}
- card_name_for_face := { "" }
+ card_name_for_face := {
+ if (set.CARDNAME_replacement == "card's type" xor reverse)
+ then (
+ ty := to_lower(cardname_type(card["type"]))
+ if ty == "" then "this"
+ else "this " + ty
+ )
+ else if set.CARDNAME_replacement == "card's alias" and card["alias"] != ""
+ then card["alias"]
+ else card["name"]
+ }@(reverse:false)
is_loaded := { card_style.text.layout.separator[0] or else 0 > 0 }
top_box_height := {
diff --git a/data/magic-m15-mainframe-planes.mse-style/style b/data/magic-m15-mainframe-planes.mse-style/style
index 27133e14b..6584dc85d 100644
--- a/data/magic-m15-mainframe-planes.mse-style/style
+++ b/data/magic-m15-mainframe-planes.mse-style/style
@@ -66,7 +66,17 @@ init script:
alt_text_script := {
combined_editor(field1:card.rule_text, separator1:"\n", field2:card.rule_text_2)
}
- card_name_for_face := { "" }
+ card_name_for_face := {
+ if (set.CARDNAME_replacement == "card's type" xor reverse)
+ then (
+ ty := to_lower(cardname_type(card["type"]))
+ if ty == "" then "this"
+ else "this " + ty
+ )
+ else if set.CARDNAME_replacement == "card's alias" and card["alias"] != ""
+ then card["alias"]
+ else card["name"]
+ }@(reverse:false)
is_loaded := { card_style.text.layout.separator[0] or else 0 > 0 }
top_box_height := {
diff --git a/data/magic-m15-mainframe-planeswalker.mse-style/style b/data/magic-m15-mainframe-planeswalker.mse-style/style
index 2826a05f1..24d52eb16 100644
--- a/data/magic-m15-mainframe-planeswalker.mse-style/style
+++ b/data/magic-m15-mainframe-planeswalker.mse-style/style
@@ -267,8 +267,9 @@ init script:
is_vehicle := {chosen(styling.other_options, choice:"vehicle")}
is_pinned := {chosen(styling.other_options, choice:"pride pinlines")}
is_custom_border := {
- chosen(styling.other_options, choice:"custom border")
- and contains(styling.custom_border_source, match:".png")
+ if chosen(styling.other_options, choice:"custom border")
+ then has_png(styling.custom_border_source)
+ else auto_custom_border()
}
custom_border_blend := { color_background(type:"custom_border", base_hybrid:card_hybrid) }
diff --git a/data/magic-m15-mainframe-tokens.mse-style/style b/data/magic-m15-mainframe-tokens.mse-style/style
index 59c60bfa3..500ddfaaa 100644
--- a/data/magic-m15-mainframe-tokens.mse-style/style
+++ b/data/magic-m15-mainframe-tokens.mse-style/style
@@ -229,8 +229,9 @@ init script:
else "/magic-modules.mse-include/stamps/backs/" + (if sh == "triangle" then "triangle_stamp.png" else "stamp.png")
}
is_custom_border := {
- chosen(styling.frames, choice:"custom border")
- and contains(styling.custom_border_source, match:".png")
+ if chosen(styling.frames, choice:"custom border")
+ then has_png(styling.custom_border_source)
+ else auto_custom_border()
}
custom_border_blend := { color_background(type:"custom_border", base_hybrid:card_hybrid) }
watermark_include := "/magic-modules.mse-include/watermarks"
diff --git a/data/magic.mse-game/keywords b/data/magic.mse-game/keywords
index 854faac50..24d60eaac 100644
--- a/data/magic.mse-game/keywords
+++ b/data/magic.mse-game/keywords
@@ -1387,7 +1387,7 @@ keyword:
keyword: Amass
match: Amass name number
mode: action
- reminder: {handle_action_rt(to:"amass {param1} {param2}", "Create")} {english_number_a(param2)} +1/+1 counter(s) on an Army you control. It's also a {if param1.value == "Zombies" then "Zombie" else english_singular(param1)}. If you don't control an Army, create a 0/0 black {if param1.value == "Zombies" then "Zombie" else english_singular(param1)} Army creature token first.
+ reminder: {handle_action_rt(to:"amass {param1} {param2}", "Put")} {english_number_a(param2)} +1/+1 counter(s) on an Army you control. It's also a {if param1.value == "Zombies" then "Zombie" else english_singular(param1)}. If you don't control an Army, create a 0/0 black {if param1.value == "Zombies" then "Zombie" else english_singular(param1)} Army creature token first.
#Throne of Eldraine
keyword:
keyword: Adamant
diff --git a/data/magic.mse-game/script b/data/magic.mse-game/script
index aa389e28b..c37afb6b1 100644
--- a/data/magic.mse-game/script
+++ b/data/magic.mse-game/script
@@ -1675,6 +1675,12 @@ text_filter :=
in_context: "(^|[[:space:]]|\\(|,|\\.|:|“|\"|'|‘|-|—|/|)", #### TODO: Allow any punctuation before
replace: ""
) +
+ #### step 3a : expand shortcut word THIS
+ replace@(
+ match: "THIS>?", #### >? is here so after replacement, the mouse snaps to the end of
+ in_context: "(^|[[:space:]]|\\(|,|\\.|:|“|\"|'|‘|-|—|/|)", #### TODO: Allow any punctuation before
+ replace: ""
+ ) +
#### step 3b : expand shortcut word LEGENDNAME
replace@(
match: "LEGENDNAME>?",
@@ -1692,18 +1698,22 @@ text_filter :=
tag: "",
contents: { "" + (if card_name=="" then "CARDNAME" else strip_card_codes(card_name, atom:true)) + "" }
) +
+ tag_contents@(
+ tag: "",
+ contents: { "" + reverse_name_for(card_name, margin_code:margin_code) + "" }
+ ) +
#### capitalize This type when appropriate
replace@(
- match:"([•.]) this",
- replace:"\\1 This"
+ match:"([•.:]) this",
+ replace:"\\1 This"
) +
replace@(
- match:"([\"“'])this",
- replace:"\\1This"
+ match:"([\"“'])this",
+ replace:"\\1This"
) +
replace@(
- match:"^this",
- replace:"This"
+ match:"^this",
+ replace:"This"
) +
tag_contents@(
tag: "",
@@ -3020,19 +3030,7 @@ level_filter := { input }
#### Correct the CARDNAME atom for levelers
card_name_for_level := {
tag := name_tag_for_level()
- if set.CARDNAME_replacement == "card's type"
- then (
- ty := to_lower(cardname_type(card["type"+tag]))
- if ty == "" then "This"
- else "This " + ty
- )
- else if set.CARDNAME_replacement == "card's alias" and card["alias"+tag] != ""
- then card["alias"+tag]
- else card["name"+tag]
-}
-card_name_for_face := {
- tag := if input == 1 then "" else "_" + input
- if set.CARDNAME_replacement == "card's type"
+ if (set.CARDNAME_replacement == "card's type" xor reverse)
then (
ty := to_lower(cardname_type(card["type"+tag]))
if ty == "" then "this"
@@ -3041,7 +3039,19 @@ card_name_for_face := {
else if set.CARDNAME_replacement == "card's alias" and card["alias"+tag] != ""
then card["alias"+tag]
else card["name"+tag]
-}
+}@(reverse:false)
+card_name_for_face := {
+ tag := if input == 1 then "" else "_" + input
+ if (set.CARDNAME_replacement == "card's type" xor reverse)
+ then (
+ ty := to_lower(cardname_type(card["type"+tag]))
+ if ty == "" then "this"
+ else "this " + ty
+ )
+ else if set.CARDNAME_replacement == "card's alias" and card["alias"+tag] != ""
+ then card["alias"+tag]
+ else card["name"+tag]
+}@(reverse:false)
cardname_type := {
if is_creature(input)
then lang_setting("creature")
@@ -3057,9 +3067,23 @@ cardname_type := {
then lang_setting("enchantment")
else if is_battle(input)
then lang_setting("battle")
+ else if is_plane(input)
+ then lang_setting("plane")
else ""
}
+reverse_name_for := {
+ lv := "1"
+ face := ""
+ if contains(margin_code, match:"lv") then
+ lv := filter_text(margin_code, match:"[0-9]+")
+ else face := filter_text(margin_code, match:"[0-9]+")
+
+ card_name := if face != "" then card_name_for_face(face, reverse:true)
+ else card_name_for_level(lv, reverse:true)
+
+ if card_name == "" then "CARDNAME" else strip_card_codes(card_name, atom:true)
+}
#### This can be overwritten for more complicated levelers
#### Dungeons for example will overwrite with just {""}
name_tag_for_level := {
@@ -5155,8 +5179,30 @@ split_custom_directory := {
dir := filter_text(input, match:"^([^.]+/)+")
[directory:dir, filename:fn]
}
+auto_custom_available := { set.auto_custom_border != "disabled" and has_png(set.auto_custom_border_source)}
+auto_custom_border := {
+ auto_custom_available() and active_custom_border()
+}
+active_custom_border := {
+ if set.auto_custom_border == "check typeline" then
+ contains(card.type, match:set.auto_custom_border_match)
+ else if set.auto_custom_border == "check rules text" then
+ contains(card.text, match:set.auto_custom_border_match)
+ else false
+}
+auto_custom_border_2 := {
+ auto_custom_available() and active_custom_border_2()
+}
+active_custom_border_2 := {
+ if set.auto_custom_border == "check typeline" then
+ contains(card.type_2, match:set.auto_custom_border_match)
+ else if set.auto_custom_border == "check rules text" then
+ contains(card.text_2, match:set.auto_custom_border_match)
+ else false
+}
custom_border_image := {
src := styling.custom_border_source or else ""
+ if (not has_png(src)) and auto_custom_available() then src := set.auto_custom_border_source
ps := split_text(src, match:"-color-")
if length(ps) > 1 then
"/magic-mainframe-extras.mse-include/" + ps[0] + input + (if land then "l" else "") + ps[1]
diff --git a/data/magic.mse-game/set_fields b/data/magic.mse-game/set_fields
index 948c94b28..ba6d80660 100644
--- a/data/magic.mse-game/set_fields
+++ b/data/magic.mse-game/set_fields
@@ -479,6 +479,20 @@ set field:
type: text
name: alternate nyx
description: Use an alternate nyx source folder from magic-mainframe-extras.mse-include.
+set field:
+ type: choice
+ name: auto custom border
+ choice: disabled
+ choice: check typeline
+ choice: check rules text
+set field:
+ type: text
+ name: auto custom border match
+ description: The string to match to automate a custom border.
+set field:
+ type: text
+ name: auto custom border source
+ description: Use this file from magic-mainframe-extras as a custom vehicle-like frame. if colored, name images like "wborder.png" and put "-color-border.png" here.
set field:
type: text
name: custom index