The Strategy
Selecting the optimal method of ritual execution at runtime, swapping between slow bleeding and explosive exsanguination.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Divination // Tactics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// DYNAMIC RUBY BLOOD MAGIC //
class ExsanguinationStrategy
def execute_ritual(victim)
"Explosively violently draining all blood from #{victim}."
end
end
class SlowBleedStrategy
def execute_ritual(victim)
"Methodically draining vitae drop by drop from #{victim}."
end
end
class RitualCaster
attr_writer :strategy
def initialize(strategy)
@strategy = strategy
end
def perform(victim)
@strategy.execute_ritual(victim)
end
end
# Usage:
# caster = RitualCaster.new(SlowBleedStrategy.new)
# caster.perform("The Paladin")
# caster.strategy = ExsanguinationStrategy.new
# caster.perform("The Cleric")
The Strategy pattern defines a family of algorithms, encapsulates them, and makes them interchangeable. A hemomancer can alter their methodology mid-ritual without changing the core casting mechanics.
Runic Tags:
#ruby
#design-pattern
#strategy
#blood-magic