✨ ARCANUM RUNE DIFFICULTY: Adept Behavioral

Command for Sprite Enchantment

Encapsulate an enchantment request as an object to be executed or undone.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Evocation // Sprite Enchantment
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
function EnchantmentCommand() constructor {
    static execute = function() {};
    static undo = function() {};
}

function ColorShiftCommand(_sprite, _new_color) : EnchantmentCommand() constructor {
    target_sprite = _sprite;
    new_color = _new_color;
    old_color = _sprite.color;
    
    static execute = function() {
        target_sprite.color = new_color;
    };
    
    static undo = function() {
        target_sprite.color = old_color;
    };
}

The Command transforms an ethereal verb into a tangible noun. By encapsulating a color shift or scaling spell within a command artifact, a chronomancer can safely queue, delay, or perfectly invert enchantments cast upon a sprite.

Runic Tags: #gml #behavioral #command