Documentation
¶
Overview ¶
Package composition prices what a squad shares.
A composition bonus is a grant a side receives for fielding several units that have something in common — today one thing, the element they carry — and it is a **drafting** decision rather than a tactic: the count is taken once, from the roster a battle opens with, and never again. Nothing that happens on the board can take one away or hand one over, so focusing the odd unit out does not strip a bonus and a summon does not earn one.
The package is a pure function of what it is handed, like every core package but battle. It counts, it decides which rung a count reaches, and it says who receives what. Applying the grant is the caller's, because a status set is state and this has none.
⚠️ **The count is walked in slice order and never over a map.** Ordering a result by ranging over a map is the one thing this repository's layer rule names outright: Go randomises that order and a battle would stop replaying from its seed. Values are collected in the order they are first met, which is a fact about the roster rather than about a hash.
Index ¶
Constants ¶
const MinimumRung = 2
MinimumRung is the smallest count that can be a threshold.
Two, because one unit shares nothing with anybody: a rung of one would fire for every squad in the game and is a change to the base numbers wearing a threshold, which is the trap the origin axis is held out of the data for.
Variables ¶
This section is empty.
Functions ¶
func ColumnValue ¶
ColumnValue is the name a column is counted and logged under.
Named rather than the bare number, because the value reaches a log line and a screen through the same slot an element's name does: "three of 2" is a sentence nobody can read, and a reader who cannot tell which axis a bonus counted cannot reproduce it from the data.
Exported because the gloss table has to be checkable against it. A test that wrote "column" + itoa itself would be a second copy of this rule, and the two would agree right up until the day one of them changed.
Types ¶
type Award ¶
Award is one unit's share of one bonus that fired.
It carries the value and the count as well as the grants, because a log line and a screen both have to be able to say *why* a unit is carrying something — "three of water" is the whole explanation, and a grant on its own is a buff with no account of where it came from.
type Axis ¶
type Axis int
Axis is the thing a bonus counts.
It is an enum rather than a string so an unknown axis is refused at parse instead of counting nothing at run time — a bonus whose axis nobody implements would otherwise load, draw, and quietly never fire.
const ( // AxisNone is the zero value and is never a legal axis, so a bonus that // forgot to declare one is refused rather than defaulting into whichever // axis happens to be first. AxisNone Axis = iota // AxisElement counts the elements the fielded units carry. // // ⚠️ **Its ceiling is the CAST's carrier count now, not the format.** Until // ENG-013 opened 5v5 a rung above three was unreachable because a side was // three units; it is the cast that stops one now, and the two are different // bounds with different remedies. Counted the way the reachability tests // count it — a character counts for every element any of its forms can be // fielded carrying — the deepest tribes on 2026-09-09 are ground and water at // four each, and nothing reaches five. So a rung at four is authorable for // exactly two elements and a rung at five for none, and the way to move that // is to ship a carrier rather than to widen a format. Contrast AxisColumn // below, whose ceiling is the board and can never move at all. AxisElement // AxisColumn counts the formation column the fielded units stand in. // // ⚠️ **It is where a unit STANDS, not the column its archetype prefers**, and // that distinction decided the whole shape of this axis. The roadmap named the // archetype's column as the best-shaped candidate on reachability alone; the // engine cannot see it. Roster carries no archetype on purpose — "settled // before a battle and leaves nothing behind but numbers" — so counting the // preset would have meant widening the roster, the wire and every log, to say // something weaker than what the slot already says. // // The slot is the better half of the same idea anyway. An archetype's column // is where a character *wants* to stand; the slot is where the player *put* // it, which is the decision a composition bonus is supposed to reward. // // ⚠️ **Rungs above three are unreachable here and always will be.** A column // holds hex.FormationRows units and that is a property of the board rather // than of the format, so this is not the "wait for 5v5" case the element axis // has: a fourth rung on a column would be dead on every board this game has. AxisColumn )
type Bonus ¶
type Bonus struct {
ID string
// Name is the authored display name, opaque text to this package exactly as
// a skill's and a trait's are. Absent is a real answer and renders as the id.
Name string
Axis Axis
Scope Scope
// Value is the one value on the axis this bonus counts, or empty for all of
// them.
//
// ⚠️ **Empty is a real answer, and it is the older one — but nothing ships on
// it any more.** The unnamed form counts whichever value a side happens to
// share and hands out the same grant for any of them; a bonus naming a value
// is the narrower shape — "three of WATER heal better" — and the two are
// different designs rather than one with a default. `same_element` was the
// unnamed one, and it was retired once the per-element table covered all eight
// fieldable elements, because a table that says what each tribe is FOR and a
// blanket that says only that sharing is worth something both paying at once
// is two answers to one question. The shape stays because it is a design and
// not scaffolding — a future axis may well want it — and this package's own
// tests are what keep it alive.
//
// It is checked against the axis at parse: an element that is not on the chart
// is a bonus that could never fire, and a bonus that can never fire loads,
// draws and is silently dead — the one failure this package's Axis enum exists
// to prevent.
Value string
// Rungs are ascending by At, with no two the same. A count reaches at most
// one of them — the highest it satisfies — because rungs are a ladder rather
// than a set: three units sharing an element are not also two units sharing
// it a second time, and a cumulative reading would make the top rung's real
// value the sum of a table nobody wrote down.
Rungs []Rung
}
Bonus is one rule about what a squad shares.
type Book ¶
type Book struct {
// contains filtered or unexported fields
}
Book is the declared bonuses, in declaration order.
func (*Book) Awards ¶
Awards is what one side receives for what it brought.
The members are one side's units in roster order, and every list this returns is ordered by that slice and by the book's own declaration order — never by a map walk. A nil book awards nothing, which is what lets a battle run without the file.
⚠️ **An inert element forms no tribe.** Sharing the element that has no strengths and no weaknesses is sharing the absence of one, and a bonus for it would be handed to any pair of unaligned characters for standing next to each other. Which elements those are is read off the chart rather than named here, so a chart that gives the inert element a matchup makes it count without this file being edited.
func (*Book) Without ¶
Without is the same book with the named bonuses taken out, and it is the pricing instrument rather than a convenience.
Nothing about a bonus can be measured until it can be turned **off**: the two obvious controls are both already known to measure something else — swapping a member measures the member, and putting the same bonus on both sides cancels it exactly. What is left is the same squad, the same members and the same seeds with one bonus gone, which is what this hands a caller.
⚠️ **A set rather than a switch.** Bonuses stack, so a global off measures *the system* and can never price one rung; taking one out leaves the board the other bonuses actually make, which is the board the rung is played on.
⚠️ **No formation the game ships gives this instrument a board to work on.** DAT-008 Run A took two bonuses out and every field came back identical on every pairing forge.FightSquads fights, because the whole ten-bonus table reaches nothing on any of the five squads or either roster half. A switch that changes nothing prices nothing, so a figure taken through here today came off a squad built to hold the bonus and has to be quoted with that squad named. → docs/balance.md § "Every composition-bonus figure is a probe reading, and its squad has to be named", and TODO.md DAT-010.
An id nobody declares is not an error. A caller naming one is asking for a book without it, and a book without it is what comes back.
type Deps ¶
Deps are the books a bonus is checked against.
The statuses, because a grant names one; the chart, because a rung counts elements. Both are required at parse for the reason a skill's pattern and status names are: a bonus naming something that does not exist fails at load rather than at the moment it would have mattered.
type Grant ¶
Grant is one status a rung hands out.
It is deliberately the same shape a trait's grant is, minus the quantity: a trait can grant a pool whose depth is a share of its holder's stat line, and a composition bonus may not, because the units receiving one do not share a stat line. A bonus that wants to be worth more says so with another stack or another status.
type Member ¶
type Member struct {
ID string
Affinity element.Affinity
// Column is the formation column the unit was placed in, from its own side's
// point of view — the authored slot rather than the cell on the shared board,
// so the two sides count the same shape as the same shape.
Column int
}
Member is one fielded unit, as much of it as counting needs.
An id, an affinity and a column, and nothing else: a bonus is settled before the first turn, where the roster is still a slice of facts rather than a board, and handing this package a battle unit would tie a counting rule to a state machine it must never read.
type Rung ¶
type Rung struct {
// At is how many units must share the value.
At int
// Grants is what each receiving unit is held. Never empty: a rung that
// grants nothing is a row in a table that a screen would draw and a battle
// would ignore.
Grants []Grant
}
Rung is one threshold and what reaching it gives.
type Scope ¶
type Scope int
Scope is who receives a bonus that has fired.
Both kinds ship, and a bonus declares which it is. They answer different questions: a squad-wide grant says the side is better arranged, a sharers-only grant says these units in particular back one another up, and a screen has to be able to tell a reader which of the two it is looking at.