♦️ RUBY ENCHANTMENTS DIFFICULTY: Adept Behavioral

The State

A cursed lycanthrope whose behavior fundamentally shifts depending on the phase of the blood moon.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: State
ARCANUM SCHOOL: Transmutation // Shapeshifting
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// DYNAMIC RUBY BLOOD MAGIC //
class HumanState
  def attack
    "Punches weakly."
  end
end

class WolfState
  def attack
    "Tears out your throat with fangs!"
  end
end

class Lycanthrope
  attr_accessor :state

  def initialize
    @state = HumanState.new
  end

  def look_at_moon(is_full)
    @state = is_full ? WolfState.new : HumanState.new
  end

  def strike
    @state.attack
  end
end

The State pattern allows an object to alter its behavior when its internal state changes. The Lycanthrope delegates its attack method to its current state object, seamlessly transmuting from a frail human to a bloodthirsty beast.

Runic Tags: #ruby #design-pattern #state #blood-magic