Decorator
Dynamically attach new magical properties and modifiers to an existing spell without altering its fundamental structure.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Decorator
ARCANUM SCHOOL: Transmutation // Spell Modification
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// D PATTERN //
interface ICastable { int power(); }
class BaseSpell : ICastable {
override int power() { return 10; }
}
abstract class SpellModifier : ICastable {
protected ICastable baseCast;
this(ICastable b) { baseCast = b; }
override int power() { return baseCast.power(); }
}
class EmpowerModifier : SpellModifier {
this(ICastable b) { super(b); }
override int power() { return baseCast.power() + 5; }
}
Wrap enchantments in layers of volatile metaprogramming enhancements.
Runic Tags:
#structural
#decorator
#dlang
#augmentation