✨ ARCANUM RUNE DIFFICULTY: Adept Creational

The Abstract Factory of the Ancestral Void

Conjure families of related void-artifacts without specifying their concrete structures.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Voidmancy
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
GET "libhdr"

// The Void Interface
MANIFEST $(
  VOID_CREATE_WEAPON = 0
  VOID_CREATE_ARMOR = 1
$)

// Concrete Factories
LET AbyssalFactory(op) = VALOF $(
  SWITCHON op INTO $(
    CASE VOID_CREATE_WEAPON: RESULTIS "Abyssal Blade"
    CASE VOID_CREATE_ARMOR:  RESULTIS "Abyssal Plating"
    DEFAULT: RESULTIS "Nothing"
  $)
$)

LET AstralFactory(op) = VALOF $(
  SWITCHON op INTO $(
    CASE VOID_CREATE_WEAPON: RESULTIS "Astral Spear"
    CASE VOID_CREATE_ARMOR:  RESULTIS "Astral Aegis"
    DEFAULT: RESULTIS "Nothing"
  $)
$)

// Client Conjuration
LET ConjureGear(factory) BE $(
  LET weapon = factory(VOID_CREATE_WEAPON)
  LET armor = factory(VOID_CREATE_ARMOR)
  writef("Conjured Weapon: %s*n", weapon)
  writef("Conjured Armor: %s*n", armor)
$)

LET START() BE $(
  writef("--- Abyssal Conjuration ---*n")
  ConjureGear(AbyssalFactory)
  writef("--- Astral Conjuration ---*n")
  ConjureGear(AstralFactory)
$)
Runic Tags: #abstract-factory #void #conjuration