✨ ARCANUM RUNE DIFFICULTY: Apprentice Behavioral

Strategy for Sprite Enchantment

Interchange families of magical algorithms without disturbing the enchanted vessel.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Evocation // Sprite Enchantment
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
function RenderingStrategy() constructor {
    static draw = function(_sprite, _x, _y) {};
}

function GhostlyStrategy() : RenderingStrategy() constructor {
    static draw = function(_sprite, _x, _y) {
        draw_sprite_ext(_sprite, 0, _x, _y, 1, 1, 0, c_white, 0.3);
    };
}

function SolidStrategy() : RenderingStrategy() constructor {
    static draw = function(_sprite, _x, _y) {
        draw_sprite(_sprite, 0, _x, _y);
    };
}

function SpriteVessel(_strategy) constructor {
    strategy = _strategy;
    static render = function(_sprite, _x, _y) {
        strategy.draw(_sprite, _x, _y);
    };
}

The Strategy acts as a swappable grimoire. Instead of a single tome holding every known drawing method, a vessel accepts a specific manuscript at runtime—be it Ghostly or Solid—executing it to perfection without requiring the caster to rewrite the vessel’s soul.

Runic Tags: #gml #behavioral #strategy