Refactor multi/hybrid/artifact blends (#119)

* refactor and comment multi/hybrid/artifact blends
This commit is contained in:
GenevensiS
2025-02-05 01:35:29 +01:00
committed by GitHub
parent 26ac839ddd
commit 2842527a7e

View File

@@ -874,190 +874,131 @@ color_background := {
color_combination := {
# does this have an override blend_type?
if blend_type == "" then blend_type := type
# The base hybrid between colors, without the outer frame blended over it
# Basic gradient of the color frames
base := base_hybrid[shape][color_count]
# Do we need to blend an additional gold, colorless or artifact outer frame?
if land and not colored_lands then
(
if multicolor_blend == "black" then land_template("c")
else if multicolor_blend == "white" then base()
else masked_blend(
mask: "{folder}multicolor_blend_{blend_type}.png",
dark: land_template("c"),
light: base(),
# This next step adds additional blending from artifact, hybrid, and multicolor cards
# Usually, the basic gradient is used on the "light" parts of the mask
# And one of those three are used on the "dark" parts
# artifact mode is expected to add a trim effect, but leave the plates and pinlines alone
# hybrid mode is expected to add a plate effect, but leave the trim and pinline alone
# multicolor mode is expted to add a trim and plate effect, but leave the pinline alone
# when in conflict, artifact > multicolor > hybrid
# an artifact that costs (W)(W/U)(U) has artifact trim, gold plates, and WU gradient pinlines
# this finds the parameters needed for the script at the end
# but may need an intermediate blend step when modes are chained
mode := "" # by default we don't blend at all
light := base # our base gradient script
light_input := input # the color we've been given
dark := template # the template script for this type
dark_input := "c" # the color of the secondary blend image
if land and not colored_lands then (
## blend with land via multi mode
mode := "multicolor"
dark := land_template
)
else if land and multi then (
## blend with land via hybrid mode
## mask_hybrid decides the dark input
mode := "hybrid"
dark := land_template
if mask_hybrid_with_gold() then (
## Add mland internals to the gradient
dark_input := "m"
)
else if mask_multi_land_with_color() then (
## Use gradient's internals on mland
light := land_template
light_input := "m"
dark := base
dark_input := input
)
else (
## cland with gradient pinlines
mode := "multicolor"
)
)
else if land and multi and mask_hybrid_with_gold() then
(
if hybrid_blend == "black" then land_template("m")
else if hybrid_blend == "white" then base()
else masked_blend(
mask: "{folder}hybrid_blend_{blend_type}.png",
dark: land_template("m"),
light: base(),
else if artifact then (
## blend via artifact mode
## multi and hybrid need to chain blends
## otherwise just use artifact as dark input
mode := "artifact"
dark_input := "a"
if multi then (
## first blend multicolor internals onto the gradient
## then artifact will overwrite the outer portion
light := { conditional_masked_blend(
mode: "multicolor",
light: base,
light_input: input,
dark: template,
dark_input : "m"
)}
)
else if color_count <= 1 then (
## blend artifact outside
)
else if mask_hybrid_with_land() then (
## first blend cland internals, artifact happens later
light := { conditional_masked_blend(
mode: "multicolor",
light: base,
light_input: input,
dark: template,
dark_input : "c"
)}
)
else if mask_hybrid_with_gold() then (
## first blend mland internals, artifact happens later
light := { conditional_masked_blend(
mode: "multicolor",
light: base,
light_input: input,
dark: template,
dark_input : "m"
)}
)
else (
## shouldn't get here, but if we do, blend artifact outside
)
)
else if land and multi and mask_multi_land_with_color() then
(
if hybrid_blend == "black" then base()
else if hybrid_blend == "white" then land_template("m")
else masked_blend(
mask: "{folder}hybrid_blend_{blend_type}.png",
dark: base(),
light: land_template("m"),
else if multi then (
## complex forms already handled
## just blend multicolor over the gradient
mode := "multicolor"
dark_input := "m"
)
else if color_count > 1 then (
## blend hybrid internals over the gradient
## settings change which template we blend with
mode := "hybrid"
dark := land_template
if mask_hybrid_with_gold() then (
dark_input := "m"
)
)
else if multi and artifact then
(
if artifact_blend == "black" then template("a")
else if artifact_blend == "white" then
(
if multicolor_blend == "black" then template("m")
else if multicolor_blend == "white" then base()
else masked_blend(
mask: "{folder}multicolor_blend_{blend_type}.png",
dark: template("m"),
light: base()
)
)
else
(
if multicolor_blend == "black" then masked_blend(
mask: "{folder}artifact_blend_{blend_type}.png",
dark: template("a"),
light: template("m")
)
else if multicolor_blend == "white" then masked_blend(
mask: "{folder}artifact_blend_{blend_type}.png",
dark: template("a"),
light: base()
)
else masked_blend(
mask: "{folder}artifact_blend_{blend_type}.png",
dark: template("a"),
light: masked_blend(
mask: "{folder}multicolor_blend_{blend_type}.png",
dark: template("m"),
light: base()
)
)
)
)
else if multi then
(
if multicolor_blend == "black" then template("m")
else if multicolor_blend == "white" then base()
else masked_blend(
mask: "{folder}multicolor_blend_{blend_type}.png",
dark: template("m"),
light: base(),
)
)
else if artifact and color_count > 1 and mask_hybrid_with_land() then
(
if artifact_blend == "black" then template("a")
else if artifact_blend == "white" then
(
if multicolor_blend == "black" then template("c")
else if multicolor_blend == "white" then base()
else masked_blend(
mask: "{folder}multicolor_blend_{blend_type}.png",
dark: template("c"),
light: base()
)
)
else
(
if multicolor_blend == "black" then masked_blend(
mask: "{folder}artifact_blend_{blend_type}.png",
dark: template("a"),
light: template("c")
)
else if multicolor_blend == "white" then masked_blend(
mask: "{folder}artifact_blend_{blend_type}.png",
dark: template("a"),
light: base()
)
else masked_blend(
mask: "{folder}artifact_blend_{blend_type}.png",
dark: template("a"),
light: masked_blend(
mask: "{folder}multicolor_blend_{blend_type}.png",
dark: template("c"),
light: base()
)
)
)
)
else if artifact and color_count > 1 and mask_hybrid_with_gold() then
(
if artifact_blend == "black" then template("a")
else if artifact_blend == "white" then
(
if multicolor_blend == "black" then template("m")
else if multicolor_blend == "white" then base()
else masked_blend(
mask: "{folder}multicolor_blend_{blend_type}.png",
dark: template("m"),
light: base()
)
)
else
(
if multicolor_blend == "black" then masked_blend(
mask: "{folder}artifact_blend_{blend_type}.png",
dark: template("a"),
light: template("m")
)
else if multicolor_blend == "white" then masked_blend(
mask: "{folder}artifact_blend_{blend_type}.png",
dark: template("a"),
light: base()
)
else masked_blend(
mask: "{folder}artifact_blend_{blend_type}.png",
dark: template("a"),
light: masked_blend(
mask: "{folder}multicolor_blend_{blend_type}.png",
dark: template("m"),
light: base()
)
)
)
)
else if artifact then
(
if artifact_blend == "black" then template("a")
else if artifact_blend == "white" then base()
else masked_blend(
mask: "{folder}artifact_blend_{blend_type}.png",
dark: template("a"),
light: base(),
)
)
else if color_count > 1 and mask_hybrid_with_land() then
(
if hybrid_blend == "black" then land_template("c")
else if hybrid_blend == "white" then base()
else masked_blend(
mask: "{folder}hybrid_blend_{blend_type}.png",
dark: land_template("c"),
light: base(),
)
)
else if color_count > 1 and mask_hybrid_with_gold() then
(
if hybrid_blend == "black" then land_template("m")
else if hybrid_blend == "white" then base()
else masked_blend(
mask: "{folder}hybrid_blend_{blend_type}.png",
dark: land_template("m"),
light: base(),
)
)
else base()
## if we have a mode, blend that, otherwise use our base gradient
if mode == "" then base() else conditional_masked_blend()
}@(folder: "", blend_type:"")
conditional_masked_blend :=
{
mask := "{folder}{mode}_blend_{blend_type}.png"
mode := if mode == "multicolor" then multicolor_blend
else if mode == "artifact" then artifact_blend
else hybrid_blend
if mode == "black" then dark(dark_input)
else if mode == "white" then light(light_input)
else masked_blend(
mask: mask,
dark: dark(dark_input),
light: light(light_input),
)
}
########################################################################
# Specific types
########################################################################