The Observer of the Scrying Orb
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Observer
ARCANUM SCHOOL: Divination // Scrying
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FOXPRO PATTERN //
DEFINE CLASS ScryingOrb AS Custom
DIMENSION aWatchers[1]
nWatcherCount = 0
cDarkOmen = ""
PROCEDURE Attach(oWatcher)
THIS.nWatcherCount = THIS.nWatcherCount + 1
DIMENSION THIS.aWatchers[THIS.nWatcherCount]
THIS.aWatchers[THIS.nWatcherCount] = oWatcher
ENDPROC
PROCEDURE RevealOmen(cOmen)
THIS.cDarkOmen = cOmen
THIS.NotifyWatchers()
ENDPROC
PROCEDURE NotifyWatchers()
LOCAL i
FOR i = 1 TO THIS.nWatcherCount
THIS.aWatchers[i].Update(THIS.cDarkOmen)
ENDFOR
ENDPROC
ENDDEFINE
DEFINE CLASS CultistWatcher AS Custom
PROCEDURE Update(cOmen)
? "The cultist trembles as the orb reveals: " + cOmen
ENDPROC
ENDDEFINE
The Scrying Orb pulses with dark energy. Rather than having the cultists constantly poll the orb for visions, they bind their consciousness to it. When the omen shifts, the Orb broadcasts the terror to all its dependents instantly.
Runic Tags:
#behavioral
#observer
#pub-sub
#events