🦊 FOXPRO APPARITION DIFFICULTY: Adept Behavioral

The Chain of Responsibility of the Underworld Judges

Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Chain of Responsibility
ARCANUM SCHOOL: Enchantment // Command Delegation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FOXPRO PATTERN //
DEFINE CLASS UnderworldJudge AS Custom
    oNextJudge = .NULL.

    PROCEDURE SetNext(oJudge)
        THIS.oNextJudge = oJudge
    ENDPROC

    PROCEDURE JudgeSoul(nSins)
        IF !ISNULL(THIS.oNextJudge)
            THIS.oNextJudge.JudgeSoul(nSins)
        ENDIF
    ENDPROC
ENDDEFINE

DEFINE CLASS LesserDemon AS UnderworldJudge
    PROCEDURE JudgeSoul(nSins)
        IF nSins < 10
            ? "Lesser Demon claims the soul for the salt mines."
        ELSE
            DODEFAULT(nSins)
        ENDIF
    ENDPROC
ENDDEFINE

DEFINE CLASS Archfiend AS UnderworldJudge
    PROCEDURE JudgeSoul(nSins)
        IF nSins >= 10
            ? "Archfiend drags the heavy soul into the abyss."
        ELSE
            DODEFAULT(nSins)
        ENDIF
    ENDPROC
ENDDEFINE

The incoming soul drifts down the chain of Underworld Judges. Each judge inspects the entity, deciding whether to devour it or pass it deeper into the abyss. The summoner need not know which entity will ultimately claim the request.

Runic Tags: #behavioral #chain-of-responsibility #delegation