✨ ARCANUM RUNE DIFFICULTY: Adept Structural

The Adapter Translation Glyph

Adapts an incompatible arcane interface to a required one using effect mapping.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Adapter
ARCANUM SCHOOL: Transmutation // Alteration
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
effect old-magic
  ctl cast-fireball(power: int) : string

effect modern-magic
  ctl invoke-flame(intensity: int, duration: int) : string

fun adapter(action: () -> <modern-magic|e> a) : <old-magic|e> a
  with handler
    ctl invoke-flame(i, d) resume(cast-fireball(i * d))
  action()

pub fun main()
  with handler
    ctl cast-fireball(p) resume("Fireball hits for " ++ p.show ++ " damage!")
  with adapter
  println(invoke-flame(5, 2))
Runic Tags: #koka #adapter #effect-mapping