diff --git a/data/magic-extended-art.mse-style/style b/data/magic-extended-art.mse-style/style index ba08a141..fe885e42 100644 --- a/data/magic-extended-art.mse-style/style +++ b/data/magic-extended-art.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.4 +mse version: 0.3.4 game: magic full name: Extended Art short name: Extended Art @@ -65,6 +65,14 @@ styling field: 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: popup mana symbols: @@ -199,7 +207,15 @@ card style: then "magic-mana-large" else "magic-mana-small" size: 14 - alignment: bottom left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "bottom center" + else "bottom left" z index: 2 padding left: 6 padding top: 2 diff --git a/data/magic-firepenguinmaster-flip.mse-style/style b/data/magic-firepenguinmaster-flip.mse-style/style index 24dad456..f9f1308d 100644 --- a/data/magic-firepenguinmaster-flip.mse-style/style +++ b/data/magic-firepenguinmaster-flip.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.4 +mse version: 0.3.4 game: magic full name: FPM's Flip Magic short name: FPM Flip @@ -59,6 +59,15 @@ styling field: 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: use guild mana symbols: choice images: @@ -249,7 +258,15 @@ card style: { if styling.beveled_mana_symbols then "magic-mana-beveled" else "magic-mana-small" } size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 6 padding top: 2 @@ -284,7 +301,15 @@ card style: { if styling.beveled_mana_symbols then "magic-mana-beveled" else "magic-mana-small" } size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 6 padding top: 2 diff --git a/data/magic-firepenguinmaster.mse-style/style b/data/magic-firepenguinmaster.mse-style/style index d344983b..4c86d024 100644 --- a/data/magic-firepenguinmaster.mse-style/style +++ b/data/magic-firepenguinmaster.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.4 +mse version: 0.3.4 game: magic full name: FPM's Normal Magic short name: FPM Normal @@ -73,6 +73,14 @@ styling field: 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: @@ -216,7 +224,15 @@ card style: { if styling.beveled_mana_symbols then "magic-mana-beveled" else "magic-mana-small" } size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 6 padding top: 2 diff --git a/data/magic-firepenguinmasterpromo.mse-style/style b/data/magic-firepenguinmasterpromo.mse-style/style index 52b338c2..9c52328f 100644 --- a/data/magic-firepenguinmasterpromo.mse-style/style +++ b/data/magic-firepenguinmasterpromo.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.4 +mse version: 0.3.4 game: magic full name: FPM's Promo Magic short name: FPM Promo @@ -72,6 +72,15 @@ styling field: 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 @@ -205,7 +214,15 @@ card style: { if styling.beveled_mana_symbols then "magic-mana-beveled" else "magic-mana-small" } size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 6 padding top: 2 diff --git a/data/magic-firepenguinmastersplit.mse-style/style b/data/magic-firepenguinmastersplit.mse-style/style index 6ffae8f0..e5c2923c 100644 --- a/data/magic-firepenguinmastersplit.mse-style/style +++ b/data/magic-firepenguinmastersplit.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.4 +mse version: 0.3.4 game: magic full name: FPM's Split Magic short name: FPM Split @@ -74,6 +74,15 @@ styling field: 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 @@ -293,7 +302,15 @@ card style: { if styling.beveled_mana_symbols then "magic-mana-beveled" else "magic-mana-small" } size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 6 padding top: 2 @@ -318,7 +335,15 @@ card style: { if styling.beveled_mana_symbols then "magic-mana-beveled" else "magic-mana-small" } size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 6 padding top: 2 @@ -326,6 +351,7 @@ card style: padding bottom: 2 line height hard: 1.2 line height line: 1.5 + line height soft: 0.9 watermark: left: 95.96 top : 240 diff --git a/data/magic-firepenguinmastertokens.mse-style/style b/data/magic-firepenguinmastertokens.mse-style/style index b5cbe588..f424914e 100644 --- a/data/magic-firepenguinmastertokens.mse-style/style +++ b/data/magic-firepenguinmastertokens.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.2 +mse version: 0.3.2 game: magic full name: FPM's Token Magic short name: FPM Token @@ -69,6 +69,15 @@ styling field: 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 @@ -213,7 +222,15 @@ card style: { if styling.beveled_mana_symbols then "magic-mana-beveled" else "magic-mana-small" } size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" 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 diff --git a/data/magic-new-flip.mse-style/style b/data/magic-new-flip.mse-style/style index 2fd2e81b..96515dfe 100644 --- a/data/magic-new-flip.mse-style/style +++ b/data/magic-new-flip.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.4 +mse version: 0.3.4 game: magic short name: Flip Cards full name: Modern flip cards @@ -59,6 +59,14 @@ styling field: 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: use guild mana symbols: @@ -239,7 +247,15 @@ card style: then "magic-mana-large" else "magic-mana-small" size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 4 padding top: -1 @@ -268,7 +284,15 @@ card style: then "magic-mana-large" else "magic-mana-small" size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 4 padding top: -1 diff --git a/data/magic-new-promo.mse-style/style b/data/magic-new-promo.mse-style/style index f4f3111a..990e9bb6 100644 --- a/data/magic-new-promo.mse-style/style +++ b/data/magic-new-promo.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.4 +mse version: 0.3.4 game: magic short name: Promotional full name: Large image @@ -68,6 +68,14 @@ styling field: 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: use guild mana symbols: @@ -161,7 +169,15 @@ card style: top : 317 width: 286 height: 18 - alignment: top shrink-overflow + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "top center shrink-overflow" + else "top left shrink-overflow" z index: 1 font: name: Matrix diff --git a/data/magic-new-split.mse-style/style b/data/magic-new-split.mse-style/style index 1dc6ec5d..489e3d0c 100644 --- a/data/magic-new-split.mse-style/style +++ b/data/magic-new-split.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.4 +mse version: 0.3.4 game: magic short name: Split Cards full name: Modern split cards @@ -70,6 +70,14 @@ styling field: 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: use guild mana symbols: @@ -265,7 +273,15 @@ card style: then "magic-mana-large" else "magic-mana-small" size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 2 padding top: 2 @@ -292,7 +308,15 @@ card style: then "magic-mana-large" else "magic-mana-small" size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 2 padding top: 2 diff --git a/data/magic-new-token.mse-style/style b/data/magic-new-token.mse-style/style index 19b894af..6b573af8 100644 --- a/data/magic-new-token.mse-style/style +++ b/data/magic-new-token.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.4 +mse version: 0.3.4 game: magic short name: Tokens full name: Modern style @@ -73,6 +73,14 @@ styling field: 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: short text only styling style: popup mana symbols: @@ -208,14 +216,16 @@ card style: size: 14 alignment: script: - if card_style.text.content_lines == 2 and + if (styling.center_text == "short text only" and + card_style.text.content_lines <= 2 and not contains(match:",", card.rule_text) and not contains(match: ".", card.rule_text) and not contains(match: ";", card.rule_text) and not contains(match: ":", card.rule_text) and - not contains (match: "!", card.rule_text) and - not contains (match: "?", card.rule_text) and - card.flavor_text == "" + not contains(match: "!", card.rule_text) and + not contains(match: "?", card.rule_text) and + card.flavor_text == "") or + styling.center_text == "always" then "middle center shrink-overflow" else "middle left shrink-overflow" z index: 2 diff --git a/data/magic-new.mse-style/style b/data/magic-new.mse-style/style index 4738bc41..25080ebc 100644 --- a/data/magic-new.mse-style/style +++ b/data/magic-new.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.4 +mse version: 0.3.4 game: magic short name: Modern style full name: After 8th edition @@ -94,9 +94,12 @@ styling field: choice: old choice: diagonal T styling field: - type: boolean - name: center short text - description: Center the text on cards with short rule text and no flavor text. + 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: no styling style: @@ -243,10 +246,11 @@ card style: size: 14 alignment: script: - if styling.center_short_text and + if (styling.center_text == "short text only" and not contains(match:"\n", card.rule_text) and card.flavor_text == "" and - card_style.text.content_lines <= 2 + card_style.text.content_lines <= 2) or + styling.center_text == "always" then "middle center" else "middle left" z index: 2 diff --git a/data/magic-old-split.mse-style/style b/data/magic-old-split.mse-style/style index f963c89c..2ecd4c2e 100644 --- a/data/magic-old-split.mse-style/style +++ b/data/magic-old-split.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.4 +mse version: 0.3.4 game: magic full name: Magic Old Split Cards short name: Old Splits @@ -71,6 +71,14 @@ styling field: 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: use guild mana symbols: @@ -274,7 +282,15 @@ card style: then "magic-mana-large" else "magic-mana-small" size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 2 padding top: 2 @@ -302,7 +318,15 @@ card style: then "magic-mana-large" else "magic-mana-small" size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 2 padding top: 2 diff --git a/data/magic-old-token.mse-style/style b/data/magic-old-token.mse-style/style index 99f3eb95..725fbbf6 100644 --- a/data/magic-old-token.mse-style/style +++ b/data/magic-old-token.mse-style/style @@ -1,4 +1,4 @@ -############################################################## +############################################################## ############################################################## ############################################################## Old Tokens ############################################################## @@ -74,6 +74,14 @@ styling field: 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: short text only styling style: use guild mana symbols: @@ -192,7 +200,20 @@ card style: then "magic-mana-large" else "magic-mana-small" size: 13 - alignment: middle center + alignment: + script: + if (styling.center_text == "short text only" and + card_style.text.content_lines <= 2 and + not contains(match:",", card.rule_text) and + not contains(match: ".", card.rule_text) and + not contains(match: ";", card.rule_text) and + not contains(match: ":", card.rule_text) and + not contains(match: "!", card.rule_text) and + not contains(match: "?", card.rule_text) and + card.flavor_text == "") or + styling.center_text == "always" + then "middle center shrink-overflow" + else "middle left shrink-overflow" z index: 2 padding left: 2 padding top: 2 diff --git a/data/magic-old.mse-style/style b/data/magic-old.mse-style/style index 21dc086c..2d27091d 100644 --- a/data/magic-old.mse-style/style +++ b/data/magic-old.mse-style/style @@ -1,4 +1,4 @@ -############################################################## +############################################################## ############################################################## ############################################################## OLD STYLE MAGIC ############################################################## @@ -88,6 +88,14 @@ styling field: 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: use guild mana symbols: @@ -227,7 +235,15 @@ card style: then "magic-mana-large" else "magic-mana-small" size: 13 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 2 padding top: 2 diff --git a/data/magic-planeshifted.mse-style/style b/data/magic-planeshifted.mse-style/style index 6caef731..88471c45 100644 --- a/data/magic-planeshifted.mse-style/style +++ b/data/magic-planeshifted.mse-style/style @@ -1,4 +1,4 @@ -mse version: 0.3.4 +mse version: 0.3.4 game: magic short name: Planeshifted full name: Planar Chaos Timeshifts @@ -57,6 +57,14 @@ styling field: 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: use guild mana symbols: @@ -199,7 +207,15 @@ card style: then "magic-mana-large" else "magic-mana-small" size: 14 - alignment: middle left + alignment: + script: + if (styling.center_text == "short text only" and + not contains(match:"\n", card.rule_text) and + card.flavor_text == "" and + card_style.text.content_lines <= 2) or + styling.center_text == "always" + then "middle center" + else "middle left" z index: 2 padding left: 6 padding top: 2 diff --git a/data/magic.mse-game/game b/data/magic.mse-game/game index 7b0bd43b..51ea3549 100644 --- a/data/magic.mse-game/game +++ b/data/magic.mse-game/game @@ -77,8 +77,6 @@ init script: color_filter := sort_rule(order: "") 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 @@ -108,34 +106,58 @@ init script: ) + # keep only mana filter_rule(match: "]*>([^<]+)") + color_filter; + # get the land frame for a "WUBRG"-style input. + land_multicolor := { + 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" + else if count == 3 then color_names_3() + ", land" + else "land, multicolor" + } 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" - else if count == 3 then color_names_3() + ", land" - else "land, multicolor" - ) + if watermark = "mana symbol white" then "white, land" + else if watermark = "mana symbol blue" then "blue, land" + else if watermark = "mana symbol black" then "black, land" + else if watermark = "mana symbol red" then "red, land" + else if watermark = "mana symbol green" then "green, land" + else land_multicolor(colors:color_text_filter(input: card.rule_text)) }; - + + # Look for a CDA that defines colors + text_to_color := { + text := filter_text(match: card_name+"()? is (colorless|all colors|((blue|white|green|red|black)((,|,? and) (blue|white|green|red|black))*))\\.") + if text == "" then "" + else if contains(text, match: "all colors") then ( + colors := "WUBRG" + if land = "land" then land_multicolor() + else mana_to_color(hybrid: "") + ) else ( + colors := "" + if contains(text, match: "white") then colors := colors + "W" + if contains(text, match: "blue") then colors := colors + "U" + if contains(text, match: "black") then colors := colors + "B" + if contains(text, match: "red") then colors := colors + "R" + if contains(text, match: "green") then colors := colors + "G" + if land = "land" then land_multicolor() + else mana_to_color(hybrid: "") + ) + } + # 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 (card.super_type) then land_to_color() - else if mana_color == "colorless" and is_artifact(card.super_type) then "artifact" - else mana_color + text_color := text_to_color(rules_text, land: is_land(type), card_name: card_name); + if text_color == "" then ( + mana_color := mana_to_color(colors: color_filter(casting_cost), hybrid: color_filterH(casting_cost)) + if mana_color == "colorless" and is_land (type) then land_to_color(watermark) + else if mana_color == "colorless" and is_artifact(type) then "artifact" + else mana_color + ) + else text_color }; # Number of colors in a card_color @@ -631,7 +653,12 @@ card field: save value: false show statistics: false editable: false - script: if card_shape() == "split" then card.name + "/" + card.name_2 else card.name + card list visible: true + card list name: Name + card list column: 1 + card list width: 150 + description: The name of the card + script: if card_shape() == "split" then card.name + "//" + card.name_2 else card.name ############################# Background stuff card field: @@ -689,20 +716,17 @@ card field: 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) + default: card_color(casting_cost: card.casting_cost, rules_text: card.rule_text, type: card.super_type, watermark: card.watermark, card_name: card.name) show statistics: false ############################# Name line card field: type: text name: name + card list visible: false 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 @@ -919,7 +943,7 @@ card field: 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) + 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) show statistics: false card field: type: text