⚙️ RAKU RUNE DIFFICULTY: Adept Behavioral

Memento

Capturing and restoring the precise state of a spell spanning a century.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Memento
ARCANUM SCHOOL: Chronomancy // Stasis
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// RAKU PATTERN //
class SpellMemento {
    has Int $.intensity;
    has Str $.phase;
}

class CenturySpell {
    has Int $.intensity is rw = 10;
    has Str $.phase is rw = "Initiation";
    
    method save-state(--> SpellMemento) {
        say "Preserving the spell state in amber... (Phase: $!phase)";
        return SpellMemento.new(intensity => $!intensity, phase => $!phase);
    }
    
    method restore-state(SpellMemento $m) {
        $!intensity = $m.intensity;
        $!phase = $m.phase;
        say "Spell state restored from amber... (Phase: $!phase)";
    }
    
    method mutate() {
        $!intensity += 50;
        $!phase = "Degradation";
        say "Spell mutated... (Phase: $!phase)";
    }
}

my $spell = CenturySpell.new;
my $memento = $spell.save-state();

$spell.mutate();

say "Something went wrong! Reverting to previous epoch...";
$spell.restore-state($memento);

A spell cast to endure a hundred years will likely face interference. The Memento pattern allows an Archmage to capture the internal state of the spell in a crystalline snapshot. If the magic begins to unravel or mutate dangerously, the spell can be cleanly reverted to its previously stable state without exposing its delicate internal variables.

Runic Tags: #behavioral #memento #raku #hundred-year-spell