πŸ”§ TCL GLYPH DIFFICULTY: Apprentice Structural

The Decorator

Attaches additional arcane properties to an object dynamically.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Decorator
ARCANUM SCHOOL: Enchantment // Augmentation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// TCL PATTERN //
oo::class create BaseArmor {
    method defend {} { return 10 }
    method describe {} { return "Standard Leather" }
}

oo::class create ArmorDecorator {
    variable armor
    constructor {a} { set armor $a }
    method defend {} { return [$armor defend] }
    method describe {} { return [$armor describe] }
}

oo::class create CyberPlating {
    superclass ArmorDecorator
    method defend {} { return [expr {[$armor defend] + 15}] }
    method describe {} { return "[$armor describe] with Neon Cyber-Plating" }
}

set myArmor [BaseArmor new]
set myArmor [CyberPlating new $myArmor]

puts "Armor: [$myArmor describe]"
puts "Defense: [$myArmor defend]"

The Decorator

Sometimes a ward needs a little extra kickβ€”a sudden injection of volatile mana or a stealth coating of void-stuff. The Decorator layers these enchantments dynamically at runtime, stacking protective matrices around the core payload without mutating its original structure.

Runic Tags: #structural #decorator #enchantment #augmentation