The Composite Hex Tree
Treating individual hexes and complex curses uniformly.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Composite
ARCANUM SCHOOL: Illusion // Phantasm
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// EIFFEL PATTERN //
deferred class
MAGIC_COMPONENT
feature -- Operations
trigger
deferred
end
end
class
COMPOSITE_CURSE
inherit
MAGIC_COMPONENT
create
make
feature -- Initialization
make
do
create children.make_empty
end
feature -- Access
children: ARRAYED_LIST [MAGIC_COMPONENT]
add_hex (h: MAGIC_COMPONENT)
require
hex_exists: h /= Void
do
children.extend (h)
end
trigger
do
across children as c loop
c.item.trigger
end
end
end
The Composite pattern lets you build a sprawling tree of curses, where an entire branch can be triggered as easily as a single cantrip.
Runic Tags:
#structural
#composite
#eiffel