The Strategy of Combat Multipliers
Define a family of algorithms, encapsulate each one, and make them interchangeable in Move.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Divination // Tactics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
module arcane::strategy {
struct AttackStrategy has drop {
multiplier: u64,
base_damage: u64,
}
public fun create_aggressive(): AttackStrategy {
AttackStrategy { multiplier: 2, base_damage: 10 }
}
public fun create_defensive(): AttackStrategy {
AttackStrategy { multiplier: 1, base_damage: 5 }
}
public fun execute(strategy: &AttackStrategy): u64 {
strategy.multiplier * strategy.base_damage
}
}
Runic Tags:
#behavioral
#strategy
#move
#tactics