✨ ARCANUM RUNE DIFFICULTY: Apprentice Behavioral

Observer for Sprite Enchantment

Allow mystical runes to react passively when the grand magical focus shifts.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Observer
ARCANUM SCHOOL: Divination // Sprite Enchantment
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
function MagicFocus() constructor {
    observers = [];
    element = "none";
    
    static subscribe = function(_observer) { array_push(observers, _observer); };
    
    static set_element = function(_new_element) {
        element = _new_element;
        for (var i = 0; i < array_length(observers); i++) {
            observers[i].on_element_changed(element);
        }
    };
}

function ReactiveSprite() constructor {
    static on_element_changed = function(_element) {
        if (_element == "fire") image_blend = c_red;
        if (_element == "ice") image_blend = c_aqua;
    };
}

The Observer pattern relies on a central scrying focus. Sprites, standing silently in the void, subscribe to this focus. When the Grand Magus declares an elemental shift, the focus broadcasts the tremor, and all attuned sprites instantly alter their hues in harmonious synchrony.

Runic Tags: #gml #behavioral #observer