The Abstract Factory Incantation
A planar sigil for manifesting coherent families of elementals without binding to concrete elemental planes.
β§ GANG OF FOUR LINEAGE & ARCANUM β§
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Planar Binding
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SCALA PATTERN //
sealed trait Elemental
case class FireElemental(power: Int) extends Elemental
case class WaterElemental(power: Int) extends Elemental
trait ElementalFactory {
def summonBasic(): Elemental
def summonGreater(): Elemental
}
class FirePlaneFactory extends ElementalFactory {
override def summonBasic(): Elemental = FireElemental(10)
override def summonGreater(): Elemental = FireElemental(100)
}
class WaterPlaneFactory extends ElementalFactory {
override def summonBasic(): Elemental = WaterElemental(10)
override def summonGreater(): Elemental = WaterElemental(100)
}
object PlanarSummoner {
def weave(factory: ElementalFactory): List[Elemental] = {
List(factory.summonBasic(), factory.summonGreater())
}
}
The Abstract Factory isolates the pure functional magic of manifestation from the chaotic details of elemental origin. By leveraging Scalaβs powerful trait system, a thaumaturge ensures type-safe manifestations.
Runic Tags:
#scala
#creational
#pure-functional
#conjuration