✨ ARCANUM RUNE DIFFICULTY: Adept Behavioral

The Phantom Chain of Responsibility

Pass a mortal's input command along a chain of waiting poltergeists until one decides to intercept and haunt it.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Chain of Responsibility
ARCANUM SCHOOL: Enchantment // Command Relay
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
class SpiritHandler {
    __New(next_handler := "") {
        this.next_handler := next_handler
    }
    Handle(command) {
        if (this.next_handler != "") {
            this.next_handler.Handle(command)
        }
    }
}

class NotepadHaunter extends SpiritHandler {
    Handle(command) {
        if (command == "WRITE") {
            Run("notepad.exe")
            Sleep(200)
            Send("A ghost wrote this.")
        } else {
            super.Handle(command)
        }
    }
}

class BrowserHaunter extends SpiritHandler {
    Handle(command) {
        if (command == "SEARCH") {
            Run("https://google.com")
        } else {
            super.Handle(command)
        }
    }
}

chain := NotepadHaunter(BrowserHaunter())
chain.Handle("SEARCH")
Runic Tags: #autohotkey #chain-of-responsibility #automation #poltergeist