Documentation
¶
Overview ¶
Package pattern holds the shapes an area skill covers.
A pattern is a primary cell plus a list of step chains leading away from it. The six hex directions have stable names, so a shape can be authored as "the primary and the cell above it" or "the primary and both cells deeper in" without the engine tracking facing.
⚠️ **The names are written in the ALLY's frame and a shape is walked in its CASTER's**, which is why every entry point takes the caster's side. The package used to say "an ally always faces east" and walk absolute steps for everybody, and the second half did not follow from the first: hex.Place puts the enemy half down under a 180 degree rotation, which maps up to down and right to left, so an enemy holding a shape called `pierce` spread it back towards the midline instead of through the formation, and `wedge_right` pointed at its own backline. The whole board stopped being its own mirror — measured on the shipped squads, a mirror match and its own reverse summed to 1119, 1153 and 1057 per mille where they must sum to 1000. → TODO.md ENG-012.
The walk is done in the caster's own frame by rotating into it and back out, rather than by naming a second set of directions: hex.Place is its own inverse, so conjugating the walk through it makes the two halves each other's reflection **by construction** rather than by a table somebody has to keep true.
Resolution drops any cell that falls off the board or onto the other half of the battlefield. A shape aimed at an enemy therefore never catches an ally, and a shape aimed at the edge of a formation covers fewer cells than one aimed at its middle. That is not an edge case to smooth over: it is the reason where a skill is aimed matters as much as which skill it is.
Index ¶
Constants ¶
const DirectionCount = int(LowerLeft) + 1
DirectionCount is the number of directions.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Book ¶
type Book struct {
// MaxTargets is the most cells any shape may cover.
MaxTargets int
// SplashPower is the share of a skill's power a splash cell takes, in parts
// per thousand. The primary always takes the full amount.
SplashPower int
// contains filtered or unexported fields
}
Book is a named collection of shapes plus the design limits they obey.
type Direction ¶
type Direction uint8
Direction is one of the six hex neighbours, named for the board's fixed orientation: columns run left to right and odd columns sit half a cell lower.
func Directions ¶
func Directions() []Direction
Directions returns every direction in declaration order.
func ParseDirection ¶
ParseDirection resolves a direction name as written in the data files.
type Pattern ¶
type Pattern struct {
Name string
// Splash holds one step chain per additional cell, each walked from the
// primary. A chain of one step is a neighbour; a chain of two reaches past
// it, which is how a shape can pierce into a formation rather than spread
// across it.
Splash [][]Direction
}
Pattern is one area shape: the primary cell plus a chain of steps for every splash cell.
func (Pattern) MaxTargets ¶
MaxTargets is how many cells the shape covers when nothing is dropped.
func (Pattern) Targets ¶
Targets returns the cells the shape covers when aimed at a primary, primary first. Cells off the board, cells on the other half of the battlefield, and duplicates are dropped, so the result can be shorter than MaxTargets.
caster is the side holding the skill, and it is the frame the steps are read in — not the side the primary belongs to. A shape spreads away from whoever cast it. → the package doc, on why that is a parameter rather than an assumption.
func (Pattern) TargetsAcross ¶
TargetsAcross is Targets for a skill aimed at both halves of the battlefield: the same shape, with the midline no longer stopping it.
It is a second entry point rather than a parameter on the first because the midline is the right bound for every skill that aims at one side, so the plain call has to stay the one that reads as ordinary. Both go through one walk, so there is no second copy of the geometry — only a second answer to the one question the two differ on. Which of them a caster gets is skill.Side's CrossesSides, not a decision made here: this package knows what a side is and nothing about what a skill aims at.