🐎 PONY WARD DIFFICULTY: Apprentice Behavioral

The State Ward

Morphing behaviors based on arcane phases.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: State
ARCANUM SCHOOL: Transmutation // Phase Shifting
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// PONY PATTERN //
trait val ElementalState
  fun attack(): String val

class val FireState is ElementalState
  fun attack(): String val => "Burn!"

class Golem
  var _state: ElementalState val
  new create() => _state = EarthState
  fun ref shift(s: ElementalState val) => _state = s

The State Ward

State instances can be cleanly implemented as interchangeable val objects, allowing rapid shifting between behavioral modes.

Runic Tags: #pony #state