The Strategy
Defines a family of combat algorithms, encapsulating each, and making them interchangeable at runtime.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Divination // Tactics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// TCL PATTERN //
oo::class create CombatTactic {
method execute {target} { error "Not implemented" }
}
oo::class create StealthHack {
superclass CombatTactic
method execute {target} { puts "Silently siphoning data from $target." }
}
oo::class create BruteForce {
superclass CombatTactic
method execute {target} { puts "Hammering $target's ICE with kinetic blasts." }
}
oo::class create AttackVector {
variable strategy
method setStrategy {s} { set strategy $s }
method assault {target} {
$strategy execute $target
}
}
set vector [AttackVector new]
$vector setStrategy [StealthHack new]
$vector assault "Corp Server"
$vector setStrategy [BruteForce new]
$vector assault "Security Node"
The Strategy
A true Tekromancer does not rely on a single vector of assault. The Strategy pattern detaches the algorithm from the invoker, allowing you to swap out your stealth protocol for a scorched-earth brute-force blast in the middle of execution based on environmental feedback.
Runic Tags:
#behavioral
#strategy
#tactics
#interchangeable