forge

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 33 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package forge, art: turning the picture a character names into pixels.

This is the only place in the repository that rasterises anything, and it is here for the same reason ImageExists is: internal/core may not read the filesystem, and a picture has to be read before it can be drawn. What comes back is an image and nothing more — how it reaches a screen is the front end's business, and a terminal and a graphical client answer that very differently.

Package forge is the authoring logic behind the cast: loading the books an author edits, turning a set of answers into a character, and reporting what is wrong with a data directory.

It holds no rules of its own. Every check it makes it makes by calling into internal/core/cast, internal/core/element, internal/core/skill or internal/core/progression, because a check that lived here would be a check the game's own load did not make. What it adds is the *sequence*: which question is asked before which, what a preset supplies, and what the write looks like on disk.

Why this may read and write the filesystem

internal/core may not touch the filesystem at all — its parsers take []byte so that loading the game cannot depend on a working directory — and internal/seed only ever reads the copy go:embed baked in, which has no directory to be relative to. Authoring is the one job that needs real files: it writes cast.json and origins.json back out, and it is the only place allowed to ask whether the art a character names is really there.

(This comment spells that directive "go:embed" inside a sentence on purpose. A comment line beginning with its real spelling is read by the compiler as a directive, and in this repository a stray one would be a real trap.)

Why it is a package rather than part of cmd/hexforge

Two front-ends author the same cast: cmd/hexforge, which is flags and prompts and therefore what a script and a pipe use, and cmd/hexforge-tui, which is a full-screen terminal program. Anything either of them restated would be a second copy of a rule, and this repository has already been bitten twice by exactly that — see "One source for a recorded string" and the kit-versus-affinity gap in CLAUDE.md. So the rule, the wording of its rejection, and the numbers behind a budget all live here, and a front-end only decides where on the screen to put them.

Index

Constants

View Source
const CensusSeeds = 6

CensusSeeds is how many battles a census fights each arrangement over when nobody says otherwise.

Small, because of what a census asserts: "was this slot ever used" needs one cast to answer yes, not a confident rate.

⚠️ **It is not as small as it can be, and the floor was measured rather than guessed.** At two seeds `machop.charge` reads `wrecking_swing` silent on all four boards — that skill is gated on five stacks of `heft` and `brace` grants them a battle at a time, so its gate is only crossed in a battle that runs long enough. A gated slot needs board TIME rather than more boards, which is exactly what a seed buys and what another opponent does not.

View Source
const DefaultApplicationChance = "1000"

DefaultApplicationChance is the chance a picked status is written at when nobody says otherwise: certain.

Power and accuracy deliberately have no default, because both are balance and a default writes a number nobody chose. This one is different only because something has to be written for the entry to parse at all, and it is on screen in a field the author is already looking at, with its percentage beside it. A status that always lands is also the ordinary case for the skills that carry one — a shield, a haste, a cleanse.

View Source
const DefaultDataDir = "internal/seed/data"

DefaultDataDir is where the game's own data lives, relative to the module root. Every front-end takes a flag for it so a scratch copy can be edited without touching the shipped files.

View Source
const MaxArtPixels = 240

MaxArtPixels bounds a single side of a rasterised picture.

A terminal can be resized to something enormous, and the cost of rasterising an SVG grows with the area rather than the side: the shipped art takes tens of milliseconds at a hundred pixels a side and a full second is not far away. A preview is redrawn on a keystroke, so the bound is what keeps it a preview.

Variables

View Source
var ErrNoDataDirectory = errors.New(
	"this library was built from the copy embedded in the binary, so it has no directory on disk")

ErrNoDataDirectory is what a library built from the embedded copy answers to every question that is really a question about a directory.

It is a sentinel rather than a message written at each site because callers have to be able to tell it apart from a directory that is merely broken: a front-end offering to write a character wants to say *this library cannot be written to at all*, and a permission error on cast.json is a different sentence about a different problem.

Functions

func AnyoneMayCarry

func AnyoneMayCarry(carried skill.Skill) bool

AnyoneMayCarry reports whether every character may take a skill: it is the common pool, and it is the shape a skill has by default.

Two conditions, and both are already the rule rather than a new one: skill.CanCarry demands a shared element only of a skill that has one, so a neutral skill is carryable by any affinity, and an absent restriction admits everybody. It lives here rather than being spelled out in a front-end so that "which skills can anybody take" has one answer for the picker, the listing and the prompt.

func ApplicationChances

func ApplicationChances(applications []skill.Application) string

ApplicationChances is just the percentages, in order, for a screen that has the list already and only needs it read out.

func ArtFiles

func ArtFiles(dir string) ([]string, error)

ArtFiles is every image under a data directory's assets folder, as the paths a character may name: relative to the data directory, slash separated, and only the ones cast.ValidateImagePath accepts.

It walks rather than lists, because the tree is authored: art is filed by origin, so assets/fixture/adept.svg is as ordinary as assets/hero.svg. Anything the parser would refuse is skipped rather than offered — a picker that can hand over a value the write then rejects is worse than a text field, which at least admits the author typed it.

The order is sorted rather than the order the filesystem hands over. This list reaches a screen, and directory order is not a promise any operating system makes: a chooser whose entries moved between runs would be one nobody could learn.

A missing assets folder is an empty list and not an error. A data directory is allowed to have no art yet, and what a front-end owes an author then is a field they can still fill in, not a refusal to draw the form. ⚠️ **An empty directory is a refusal and not an empty list**, which is the one place those two answers had to be told apart. filepath.Join("", "assets") is "assets", so an empty directory would have walked whatever assets folder sits in the process's working directory and offered its contents as this library's art — a picker handing over paths that belong to somebody else's data. The list-versus-refusal rule above is about a directory that exists and holds no art; this is about there being no directory to look in.

func CheckCarry

func CheckCarry(affinity element.Affinity, kit []skill.Skill) error

CheckCarry is CheckKit for the element alone, which is what an element answer is checked against: the id and the preset are settled elsewhere on the form and are refused there.

func CheckKit

func CheckKit(who Carrier, kit []skill.Skill) error

CheckKit reports the first skill in a kit the carrier may not use.

func CheckPresetKit

func CheckPresetKit(archetype string, kit []skill.Skill) error

CheckPresetKit reports why an archetype preset's kit could not hold one of its skills, or nil when it may hold all of them.

It is cast.resolveArchetype's three restriction rules brought forward, in the order that function applies them, exactly as CheckSkill brings forward resolveCharacter's five. There is no fourth: a preset may hold an origin-restricted skill, for the reason written down in resolveArchetype. The predicates are skill.Restriction's own, so this asks the same questions rather than asking equivalent ones.

The first two rules are one rule worth remembering: a skill kept for named characters or for a lineage cannot sit in a preset's kit at all, because a preset is the starting point for every character built from it, so the refusal would land on the author of the next character rather than on whoever narrowed the skill.

func CheckSkill

func CheckSkill(who Carrier, carried skill.Skill) error

CheckSkill reports why a carrier may not carry one skill, or nil when it may.

The element half is skill.WhyCannotCarry's judgement, which cast.ParseBook and battle.enlist also call, so this is only bringing the same answer forward: a wrong element should cost one line at the moment it is typed rather than the whole session at the moment it is saved. The other four are cast.ParseBook's alone — the engine has no archetype, no character identity, no species and no origin — and this brings those forward too, from the same predicates on skill.Restriction.

Every answer comes back as a typed error holding what it is about rather than a sentence, so a front-end can word it in the author's language without taking the rule apart again.

func DataDirectoryIsAbsent added in v0.3.1

func DataDirectoryIsAbsent(dir string) bool

DataDirectoryIsAbsent reports whether there is nothing at all at dir.

Anything that is there — a directory, or a file sitting where one should be — is not absent, and is left to Load to read and to refuse in its own words. This function's whole job is to be narrower than "the load failed".

func DemandSummary

func DemandSummary(kit []skill.Skill) string

DemandSummary is KitDemands as the English sentence cmd/hexforge prints.

func DescribeApplications

func DescribeApplications(applications []skill.Application) string

DescribeApplications is FormatApplications for a reader: the same list with each chance's percentage beside it.

It is deliberately a second function rather than an option on the first. FormatApplications' output is the syntax the authoring form is prefilled with and ParseApplications reads back, so a percentage inside it would stop the round trip and leave the form holding something it cannot parse.

func ElementNames

func ElementNames() []string

ElementNames is every declared element's name, in the order the enum declares them, which is what a chooser and an allowlist picker offer.

func FieldNames

func FieldNames() []string

FieldNames is every weighable field's name, sorted, which is what a flag's help line and a refusal both want.

func FirstUsable

func FirstUsable(*battle.Battle) battle.Chooser

FirstUsable takes the first option it can use, in kit order, and aims it at the first cell offered. It is what Suggest was before any pricing landed.

⚠️ **This is a ruler, not an opponent, and it may never be improved.** Every claim made about a rating in this repository is of the shape "Suggest beats FirstUsable by X permille over N seeds", and X is only comparable across the repository's history if the thing it is measured against never moves. A better FirstUsable would silently re-scale every figure ever quoted against it, and nothing would report the disagreement — the old numbers would simply become wrong. If a second, stronger baseline is wanted, add one beside this; do not sharpen this one.

func FormatApplications

func FormatApplications(applications []skill.Application) string

func FormatCurve

func FormatCurve(curve progression.Curve) string

FormatCurve is ParseCurve's inverse, which is what a prompt's default and a text field's starting content both have to be, so that accepting either reproduces the preset exactly.

func KitDemands

func KitDemands(kit []skill.Skill) []element.Element

KitDemands is the distinct non-neutral elements a kit insists on.

The demand is derived from the kit actually chosen, not from the preset, because the two differ the moment the kit is edited. skill.Demands is the derivation; this is where a front-end reaches it, so that "what does this kit need" has one answer for the prompt, the form and the check.

func ParseAffinity

func ParseAffinity(raw string) (element.Affinity, error)

ParseAffinity accepts what Affinity.String writes: one element name, or two separated by a slash.

func ParseCurve

func ParseCurve(raw string) (progression.Curve, error)

ParseCurve reads a "base:max" stat override.

func ParseElement

func ParseElement(raw string) (element.Element, error)

ParseElement reads one element name, which is what a chooser and a restriction list both hand over.

It is ParseAffinity's single-element half rather than a second reading of a name: an affinity is one element or two, and a skill's element is always one.

func ParseNumber

func ParseNumber(raw string) (int, error)

ParseNumber reads a whole number. An empty answer is zero, which is what every one of a skill's numbers means when it is left out of the file.

func ParseTarget

func ParseTarget(raw string) (skill.Side, error)

ParseTarget reads a targeting side by name, which is what the data files write and what --target takes.

func ParseYear

func ParseYear(raw string) (int, error)

ParseYear reads the year a work came out. An empty answer is a year nobody knows, which is a legal state for a work rather than a mistake.

func Percent

func Percent(permille int) string

func PercentInColumn

func PercentInColumn(permille int) string

FormatApplications is ParseApplications' inverse, which is what a prefilled field and a listing both need, so that accepting a field as it stands reproduces what was in it. Percent renders a parts-per-thousand figure as the percentage a reader actually thinks in: 850 becomes "85%".

The arithmetic stays integer, like everything else these numbers touch. A tenth is kept only when there is one, so an authored 855 reads "85.5%" while the shipped values, which are all multiples of ten, stay short.

It lives here rather than in either front-end because both show the same figure and a second copy would eventually round differently. PercentInColumn is Percent with the tenth always printed, which is what a table of the same figure needs and a sentence does not.

The two differ over exactly one thing and it is worth being explicit about: Percent drops a trailing zero because a sentence saying "85.0%" is a sentence with a decimal nobody asked for, while a column reading 50%, 100.0%, 39% is a column whose figures cannot be compared down the page. Same arithmetic, same sign handling, one decision apart.

func PlayerSquadsPath added in v0.2.0

func PlayerSquadsPath(configDir string) string

PlayerSquadsPath is where a player's own squads live under a configuration directory.

⚠️ **The configuration directory is a PARAMETER and is not read here.** That is the whole reason this function exists rather than an os.UserConfigDir call at the site that wants the path: that call reads the environment and resolves differently on every platform — $XDG_CONFIG_HOME, ~/Library/Application Support, %AppData% — so anything driving it would be measuring the machine the test happened to run on rather than the code. The binary resolves it once at its own edge and hands the answer down as a value; everything under that takes a path. It is the same arrangement as handing GOOS in rather than reading it.

An empty directory answers an empty path rather than a path relative to nowhere. os.UserConfigDir fails on a machine with no home, and the honest answer there is that there is no player file — not that there is one in whatever directory the program was started from.

func PresetSummary

func PresetSummary(preset cast.Archetype) string

PresetSummary is PresetFacts as the English line cmd/hexforge prints.

func ShapeDiagramCell

func ShapeDiagramCell() hex.Offset

ShapeDiagramCell is the cell a shape is illustrated from.

It is the middle of the enemy formation, and it is the only cell on that half where all six of the one-step directions stay on the board *and* on one side — which matters because Targets drops a cell that does either, so any other primary would draw some shape smaller than it is and blame the shape for the aim. Eight of the nine shipped shapes therefore draw in full.

The ninth is "pierce", whose second upper-right step leaves the board from here, so it draws two cells of its three. That is not a rendering artefact and must not be smoothed over: a two-step chain aimed near an edge really does lose its far cell, and Covered against Max is what says so on screen.

The alternative was the enemy frontline, {3, 1}, which draws pierce in full and collapses "wedge_left" to the primary alone, because both of its cells sit behind the frontline on the caster's own half. That is worse: a shape that draws identically to "single" reads as a shape that does nothing, where a shape drawing two cells of three reads as what it is. No cell draws all nine in full — pierce needs a primary at column 3 and wedge_left needs one at column 4 or beyond — so this is a choice between which one is short, not a choice about whether any is.

One drawing serves a skill aimed either way. The ally half's own middle, {1, 1}, is this cell under hex.Place's 180 degree rotation and has the same property, and every shipped shape covers the same number of cells from it — so an ally-aimed skill's shape is this picture mirrored, not a different picture. That is a consequence of the rotation existing rather than a coincidence, and TestTheShapeDiagramCellShowsTheMostOfEveryShape measures it, because it is the reason this is one cell and not one per side.

func ShortStat

func ShortStat(kind progression.Kind) string

ShortStat is the three letter label for a stat: a column heading in a table, a flag name on the command line, and a row label in a form.

These six labels are not translated, in any front-end, and that is a decision rather than an omission. They are the flag names cmd/hexforge takes (--hp, --atk) and the keys the data files are written with, so an author types them either way; translating the form's row label would leave a person reading "phòng thủ" on screen and needing "def" to act on it. They are also what the fixed-width columns were measured for — every one is three characters or fewer, which no translation of "defence" is.

func SplitList

func SplitList(raw string) []string

SplitList reads a comma separated answer, dropping empty entries so a trailing comma is a typo rather than an unnamed skill.

func SquadsOffered added in v0.2.0

func SquadsOffered(game, player []placement.Squad) []placement.Squad

SquadsOffered is the list a player picks from: the game's own sides with a player's own laid over the top.

⚠️ **Every id in the answer is unique, and that is correctness rather than tidiness.** A side is named by id wherever it is chosen — screen.Subject carries one and cmd/hexarena-tui turns it back into a row by walking the list for the first match — so two entries under one id is a reader pointing at the second and fielding the first. That is the failure this function exists to make impossible, and it is why the two lists are merged rather than concatenated.

**A player's side wins the id it shares.** Three answers were defensible and this is the one chosen:

  • *Refusing the clash* would be the loudest and is wrong for where the clash comes from. The obvious way to start a squad file is to copy the shipped one and change a number, which collides four times at once; and the game may ship an `s05` next year that a player already has, so a refusal would let the game's own data break a file it does not own.
  • *Namespacing* keeps both, at the cost of showing a player an id they did not write, in the file they wrote it in.
  • *The player's winning* is what every configuration file already does — what you wrote beats what shipped — and it costs only the shipped side of that id, which is the one the player chose to replace.

⚠️ **The choice is visible on screen rather than only in this comment.** Every side out of a player's file is marked where it is drawn — the squad catalogue's rows and the join screen's chooser — through screen.Context.PlayerSquad. A shadowed id is therefore a row that says whose it is rather than a silent substitution, and that mark is what stops "the player's wins" being the silent collision no answer here may be.

The game's order is kept and a shadowing side replaces its row **in place**, so the row a reader knew does not move the day they write a file; sides with new ids are appended in the order the player wrote them. Nothing here orders anything by ranging over a map.

func StageSummary

func StageSummary(character cast.Character) string

StageSummary writes an evolution line as the levels its stages take over at, which is the one thing a table cell has room for.

⚠️ **A line that forks is not a chain, and drawing it as one is a lie a table tells quietly.** Joining every stage with an arrow reads `Eevee@1 → Vaporeon@32 → Jolteon@32` — three forms one after another, when the last two are alternatives at one threshold. Children share a bracket instead:

Eevee@1 → (Vaporeon@32 | Jolteon@32 → Tempest@48)

A line that does not fork is unchanged, brackets and all: one child is drawn as the arrow it always was, so every shipped character reads exactly as before. The parentage comes from progression.Line.Parents rather than from the order of the file, because that rule lives in one place.

func SuggestedImage

func SuggestedImage(id string) string

SuggestedImage proposes where a character's art would live, following the id. It is only a default: any relative path ending .svg or .png is allowed.

func Suggesting

func Suggesting(fight *battle.Battle) battle.Chooser

Suggesting is the rating the game ships, as a Brain.

func TargetNames

func TargetNames() []string

TargetNames is every side a skill can aim at, by the names the data files write and --target takes, in the order the enum declares them.

Derived rather than listed, which is what lets a side be added in one place: the chooser on the form, the flag's usage and the prompt's all read this.

func TraitCarrierSummary

func TraitCarrierSummary(carriers []TraitCarrier) string

TraitCarrierSummary is those carriers as one scannable row, each token the character id with whatever gates its entry declares — the same shape UnlockSummary gives a learnset, read from the other end.

func UnlockSummary

func UnlockSummary(entries []cast.Unlock) string

UnlockSummary writes a learnset as the levels its entries come in at, in the same shape StageSummary writes an evolution line: `id@level`.

An entry unlocked at level one prints as a bare id. A gate everybody passes is not information, and printing `@1` on the common case would put a number on every line so that the one line with a real gate stopped standing out.

func UnlockSummaryAt

func UnlockSummaryAt(entries []cast.Unlock, level int) string

UnlockSummaryAt is the same list seen from a level: a gate is printed only while it is still ahead.

So the row changes as a level is walked — `endurance@16` at level 8 and a bare `endurance` at 24 — and the mark reads as "not yet" rather than as a fact about the trait. A screen that showed every gate at every level would say the same thing at level 1 and at the cap, which is the one thing a level slider is for finding out.

func ValidateCurve

func ValidateCurve(kind progression.Kind, answer string) error

ValidateCurve rejects a "base:max" answer that will not parse or will not fit the stat it is for.

func ValidateImage

func ValidateImage(image string) error

ValidateImage rejects an art path that is not well shaped. Whether the file is really there is a different question, and Library.ImageExists is the one that asks it.

func ValidateName

func ValidateName(name string) error

ValidateName rejects a character with nothing to be called.

func WhoMaySummary

func WhoMaySummary(carried skill.Skill) string

WhoMaySummary is WhoMayCarry as the English cmd/hexforge prints.

Types

type AffinityCountError

type AffinityCountError struct {
	Raw   string
	Count int
}

AffinityCountError is an answer listing more elements than an affinity holds.

func (*AffinityCountError) Error

func (e *AffinityCountError) Error() string

type AffinityReason

type AffinityReason int

AffinityReason is why the chart refused a pairing, classified only so a front-end can pick a sentence for it.

The refusal itself is element.Chart.ValidateAffinity's, and this is never consulted to decide one: the chart has already said no by the time a reason is filled in. An outcome the chart grows later that this does not recognise arrives as AffinityReasonUnclassified, and a front-end falls back to the chart's own words rather than inventing a wrong explanation.

const (
	AffinityReasonUnclassified AffinityReason = iota
	// AffinityReasonUndeclared is an affinity holding an element the chart has
	// never heard of.
	AffinityReasonUndeclared
	// AffinityReasonCounters is a pairing of two elements that already counter
	// each other.
	AffinityReasonCounters
)

type AffinityRefusedError

type AffinityRefusedError struct {
	Affinity element.Affinity
	Reason   AffinityReason
	Err      error
}

AffinityRefusedError is an affinity the element chart will not allow.

func (*AffinityRefusedError) Error

func (e *AffinityRefusedError) Error() string

func (*AffinityRefusedError) Unwrap

func (e *AffinityRefusedError) Unwrap() error

type ApplicationShapeError

type ApplicationShapeError struct{ Raw string }

ApplicationShapeError is an inflicted-status entry that is not a status and a chance.

func (*ApplicationShapeError) Error

func (e *ApplicationShapeError) Error() string

type ArchetypeRestrictedError

type ArchetypeRestrictedError struct {
	Archetype string
	Skill     string
	Allowed   []string
}

ArchetypeRestrictedError is a kit holding a skill the preset it was tuned from may not use.

It is a refusal the engine can never make: a roster entry carries no archetype, so this rule lives entirely where a character is authored.

func (*ArchetypeRestrictedError) Error

func (e *ArchetypeRestrictedError) Error() string

type ArtReport

type ArtReport struct {
	// Stage is the form the picture belongs to, empty for the character's own.
	Stage string
	Image string
	// Exists is the question internal/core/cast is not allowed to ask. The
	// parser has already agreed the path is well shaped; only a program that
	// may read the filesystem can say whether the art is really there.
	Exists bool
}

ArtReport is one of a character's pictures and whether it is really there.

type BoutReport

type BoutReport struct {
	Seeds int
	Band  int

	Challenger Tally
	Incumbent  Tally

	// Turns is the median length of a decided battle, and it belongs beside the
	// rate rather than under it. A rating that wins no more often but finishes
	// sooner has still improved, and two ratings that have both improved make a
	// battle longer — so a rate that did not move over turns that did is a
	// result, not a null one.
	Turns int

	// Roster is the board the figure was taken on, carried so that a reader is
	// never left to guess which one it was.
	Roster []battle.Roster
}

BoutReport is what a head-to-head came to.

Challenger and Incumbent are the two sides of the same battles, so one's wins are the other's losses and a reader may check the report against itself. Band is the two-sigma width of the rate at this many seeds: a Challenger rate inside `500 ± Band` is not a finding.

func Bout

func Bout(books battle.Books, roster []battle.Roster, challenger, incumbent Brain, seeds int) (BoutReport, error)

Bout fights two ratings against each other over the given roster and reports the challenger's share.

What it is

Every seed is fought twice: once with the challenger driving the ally squad and the incumbent driving the enemy, and once with the two exchanged. Both halves run the same seeds, and the challenger's wins are counted over all 2N battles. What is left when the board has been fought from both ends is the difference between the two ratings, and it is read as a deviation from an even split.

The control is exact, not statistical

When the two Brains are the same, the two arrangements are the *same battle* — identical seed, identical roster, identical decisions — so they produce the same winner, and the challenger holds the winning side in exactly one of the two. Over N seeds that is N wins and N losses: **exactly 500‰, by construction**. A draw is counted half to each side and lands in both arrangements, so it does not disturb it either.

So Bout runs that control before it measures anything and refuses to print a figure unless it comes out exactly even. ⚠️ It is asserted **at exactly 500‰ and never within a band** — a band is what a leak would hide behind, and a harness that is allowed to be nearly even is a harness that cannot tell a real edge from its own bookkeeping.

Why the roster does not have to be symmetric

The board's asymmetry is fought from both ends and cancels exactly — that is the whole content of the paragraph above. So this measures on the **shipped** roster, which is the board every other figure in this repository is quoted on, rather than on a mirror built to be fair.

⚠️ CLAUDE.md bans a mirror roster, and that ban is about a **data** change — it says the shipped cast may not be flattened into two copies of itself to make a number easier to read. It does not apply here: nothing is authored, the roster is a parameter, and the mirror is in the *procedure* rather than in the data.

What it accepts

⚠️ **Roll drift.** The two arrangements share one *rng.Source per battle, so the first decision the two ratings disagree on re-scrambles every draw after it. It **biases nothing** — both arrangements fight the same seeds — and fixing it would mean an internal/core change to make a measurement prettier. This is the same note Weigh carries; see docs/balance.md § Pricing one number.

The roster is a parameter rather than read from internal/seed, so that this package keeps not importing that one: a tool that measured the embedded copy would keep reporting on the cast as it was at the last build.

func (BoutReport) Rate

func (r BoutReport) Rate() int

Rate is the challenger's share in parts per thousand.

type Brain

type Brain func(*battle.Battle) battle.Chooser

Brain builds a Chooser for one battle, because a Chooser closes over the battle it decides in.

battle.Suggest is a method on a *Battle, so "a rating" is not a value until a battle exists to bind it to. A Brain is that binding made a type, which is what lets a caller name two ratings before either has a board to play on.

type BrokenCarrier

type BrokenCarrier int

BrokenCarrier is which kind of carrier an edit would break.

The two are not interchangeable in a refusal: a character is one unit an author can retune, and a preset is the starting point for every character built from it, so the same edit is a smaller problem in the first case than in the second.

const (
	// BrokenCharacter is an authored character that would stop being able to
	// carry the skill.
	BrokenCharacter BrokenCarrier = iota
	// BrokenPreset is an archetype preset whose kit would stop being legal.
	BrokenPreset
)

type Budget

type Budget struct {
	Effective int64
	Max       int64
	Headroom  int64
	// Pierced is what the same line absorbs against damage that ignores its
	// defence outright, which comes to exactly its health.
	//
	// It is here because Effective stopped being the whole answer the moment
	// piercing existed: it measures durability against damage that does not
	// pierce, which is what the bound is set against, and a row showing only
	// that figure would be describing the best case as though it were the only
	// one. The two together are the range a stat line really sits in, and the
	// gap between them is how much of its durability an author bought with
	// armour rather than with health.
	Pierced int64
}

Budget is what a stat line spends of the joint health-and-defence bound.

The two multiply rather than add, so this is the limit an author walks into without noticing, and it is worth a number on screen rather than a rejection at the end. Headroom is negative exactly when the line is over budget.

func (Budget) Over

func (b Budget) Over() bool

Over reports whether the line breaks the bound.

type Carrier

type Carrier struct {
	ID          string
	Archetype   string
	Affinity    element.Affinity
	HasAffinity bool
	// Species is what the character is. An empty list is unanswered here, which
	// is the one place this axis cannot be checked as strictly as the parser
	// checks it: to cast.ParseBook an empty list is a real answer and a lineage
	// skill refuses it, while on a half-filled form it is a question nobody has
	// reached yet. The form takes the second reading, so a lineage skill picked
	// before a species is settled is refused at the write rather than at the
	// keystroke -- and picked after it, at the keystroke.
	Species []string
	// Origin is the work the character was borrowed from, and is unanswered
	// while it is empty for the reason Species is: on a half-filled form it is
	// a question nobody has reached, not an answer of "from nowhere".
	Origin string
}

Carrier is who a kit is being checked for: the four facts a skill's restriction can name.

Each one may be unanswered, and an unanswered fact restricts nothing. That is what lets the kit be filled in before the element or after it: whichever the author settles first constrains the other, and the second is checked against the first as soon as it exists. An empty id and an empty archetype are unanswered by being empty; an affinity cannot be, because the zero value is a legal neutral affinity, so HasAffinity says whether one was given.

type CarrierRow

type CarrierRow struct {
	// Carrier is the character id. It is here rather than read off the report
	// because a refused row has no report to read it from.
	Carrier string
	// Report is the weighing, and is the zero value when Err is set.
	Report WeighReport
	Err    error
}

CarrierRow is one carrier's whole weighing, or the refusal that stands where its figures would be.

A refusal is a field on the row rather than an error returned from the sweep, because a carrier that cannot be priced is a *fact about that carrier* and not a fault in the run. The workflow this replaces was seven invocations and a shell loop, two of which came back as refusals the author had to notice by eye; a sweep that stopped at the first one would be that workflow with fewer commands and the same blindness.

func (CarrierRow) At

func (r CarrierRow) At(value int) (Weighing, bool)

At is the weighing this row took at one swept value.

func (CarrierRow) Leaked

func (r CarrierRow) Leaked() bool

Leaked reports whether this row's refusal is the harness rather than the carrier.

⚠️ This is the one distinction a reader must not have to make by reading the sentence. Every other refusal says *this carrier cannot be priced here*, which is ordinary and expected across a whole cast. A control that did not come out exactly even says the measurement leaked — a variant in both kits, a side read backwards, a perturbed rng — and it is a claim about the run rather than about the carrier. Rendered the same way, it would sit in a column of dashes with thirty other dashes and be read as "another uninteresting one".

func (CarrierRow) Priced

func (r CarrierRow) Priced() bool

Priced reports whether the row carries figures.

type CarrierSkipped

type CarrierSkipped struct {
	Carrier string
	Why     *NotBroughtError
}

CarrierSkipped is a character that is not in the table at all.

Absent rather than a zero row, because a row of noughts and a carrier that never cast the skill are the same glyphs and opposite facts — the same reason Weigh refuses a row that landed nothing instead of pricing it at nought. The count and the reason go in the footer so the absence is still on the page.

type CarriersReport

type CarriersReport struct {
	Skill string
	Field WeighField
	// Shipped is the value the book declares, which is the control column.
	Shipped int
	// Values are the swept values with the control folded in, in order. Every
	// row fought exactly these, so they are the table's columns.
	Values  []int
	Level   int
	Seeds   int
	Band    int
	Rows    []CarrierRow
	Skipped []CarrierSkipped
}

CarriersReport is one field priced across the cast: a table, with no headline number, deliberately.

func (CarriersReport) Battles

func (r CarriersReport) Battles() int

Battles is what the table cost: one row is 2 × seeds × values, and there is one row per carrier.

It is the cost of a *full* table. A row refused partway through fought fewer, because Weigh stops at the first value it cannot read — so this is what a reader should expect to pay before the run rather than an audit of what was paid, and it is printed before the table for that reason.

func (CarriersReport) Considered

func (r CarriersReport) Considered() int

Considered is how many characters the sweep asked, priced and skipped alike.

func (CarriersReport) Largest

func (r CarriersReport) Largest() int

Largest is the biggest value swept, which is the column the table is sorted on.

type CarriersRequest

type CarriersRequest struct {
	Skill  string
	Field  WeighField
	Values []int
	Level  int
	// Seeds is how many battles each half of each row of each carrier is fought
	// over, so one carrier costs 2 × Seeds × len(values) and the table costs
	// that again per carrier.
	Seeds int
	// Stage is the form every carrier is weighed as, for the reason
	// WeighRequest carries one: a forking line has two stat lines and a price is
	// a fact about one. A carrier it does not apply to is unaffected.
	Stage string
}

CarriersRequest is one field on one skill, priced once for every character whose fielded kit brings it.

There is no Character on it, and that absence is the whole difference from a WeighRequest: the carrier is not chosen, it is *discovered*, by asking each character in the book whether it brings the skill.

type CarryError

type CarryError struct {
	Affinity element.Affinity
	Skill    string
	Element  element.Element
	Reason   skill.CarryRefusal
	// Allowed is the skill's element allowlist, on CarryElementRestricted.
	Allowed []string
}

CarryError is a kit holding a skill the affinity may not use, with the four things that explain it: what the character is, which skill, what that skill is, and which of the two element rules refused it.

Reason is skill.WhyCannotCarry's own answer, carried rather than recomputed. The two need different advice — a wrong element is fixed by taking the skill's element, and a restricted one cannot be, because the skill's element is already shared — so a front-end that had only the affinity and the skill would have to work out which had happened, which is the rule declared twice.

func (*CarryError) Error

func (e *CarryError) Error() string

type CarryFacts

type CarryFacts struct {
	// Anyone is true when nothing narrows the skill.
	Anyone bool
	// Element is the skill's own element, empty when it is neutral and
	// therefore gates nobody.
	Element string
	// Elements, Archetypes, Characters, Species and Origins are the allowlists
	// it declares.
	Elements   []string
	Archetypes []string
	Characters []string
	Species    []string
	Origins    []string
}

CarryFacts is who may take a skill, as the facts rather than as a sentence.

Five things can narrow a skill and they compose: its own element gates it to affinities holding that element, and each of the four allowlists gates it further. Nothing narrowing it at all is the common pool, which is what Anyone says, and it is worth its own field rather than a caller checking for five empty ones — "which skills can anybody take" is the question an author asks most often and the one the picker answers at a glance.

func WhoMayCarry

func WhoMayCarry(carried skill.Skill) CarryFacts

WhoMayCarry reads a skill's gates without wording any of them.

type CastCensus added in v0.2.0

type CastCensus struct {
	Build cast.Build
	// Against is the squad that supplied the opposing side and the subject's own
	// companions, and it is on the report because a count without its board is a
	// figure nobody can re-take.
	Against string
	// Seeds is how many battles each arrangement was fought over, so Battles is
	// twice this.
	Seeds   int
	Battles int
	Casts   []SkillCasts
}

CastCensus is what a build did with its own four slots.

⚠️ **It exists because a rate cannot say whether a build played its own kit.** A build reading a healthy figure may be reading three skills and a dead slot, and that is not a hypothetical: the reading RAT-006 was raised on quoted a collapse from 725‰ to 110‰ and blamed a summon the rating had never cast — re-measured, that summon is uncast in the *winning* kit as well, and what had actually changed was a hide the rating took three times a battle for turns it should not have spent. Neither fact is visible in a rate. Both are one line of a census.

Counted in the build's own kit order and never by ranging a map: this is a measurement somebody reads, and Go randomises that order.

func (CastCensus) Silent added in v0.2.0

func (c CastCensus) Silent() []string

Silent is the skills the build never cast, in kit order.

The whole point of the instrument: a slot that never fires is a slot the author is not getting, whether because the rating prices it at nothing, or because its fuel is not in the kit beside it, or because something else in the kit is always worth more.

type CensusWalk added in v0.2.0

type CensusWalk struct {
	Build cast.Build
	// Taken is every board the build was measured on, in the order the squads are
	// declared, ending at the board that left nothing silent when there was one.
	Taken []CastCensus
	// Silent is the skills that stayed silent on EVERY board walked, which is
	// empty for a build that passes the rule. A slot named here is a slot the
	// author did not get.
	Silent []string
}

CensusWalk is a build measured against the authored squads until one of them leaves nothing silent, which is the authoring rule itself rather than a convenience over Census.

⚠️ **The walk is the rule and a census is one board.** A slot silent against one squad is a fact about that matchup — `split` is uncast against eight of the twenty-one characters and cast four hundred times across the rest — so what a catalogue has to answer is whether a slot fires *anywhere*. A reader handed a single board would take a silent row as a failed rule, and it is not one.

It lives here rather than in the test that first needed it because two callers now ask the same question — the catalogue test and `hexforge census` — and a rule worded twice is the mistake this repository keeps a list of.

func (CensusWalk) Boards added in v0.2.0

func (w CensusWalk) Boards() int

Boards is how many squads the build was measured against.

func (CensusWalk) Plays added in v0.2.0

func (w CensusWalk) Plays() bool

Plays reports whether the build cast every skill it names, somewhere.

type CharacterReport

type CharacterReport struct {
	ID string
	// Art is every distinct picture the character can show, its own first and
	// then one per stage that names a different one.
	//
	// A list rather than the single image it used to be, because art a grown
	// form uses is art nobody looks at until the character has grown — so a
	// missing file there is precisely the one that surfaces late, in front of a
	// player rather than in front of a check.
	Art    []ArtReport
	Stage  string
	Values progression.Values
	Budget Budget
	// Traits is what the same character costs once a trait is on it, one entry
	// per trait its learnset can reach at the cap.
	//
	// One row per trait rather than one number, because a trait is chosen on a
	// placement and not on a character: which of them is carried is a decision
	// nobody has made yet at this point, so the honest answer is all of them.
	Traits []TraitBudget
	// Failure is set when the character will not resolve at the level cap,
	// which the parser cannot catch on its own because a line only has to be
	// valid, not reachable at every level.
	Failure error
}

CharacterReport is what an inspection found out about one character.

func (CharacterReport) ArtMissing

func (r CharacterReport) ArtMissing() int

ArtMissing is how many of the character's pictures are not on disk.

type CharacterRestrictedError

type CharacterRestrictedError struct {
	Character string
	Skill     string
	Allowed   []string
}

CharacterRestrictedError is a kit holding a skill that belongs to somebody else, on the same terms as ArchetypeRestrictedError.

func (*CharacterRestrictedError) Error

func (e *CharacterRestrictedError) Error() string

type CurveHalf

type CurveHalf int

CurveHalf names which side of a curve would not read as a number.

const (
	CurveBase CurveHalf = iota
	CurveMax
)

func (CurveHalf) String

func (h CurveHalf) String() string

type CurveNumberError

type CurveNumberError struct {
	Raw  string
	Half CurveHalf
	Err  error
}

CurveNumberError is a "base:max" pair with an unreadable half.

func (*CurveNumberError) Error

func (e *CurveNumberError) Error() string

func (*CurveNumberError) Unwrap

func (e *CurveNumberError) Unwrap() error

type CurveReason

type CurveReason int

CurveReason is why progression refused a curve, classified the same way and with the same caveat as AffinityReason: the refusal is the engine's, and an unrecognised one keeps the engine's own words.

const (
	CurveReasonUnclassified CurveReason = iota
	// CurveReasonNotPositive is a curve starting at zero or below.
	CurveReasonNotPositive
	// CurveReasonShrinks is a curve whose maximum is under its base, which
	// would make a stat fall as the character levels.
	CurveReasonShrinks
)

type CurveRefusedError

type CurveRefusedError struct {
	Kind   progression.Kind
	Curve  progression.Curve
	Reason CurveReason
	Err    error
}

CurveRefusedError is a readable curve the stat it is for will not accept.

func (*CurveRefusedError) Error

func (e *CurveRefusedError) Error() string

func (*CurveRefusedError) Unwrap

func (e *CurveRefusedError) Unwrap() error

type CurveShapeError

type CurveShapeError struct{ Raw string }

CurveShapeError is an answer that is not a "base:max" pair at all.

func (*CurveShapeError) Error

func (e *CurveShapeError) Error() string

type Draft

type Draft struct {
	ID        string
	Name      string
	Origin    string
	Archetype string
	Image     string
	Element   string
	Bio       string
	// Skills is a comma separated list. Empty means "take the archetype's kit".
	Skills string
	// Species is a comma separated list of what the character is. Empty is a
	// real answer -- "nothing in particular" -- rather than a default taken from
	// somewhere else: an archetype cannot supply it, because how a character
	// fights says nothing about what it is.
	Species string
	// Stats holds a "base:max" override per stat. An empty entry means "take
	// the archetype's curve".
	Stats [progression.KindCount]string
}

Draft is every answer that makes a character, held as the strings a flag, a prompt or a text input produced.

Keeping the answers as text until the very end is what lets a flag-only invocation, a fully prompted one and a form driven by keystrokes turn into the same character. That happens in Resolve, and Resolve is pure: it reads the library, writes nothing, and touches neither the terminal nor the filesystem, which is what makes it testable without capturing a screen.

func (Draft) Carrier

func (d Draft) Carrier() Carrier

Carrier is the draft as a kit check wants it: the id, the preset, the element, what the character is and where it is from, with an unreadable or unanswered element left out rather than guessed at.

Draft.Resolve refuses a bad element on its own account; this is for the checks a half-filled form makes as it is typed, where an element that is not an element yet is an ordinary state and not a refusal.

func (Draft) KitNames

func (d Draft) KitNames(lib *Library) []string

KitNames is the kit a draft would be written with: the named skills, or the archetype's when none were named.

func (Draft) Resolve

func (d Draft) Resolve(lib *Library) (cast.Character, error)

Resolve turns a draft into a character, or says which answer is wrong.

The last word belongs to the parser: the candidate is appended to a copy of the book, which validates it exactly as loading the file would, so nothing can be produced here that would not load back.

func (Draft) Table

func (d Draft) Table(lib *Library) (progression.Table, error)

Table is the stat curve a draft would produce, taking the archetype's for every stat the draft does not override.

It exists so a front-end can show the budget a half-finished draft is spending without resolving a character it does not yet have a name for. Resolve builds the same table; both call this so an incomplete form and a finished write cannot disagree about a number.

type Duellist

type Duellist struct {
	ID    string
	Name  string
	Level int
	// Stage is the form fielded, always the furthest the level reaches. A spar
	// does not field an early form: doing that is a trade an author makes
	// deliberately, and measuring one nobody asked for answers a question nobody
	// asked.
	Stage    string
	Affinity element.Affinity
	Stats    progression.Values
	Skills   []string
	Passives []string
}

Duellist is one side of a spar — who it is, and what it brought.

The kit is on it rather than looked up again because it is the part a reader has to be told. A spar chooses a loadout where a roster insists somebody choose one (see seedKit), so the report carries what was fielded and nobody ends up reading a win rate for four skills they cannot see.

type DuplicateEntryError

type DuplicateEntryError struct{ Value string }

DuplicateEntryError is one name listed twice in an allowlist.

func (*DuplicateEntryError) Error

func (e *DuplicateEntryError) Error() string

type DuplicateSkillError

type DuplicateSkillError struct{ ID string }

DuplicateSkillError is one skill named twice in a kit.

func (*DuplicateSkillError) Error

func (e *DuplicateSkillError) Error() string

type Effects

type Effects struct {
	Applied  int
	Restored int
	Stripped int
	Summoned int
}

Effects is what one unit's skill did over a set of duels other than strike: what took hold, what health came back, what was cleared off, what was called in.

It is here for the reason Strikes is, and it is the half Strikes could not hold. A rate cannot say whether anything happened — but "did anything happen" was asked as "did a damaging strike land", and that is the right evidence only for a skill whose mechanism *is* damage. A skill of nought power lands no strike however well it works, so every buff, debuff, heal, cleanse and summon in the book read as a mechanism that never fired. These four counts are the same question asked of the rest of the event log.

Applied, Stripped and Summoned count one per event, so a use that put two stacks on counts once. Restored counts one per heal that landed, which is not one per cast: a restore aimed at a unit already at full health emits nothing at all, and that is exactly a row a weighing has to be able to refuse.

func (Effects) Any

func (e Effects) Any() bool

Any reports whether anything at all was observed.

type EmptyKitError

type EmptyKitError struct{}

EmptyKitError is a character that would have nothing to do on its turn.

func (*EmptyKitError) Error

func (e *EmptyKitError) Error() string

type Field

type Field int

Field names an answer whose shape internal/core/cast judges rather than this package.

const (
	FieldID Field = iota
	FieldImage
)

type FieldRefusedError

type FieldRefusedError struct {
	Field Field
	Value string
	Err   error
}

FieldRefusedError is a value internal/core/cast rejected.

Those messages stay in English wherever they are shown. They describe the shape of a data file — a dot too many, a backslash, an extension that is neither .svg nor .png — and reproducing that judgement in a second language would mean restating a rule this package does not own. A front-end puts a lead-in in the author's language in front of the parser's own words.

func (*FieldRefusedError) Error

func (e *FieldRefusedError) Error() string

func (*FieldRefusedError) Unwrap

func (e *FieldRefusedError) Unwrap() error

type IDTakenError

type IDTakenError struct{ ID string }

IDTakenError is an id that is already in the cast.

func (*IDTakenError) Error

func (e *IDTakenError) Error() string

type Library

type Library struct {
	// contains filtered or unexported fields
}

Library is every book a character is validated against, loaded from one data directory — or from the copy the binary embeds, which is a library with no directory at all.

For **authoring**, the directory rather than the embedded copy is the point: an author edits files, and a tool that validated the baked-in bytes would keep saying yes to a change it had not read. The other side of that is the note a check prints — the game boots from the embedded copy, so an edit needs a rebuild before it reaches a battle.

For **playing**, the embedded copy is the point, for the mirror image of that reason: a game client is not editing anything, and a battle it fought from a directory would be a battle the embedded roster and every peer's copy might not agree with. → LoadEmbedded, and MatchesEmbeddedData for what a client still says about a directory it was pointed at.

func Load

func Load(dir string) (*Library, error)

Load reads every book from a data directory.

func LoadEmbedded added in v0.3.0

func LoadEmbedded() (*Library, error)

LoadEmbedded reads every book out of the copy go:embed baked into the binary.

It is the reading a **game** client wants and the one an authoring tool must not have: nothing here can be written back, because there is nowhere to write it, and a check run against it would be reporting on bytes nobody can edit. What it buys is a client that needs no data directory to exist at all — the battle it fights is the battle the embedded roster describes, which is the same one every peer on the same build fights.

The books are the same fifteen files Load reads, read through the same closure shape off seed.Data, so there is one parse order and one set of dependency lists rather than a second assembly that can fall out of step with it. The two optional books are optional here as well and cannot be absent — both are embedded — which is why the equivalence test asserts their contents are not empty rather than only that nothing errored: a wrongly rooted filesystem would hand back a not-exist error, and this package reads that as an author's empty catalogue.

func LoadForReading added in v0.3.1

func LoadForReading(dir string, dataGiven bool) (*Library, error)

LoadForReading is where a **reading** front-end's books come from, and it is the one rule about that a person installing a binary from the module proxy notices.

The rule is three lines, and the middle one is why the other two are not one:

--data given                the directory, always
--data not given, it exists the directory, exactly as before
--data not given, it is not the copy the binary embeds

An installed binary is the third line. DefaultDataDir is a **relative** path — it is where the data sits inside a checkout — so away from one it names a directory in whatever the caller happened to be standing in, and a front-end died on it with `read internal/seed/data/combat.json: no such file or directory` while carrying a copy of every one of those files.

⚠️ **The fallback keys on the directory being ABSENT and never on the load failing.** "Load, and take the embedded copy if that returned an error" reads the same from here and is a different program: an author who leaves a trailing comma in skills.json would be handed the baked-in books and told nothing, and would spend the evening wondering why an edit they can see in the file does not reach the screen. A directory that exists and will not parse must refuse exactly as it did before this function existed. It is the distinction testfixture.RequireSharedArt is built on — a guard keyed on the *result* of the thing it guards deletes itself, so key on the *probe*.

⚠️ **Absent means absent**, rather than "the stat did not succeed". A stat that fails for any other reason is not a missing data directory, and answering that with the embedded copy would swallow the one error naming the real problem. Only fs.ErrNotExist takes the third line.

⚠️ **A named directory is never second-guessed**, which is the first line. A caller who typed `--data /nope` gets a refusal naming it; handing them different data is not an answer to what they asked. A front-end may want to say that better than a bare read error does — DataDirectoryIsAbsent is the same probe, exported so a refusal can be phrased before the load is attempted.

Why the second line is not "always embed": a run from inside a checkout with no flag is an author who wants to see the file they just edited. Embedding regardless would take that away without saying so, and anything drawn off MatchesEmbeddedData needs a directory to compare.

⚠️ **This is for readers only.** A front-end that writes may not use it: the embedded copy has nowhere to write back to, so a writer handed one either refuses late, in the words of ErrNoDataDirectory, or — before dataHome was a type — wrote a relative path into the caller's working directory. A writer takes Load and states its own refusal when there is no directory.

It lives here rather than in either front-end because two commands cannot import each other, and a rule with three lines and three ⚠️ notes spelled twice is two rules that will disagree.

func (*Library) AddApplications

func (l *Library) AddApplications(answer string, statuses []string, chance string) (string, error)

AddApplications writes picked statuses into an applies answer at one chance, keeping whatever the answer already holds.

One chance for the batch, and that is a deliberate limit rather than an oversight: a picker collects a set, and asking for a chance per row would be a form inside a list. A skill wanting two statuses at two chances is two trips through the picker, or one trip and an edit to the number — the field is still a text field and the syntax is still the record.

The spelling comes from FormatApplications, which is ParseApplications' own inverse, so what this writes is what the parser reads back. Whether the chance is a legal share is not judged here for the reason ParseApplications does not judge it either: skill.ParseBook owns that bound and says so in better words than a second copy would.

func (*Library) AimCoverage added in v0.2.0

func (l *Library) AimCoverage(id string, aim hex.Offset, caster hex.Side) (ShapeCoverage, error)

AimCoverage is what a skill catches when it is aimed at one cell of a real board — the same values ShapeCoverage carries, resolved from the aim rather than from the diagram's fixed cell.

⚠️ **It is a second entry point and not a second walk.** ShapeCoverage answers "what is this *shape*", which is a question about a shape and is therefore asked from one chosen cell; this answers "what does this *aim* catch", which is a question about a board and can only be asked from the cell under the cursor. A screen drawing the diagram's footprint over a battle would be drawing a picture of a different board — the shape loses its far cell near an edge, and which edge depends entirely on where the player is pointing.

The side comes off the skill rather than being passed in, because the skill is what decides it: battle.covers reads known.Target.CrossesSides() and so does this, so the cells drawn are the cells the resolution would walk. Same predicate, three callers, one declaration — skill.Side.CrossesSides.

⚠️ caster is a different question and IS passed in: which half of the board holds the unit about to cast. It is the frame the shape's steps are read in, so a screen drawing an enemy's aim with the ally's frame would promise the wrong cells. → package pattern's doc, and TODO.md ENG-012.

⚠️ It answers about CELLS and not about damage. A cell in the result may hold a unit the resolution then refuses — a burrowed target takes nothing off a splash it is standing in — so a caller may say "this reaches these cells" and may not say "these will be hit".

func (*Library) ArchetypeDeps

func (l *Library) ArchetypeDeps() cast.ArchetypeDeps

CastDeps is what a character is checked against, assembled from the loaded books so every tool and the game itself apply the same rules. ArchetypeDeps is everything a preset is validated against, and it exists for the same reason CastDeps does: two callers parse the archetype book — a load, and the re-parse a skill edit does off the disk — and a second copy of the list is a second thing to forget a book from. That is not hypothetical: when passives arrived the re-parse kept its own list, so every skill edit in the repository started failing with a refusal about a preset nobody had touched.

func (*Library) Archetypes

func (l *Library) Archetypes() *cast.ArchetypeBook

func (*Library) ArtFiles

func (l *Library) ArtFiles() ([]string, error)

ArtFiles is the package function over the directory the books were read from, which is what a front-end holding a library has.

func (*Library) ArtImage

func (l *Library) ArtImage(art string, boxWidth, boxHeight int) (*image.RGBA, error)

ArtImage rasterises the picture at an authored path, fitted inside a box of the given size in pixels and centred in it.

The picture's own proportions are kept, so a box wider than the art leaves transparent margins rather than stretching it. Transparency survives: what a caller does with it — a terminal leaving those cells blank, a graphical client compositing them — is the caller's decision, and flattening it here would take that decision away.

func (*Library) ArtStamp

func (l *Library) ArtStamp(art string) (string, bool)

ArtStamp identifies the bytes behind an authored path without reading them: its size and when it was last written, or false when there is nothing there.

It exists so that a front end caching a drawing can key the cache on the file rather than on the path. A cache keyed on the path alone goes stale the moment an author redraws the art, and a tool whose whole job is telling somebody the truth about a data directory must not be the last thing to notice it changed. One stat is microseconds against the tens of milliseconds a raster costs.

func (*Library) AssetsPath

func (l *Library) AssetsPath() string

AssetsPath is the directory art is looked for in.

A front-end needs it for one sentence only: the one it says when there is no art to offer. "Nothing found" without naming where it looked is a line nobody can act on, and a front-end joining the folder name on itself would be a second declaration of where art lives.

func (*Library) BattlesPath

func (l *Library) BattlesPath() string

BattlesPath is the folder battle logs land in, for a front-end that says so.

func (*Library) Bonuses added in v0.2.0

func (l *Library) Bonuses() *composition.Book

func (*Library) Books

func (l *Library) Books() battle.Books

Books is what a battle is fought under, assembled from the directory.

internal/seed has a function of this name and this shape, and the difference between them is the whole reason this one exists: that one reads the copy go:embed baked into the binary, and this one reads the files an author is editing. A spar run against the embedded copy would keep reporting on the character as it was at the last build, which is the one answer an authoring tool must never give.

func (*Library) Bounds

func (l *Library) Bounds() modifier.Bounds

func (*Library) Budget

func (l *Library) Budget(values progression.Values) Budget

Budget measures a resolved stat line against the shipped limit.

func (*Library) Build added in v0.2.0

func (l *Library) Build(id string) (cast.Build, bool)

Build is one build by its own id, and whether the catalogue holds it.

⚠️ **This is the third way to ask that Builds' comment above rules out for a SCREEN, and a command is not a screen.** A screen has the row it drew, so a lookup by id would be a second path to something it already holds. A command line has a string a person typed and nothing else — `hexforge census machop.charge` — so the id lookup is the only shape it can have, and doing it by ranging Builds in the front-end would put the catalogue's own indexing in a caller.

func (*Library) Builds

func (l *Library) Builds() []cast.Build

Builds is every authored build, in declaration order.

It hands out the slice rather than the book, unlike every accessor above it: a front-end listing builds wants them in order and a front-end asking about one character wants BuildsOf, and those two are the whole of what the book is read for here. Handing the book over would give a screen a third way to ask — by a build's own id — which is the lookup nothing on a screen has, because a screen has the row it drew.

func (*Library) BuildsOf

func (l *Library) BuildsOf(character string) []cast.Build

BuildsOf is one character's builds, in declaration order, and is empty for a character nobody has written a direction for.

Empty is an answer rather than a miss, which is a fact a caller has to carry: a listing that dropped a character with no build would be saying the cast is shorter than it is.

func (*Library) CastDeps

func (l *Library) CastDeps() cast.Deps

func (*Library) CastPath

func (l *Library) CastPath() string

CastPath is the file a saved character lands in, which is what a confirmation has to name.

Every path accessor below answers "" for a library with no directory, which is dataHome.show's decision and is explained there. The refusal a front-end acts on comes from the write itself.

func (*Library) Census added in v0.2.0

func (l *Library) Census(build cast.Build, against string, seeds int) (CastCensus, error)

Census counts how often a build casts each of its own skills, standing in a squad against that same squad.

⚠️ **The board is a squad and a duel would be the wrong instrument.** Several whole categories are worth nothing at all in a one on one, correctly: a taunt denies an aim nobody had a choice about, and a hide has no other ally for its `elsewhere` term to point at. Measured on the shipped `squirtle.fortress`, `taunt` was cast **0** times in 132 duels and **252** times in the same number of squad battles — so a duelling census reports a dead slot on a build that plays it every battle, which is the blind board this repository has drawn a wrong conclusion from twice.

⚠️ **Nor is the board a mirror.** The first cut put the subject's own character on both sides, which sounds like the cleanest control there is and is a third blind board: against a copy of itself a skill can be strictly dominated by its own kit-mate, and seven shipped builds read a silent slot that every one of them plays against somebody else.

So the subject stands **in** an authored squad, in place of its first member, against that squad intact. The companions and the opponents are then the same six units on both sides of the reading and cancel; the only difference on the board is the subject's own four slots. The squad is named by the caller because one board is one matchup however it is chosen — a slot silent here is silent against *this* squad, and the rule that walks several of them is the caller's.

Both arrangements are fought over the same seeds, for the reason everything else in this package is: the roster order decides a tie in the turn queue, so one arrangement folds that advantage into the answer.

func (*Library) CensusWalk added in v0.2.0

func (l *Library) CensusWalk(build cast.Build, seeds int) (CensusWalk, error)

CensusWalk takes a census against each authored squad in turn and stops at the first board that leaves nothing silent.

Stopping early is what keeps the rule affordable: most builds are done after the first board, and only the ones with something to explain pay for the rest. A caller that wants one named board calls Census directly.

func (*Library) CharacterIDs

func (l *Library) CharacterIDs() []string

CharacterIDs is the authored cast's ids, in the book's own order, which is what the character allowlist is chosen from.

func (*Library) Characters

func (l *Library) Characters() *cast.Book

func (*Library) Chart

func (l *Library) Chart() *element.Chart

func (*Library) DeleteSquad

func (l *Library) DeleteSquad(id string) error

DeleteSquad removes one by id, and says so when there was none.

func (*Library) Dir

func (l *Library) Dir() string

Dir is the directory the books were read from and will be written back to, and "" for a library built from the embedded copy, which was read from nowhere and cannot be written back at all.

It hands back the directory it was given rather than a cleaned form of it: two clients draw it in a header line, so it is a string a reader recognises rather than a path anything resolves.

func (*Library) EditSkill

func (l *Library) EditSkill(edited skill.Skill) (SkillChange, error)

EditSkill writes a changed skill, having first made sure nothing already in the data directory stops carrying it.

The order is the whole design. Replace validates the skill itself exactly as a load would. Then the presets and the cast are re-parsed against the edited book, because those are the two files that name a skill, and a refusal from either is turned into a refusal naming who would break. Only then is anything written, through the same temp-file-then-rename SaveSkill uses.

On success the library holds all three re-parsed books, not just the skills. An archetype's Demands is derived from its kit's elements, so an edit to a skill's element changes a preset without touching archetypes.json, and a library still holding the old presets would answer the next question wrongly.

func (*Library) EditSkillNoteFacts

func (l *Library) EditSkillNoteFacts(change SkillChange) []Note

EditSkillNoteFacts is what a written edit is worth saying about, in order.

The goldens note is here for the reason it is on a save — a skill is balance — and it is unconditional for a reason worth stating: the damage figures are not the only thing that reaches a golden. An element decides every matchup in scenarios.golden, and an accuracy or a cooldown moves a battle without moving a single damage number, so "the damage did not move" is not "nothing moved".

func (*Library) EditSkillNotes

func (l *Library) EditSkillNotes(change SkillChange) []string

EditSkillNotes is EditSkillNoteFacts in the English cmd/hexforge prints.

func (*Library) FightSquads

func (l *Library) FightSquads(home, away string, seeds int, without ...string) (SquadReport, error)

FightSquads measures one squad against another over seeds 1..n, both ways round.

**Both ways round is not a refinement, it is the measurement.** The engine enlists in roster order and breaks a tie in the turn queue by it, and the two halves of the board are not interchangeable — a squad placed as the ally is listed first and moves first on a tie. Fighting one arrangement would report that advantage as though it belonged to the squad. So each seed is fought twice, with the squads swapped, and both halves run the *same* seeds: halves fought over different seeds cancel nothing, they are two measurements of two different things.

A refusal comes back as an error rather than as a report with a hole in it. Every seed would refuse for the same reason — a roster is checked before a die is rolled — so fighting the rest would be a slower way to be told once. The bonuses named in without are taken out of the book for the whole run, which is the only instrument that can price one: the same squads, the same members and the same seeds, with one rung gone. A set rather than a switch, because bonuses stack and a global off would measure the system instead of the rung — see composition.Book.Without.

func (*Library) HasDataDirectory added in v0.3.0

func (l *Library) HasDataDirectory() bool

HasDataDirectory reports whether this library was read from a directory on disk at all, which is the difference between a picture nobody has drawn yet and a program that carries no pictures.

⚠️ **It exists so that nothing outside this package has to read that state off the emptiness of Dir.** `Dir() == ""` gives the right answer today and is the wrong question: Dir is a **display** string — two clients draw it in a header line, uncleaned — and it is empty because show had no path to show, not because emptiness is how this package states the fact. A screen branching on it is a rendering decision keyed on a formatting accident, and it would keep compiling and stop being true the first time a header wanted a word there.

The second half of the reason is the guard. Reaching home is what TestEveryLibraryAccessorThatReachesTheDataDirectoryDecidesWhatNoDirectoryMeans walks for, so a question asked here arrives with a written-down decision beside the sixteen others and is checked against a real embedded library; the same question asked as `Dir() == ""` in another package is outside every guard this file has.

func (*Library) Held

func (l *Library) Held(base progression.Values, traits []string) (progression.Values, error)

Held is the stat line a character actually fights on: its resolved values with every permanent status its trait grants already applied.

Why the budget is not checked against this, and is not meant to be

progression.Limits.CheckValues takes six numbers and nothing else, so the line it bounds is the one on paper — which is the line an **author** writes. A trait is not in those six: it is named beside the stat line on a placement, and its grants are put on at enlistment, after everything that could have refused them. So battle.New will reject a base line of 740 defence as over budget and then hand the same unit 786 through a trait, in the same call.

That is the intended split rather than a leak. A ceiling and the budget bound what may be **authored**; a battle is where a stat is supposed to move, and a buff that could not take one past its ceiling would be a buff with a cliff in it. What holds the fought line is the saturation: modifier.Set.Stat rescales every change against ceiling × headroom, so nothing reaches three times a ceiling however much is stacked on it, and nothing reaches the floor beneath it either. Whatever a rune turns out to be, it lands in a system that already bounds it.

What was missing was not a check but a figure. The fought line is the one a battle is decided on, and nothing printed it — so a trait's whole contribution was invisible beside the stat line it modifies. This is that figure, and hexforge check prints it beside the authored one.

func (*Library) ImageExists

func (l *Library) ImageExists(image string) bool

ImageExists reports whether the art a character names is really there. This is the question internal/core is not allowed to ask.

func (*Library) ImagePath

func (l *Library) ImagePath(image string) string

ImagePath turns an authored image path into a real one. Authored paths are always slash-separated and relative to the data directory; only here does either of those become an operating system's business.

⚠️ An embedded library answers "" for every picture, and that is the answer rather than a gap: the art is **not** embedded — sixty-six files and 16 MB — so a client on the embedded books has no picture files, and a path relative to nowhere would have had ImageExists reading whatever assets folder happened to sit beside the player's shell.

func (*Library) Inspect

func (l *Library) Inspect() Report

Inspect is Inspect over an already-loaded library, which is what a long-running front-end has.

func (*Library) KitPassives

func (l *Library) KitPassives(named []string) []passive.Passive

KitPassives is the same for a character's traits: the declared ones resolved, and a placeholder for a name the book does not hold, so a listing draws the id rather than a gap.

func (*Library) KitSkills

func (l *Library) KitSkills(named []string) []skill.Skill

LookupKit resolves a list of skill ids against the book. KitSkills resolves a kit's ids against the book for a caller that is drawing them rather than checking them: one entry per id, in the kit's own order, and an id the book does not hold stands in as a skill carrying nothing but that id.

LookupKit's refusal is right where a kit is being authored, and no use at all where one is being drawn: the ids came off a character that already loaded, so an unknown one is unreachable — and dropping the entry would be worse than standing it in, because the names are drawn under the ids and have to stay in step with them one for one.

func (*Library) KitSpecies

func (l *Library) KitSpecies(named []string) []cast.Species

KitSpecies is a character's kinds resolved against the catalog, which is what a screen wanting their authored names asks for. It mirrors KitPassives: the lookup is here and the wording is i18n's.

func (*Library) Limits

func (l *Library) Limits() progression.Limits

func (*Library) LookupKit

func (l *Library) LookupKit(named []string) ([]skill.Skill, error)

func (*Library) LookupPattern

func (l *Library) LookupPattern(name string) (pattern.Pattern, error)

LookupPattern resolves a shape name against the pattern book.

func (*Library) MatchesEmbeddedData

func (l *Library) MatchesEmbeddedData() (bool, error)

MatchesEmbeddedData reports whether the files in this library's directory digest to the same fingerprint as the copy the binary embeds.

⚠️ **It exists because a PvP client is a mirror and the gate promises identical data.** wire.Version's digest is over the **embedded** files, so a client that built its battle from an edited --data directory would pass a gate that promised the two peers would simulate the same battle and then fight a different one — a divergence on turn one, reported correctly and confusingly. The client therefore plays a match on seed.Books() whatever --data says, and this is what lets it *tell the reader so* only when the two really differ. A --data pointing at an unmodified copy is the common case, and a warning there would be noise on every join.

⚠️ **The os.DirFS is here rather than in internal/seed**, and that is the layer rule rather than convenience: this package is the one part of the module allowed to touch a real file, seed reads the embedded copy and nothing else, and seed.DigestOf takes an fs.FS precisely so the split can hold.

An unreadable directory is **not** a difference: it is reported as an error, because "these two disagree" and "this could not be read" are different things to say to a player and only one of them is about the data. A library that **is** the embedded copy matches it, and answers so without reading anything: there is no directory to digest, and os.DirFS("") errors rather than resolving to the working directory. Saying yes here is what keeps a client built on LoadEmbedded from drawing "your edits will not reach the battle" over data nobody could have edited.

func (*Library) OriginIDs

func (l *Library) OriginIDs() []string

OriginIDs is the catalogued works, in the order the book holds them.

func (*Library) Origins

func (l *Library) Origins() *cast.OriginBook

func (*Library) OriginsPath

func (l *Library) OriginsPath() string

OriginsPath is the file a saved origin lands in.

func (*Library) ParseApplications

func (l *Library) ParseApplications(answer string) ([]skill.Application, error)

ParseApplications reads the statuses a skill inflicts, written "status:chance" or "status:chance:stacks" and separated by commas.

Whether a chance is a legal share and whether a stack count fits the status is skill.ParseBook's judgement and is not repeated here. What this owns is the shape of the answer and whether the status exists, which is the part a form can refuse as it is typed.

func (*Library) Passives

func (l *Library) Passives() *passive.Book

func (*Library) PatternNames

func (l *Library) PatternNames() []string

PatternNames is every declared shape, in the book's own order, which is what a chooser offers.

func (*Library) Patterns

func (l *Library) Patterns() *pattern.Book

func (*Library) PlayerSquads added in v0.2.0

func (l *Library) PlayerSquads(path string) ([]placement.Squad, error)

PlayerSquads reads a player's own squad file and checks every side in it against these books.

Three outcomes, and telling them apart is the whole of what this decides:

  • **Absent is silent.** A player who has never built a side has no file, and that is the ordinary case rather than a broken installation — the same reading Load takes of a data directory with no squads.json in it. An empty path answers the same way, because a machine whose configuration directory could not be resolved has nowhere for the file to be.
  • **Unreadable or malformed is refused, and the refusal names the path.** This is the one that may not be swallowed. A player hand-edits this file, so a missing comma is a thing that happens, and quietly showing them the shipped sides instead would tell them their squads had vanished rather than that their file has a typo in it. What the caller does with the refusal is stop — the same treatment a --data directory that will not parse already gets, which is what makes it unswallowable.
  • **Illegal is refused on the SAME rule the game refuses one by**, which is Squad.Take against the cast book: the call SaveSquad makes before it writes and the call room's gate makes before it seats anybody. A hand-edited file can name a character that does not exist, a stage off the line, a skill the unit cannot carry or two units on one cell, and the cast book already answers every one of those. A check written here would be a second declaration of the legality rule.

The whole file is refused rather than the offending side, for the reason placement.Parse refuses a whole file over one repeated id: a player told that four of their five sides loaded has been told their file works.

func (*Library) PreviewDamage

func (l *Library) PreviewDamage(built skill.Skill) SkillPreview

PreviewDamage measures a skill against a reference attacker and defender.

The two figures are the shipped progression ceilings: the attack ceiling exactly, and half the defence ceiling. That is not a round number picked to look reasonable — it is the pair skills.golden's own damage column is computed from (800 attack, 400 defence), so the number this shows before a write is the number the golden table will show after one. A different reference would give an author two damage figures for one skill and no way to tell which was the one the design was read from.

Half the defence ceiling rather than all of it because the ceiling is the armour end of the budget, which progression.Limits already bounds jointly with health: measuring every skill against a defender nobody can legally be would flatten the differences between skills, which is the one thing this figure is for.

A neutral matchup, and accuracy left out of it, for the same reason: it is what the golden's column does. The skill's own accuracy is a field on the form directly above this line, so an author reads the two together.

func (*Library) PreviewDraft

func (l *Library) PreviewDraft(d SkillDraft) (SkillPreview, error)

PreviewDraft is the damage a half-finished draft is worth.

Only the power and the strike count reach the figure, which is why this works on a form nobody has named yet: the two are the balance, and the rest of the answers decide who may use it and when. The refusal is ParseNumber's, so a power that is not a number reads the same here as it does at the write.

func (*Library) Rules

func (l *Library) Rules() combat.Rules

Rules, Limits, Chart, Skills, Origins, Archetypes and Characters hand out the loaded books. They are read-only from a caller's side: the book types copy the slices a caller could otherwise mutate through.

func (*Library) SaveBattleLog

func (l *Library) SaveBattleLog(home, away string, seed uint64, log battle.Log) (string, error)

SaveBattleLog writes a battle out where the game client can replay it, and reports the path it landed on.

The name is built from the pairing and the seed rather than asked for, because those three are what identifies a battle: the same pairing at the same seed is the same battle, so saving it twice writes over itself rather than leaving two copies of one thing to tell apart later.

⚠️ **A log is verified against the game's data, not this directory's.** `hexarena --verify` re-runs from the copy go:embed baked into the binary, and this library is the files an author is editing — so a log written after an edit that has not been rebuilt will not verify, and the mismatch is the edit rather than corruption. That is the same rebuild note every write here carries, arriving through a different door.

func (*Library) SaveCharacter

func (l *Library) SaveCharacter(character cast.Character) error

SaveCharacter appends a character to the cast and writes the whole book back.

Append is what validates: it checks the character exactly as loading the file would, so a rejected character never reaches the disk. On success the library holds the grown book, so a second save in the same session sees the first.

func (*Library) SaveNoteFacts

func (l *Library) SaveNoteFacts(character cast.Character) []Note

SaveNoteFacts is what a write is worth saying about, in order.

It lives here because both front-ends have to report the same things and because two of the three are warnings rather than pleasantries.

func (*Library) SaveNotes

func (l *Library) SaveNotes(character cast.Character) []string

SaveNotes is SaveNoteFacts in the English cmd/hexforge prints.

func (*Library) SaveOrigin

func (l *Library) SaveOrigin(origin cast.Origin) error

SaveOrigin appends a work to the catalog and writes it back, on the same terms as SaveCharacter.

The clash is caught here as well as by Append, and that is not a second declaration of the rule — Append would refuse it either way, so nothing can be written past this. It is a second *wording*: the parser's "declared twice" describes a file that lists one id in two places, which is not what an author adding a work that already exists has done. Because it lives here, both front-ends say the same thing; if it lived in one of them, the other would have to restate it, and that is the mistake.

func (*Library) SaveSkill

func (l *Library) SaveSkill(built skill.Skill) error

SaveSkill appends a skill to the book and writes the whole book back, on the same terms as SaveCharacter.

The clash is caught here as well as by Append, for the same reason it is in SaveOrigin: the parser's "declared twice" describes a file listing one id in two places, which is not what an author adding a skill that already exists has done. Because the wording lives here, both front-ends say the same thing.

func (*Library) SaveSkillNoteFacts

func (l *Library) SaveSkillNoteFacts(built skill.Skill) []Note

SaveSkillNoteFacts is what writing a skill is worth saying about, in order.

The middle note is the one that matters. A skill is balance rather than content: its power lands in scenarios.golden, progression.golden's hits-to-kill ladder and skills.golden's own table, so a save that said nothing would leave an author to discover a dozen moved numbers at the next test run and assume they had broken something.

func (*Library) SaveSkillNotes

func (l *Library) SaveSkillNotes(built skill.Skill) []string

SaveSkillNotes is SaveSkillNoteFacts in the English cmd/hexforge prints.

func (*Library) SaveSpecies

func (l *Library) SaveSpecies(kind cast.Species) error

SaveSpecies appends a kind of creature to the catalog and writes it back, on the same terms as SaveOrigin.

func (*Library) SaveSquad

func (l *Library) SaveSquad(squad placement.Squad) error

SaveSquad writes one squad into the catalogue, replacing the squad of the same id if there is one and appending it if there is not.

⚠️ **Replacing rather than refusing is the opposite of what SaveSkill does**, and the difference is what the two files are. A skill already in the book is something units carry, so writing over it is an accident to be caught; a squad is the author's own working document, and the whole way one is built is by saving it again. A clash there would mean deleting before every save.

The squad is validated first, and it is validated by the same call a battle would make of it — no squad is written that could not be fielded, because a file that holds one is a file whose next reader gets the refusal instead.

func (*Library) ShapeCoverage

func (l *Library) ShapeCoverage(shape, target string) (ShapeCoverage, error)

ShapeCoverage resolves a shape and a targeting side by name and walks the shape from the diagram's cell.

The answers arrive as the strings a chooser produced, like every other answer in this package, so a screen hands over its draft rather than parsing on its own behalf.

The walk is pattern's own and nothing else, so what a screen draws is what a battle would hit — including the midline, which a skill aimed at both halves crosses and every other one stops at. Which of the two walks that is comes from skill.Side.CrossesSides, the same declaration battle uses, so a diagram cannot promise a cell the resolution would drop. Targets returns the primary first and that is the contract this relies on — see its doc comment.

func (*Library) SkillDeps

func (l *Library) SkillDeps() skill.Deps

SkillDeps is what a skill is checked against: the shapes it can cover and the statuses it can inflict.

func (*Library) Skills

func (l *Library) Skills() *skill.Book

func (*Library) SkillsPath

func (l *Library) SkillsPath() string

SkillsPath is the file a saved skill lands in.

func (*Library) Spar

func (l *Library) Spar(id string, level, seeds int, want string) (SparReport, error)

Spar measures one character against every character in the book, itself included, over the given number of seeds each way.

One duel is a coin toss — the same two units at two seeds can end either way — so a screen showing the result of a single battle would be showing noise and calling it a finding. Every row here is a rate over seeds 1..n taken twice, and n is the caller's, because the honest number depends on how long the caller is willing to wait.

The opponent is not chosen either, and that is the design rather than an omission. What an author wants to know about a character they have just written is whether it belongs beside the ones already written, and the answer to that is the whole cast rather than whichever member they thought to compare it against.

func (*Library) Species

func (l *Library) Species() *cast.SpeciesBook

func (*Library) SpeciesPath

func (l *Library) SpeciesPath() string

SpeciesPath is the file a saved species lands in.

func (*Library) SplashShare

func (l *Library) SplashShare() string

SplashShare is the share of a skill's power a splash cell takes, as a reader thinks of it. The primary always takes the whole.

func (*Library) Squads

func (l *Library) Squads() []placement.Squad

Squads is every squad built in this directory, in the order they were saved.

A copy, because the caller edits one: a builder holds a squad half-finished for as long as somebody is thinking, and a slice shared with the library would have those keystrokes reaching the file's idea of what is saved.

func (*Library) SquadsPath

func (l *Library) SquadsPath() string

SquadsPath is where a saved squad lands, for a front-end that says so.

func (*Library) StatusBook

func (l *Library) StatusBook() []StatusFacts

StatusBook is every declared status as facts, in the book's own order, which is what a picker offers.

func (*Library) StatusIDs

func (l *Library) StatusIDs() []string

StatusIDs is every declared status, in the book's own order, which is what a hint beside the applies field lists.

func (*Library) Statuses

func (l *Library) Statuses() *status.Book

func (*Library) TraitCarriers

func (l *Library) TraitCarriers(id string) []TraitCarrier

TraitCarriers is every character that learns a trait, in cast order.

A trait has no restriction mechanism — no element, no archetype, no species, no character — so "who may carry this" is *everybody* and answers nothing. The question worth asking is the other one: who actually **does**. A trait nobody learns is not an error, the way a species nobody is is not an error, but it is a trait that cannot reach a battle, and a listing is where that shows.

It walks the cast rather than being indexed off the trait, because the learnset is the character's fact: a trait is declared in passives.json knowing nothing about who takes it, and an index kept the other way round would be a second place for the same edge to live.

func (*Library) ValidateArchetype

func (l *Library) ValidateArchetype(id string) error

ValidateArchetype rejects a preset that does not exist, and lists the ones that do.

func (*Library) ValidateElement

func (l *Library) ValidateElement(answer string, kit []skill.Skill) error

ValidateElement rejects an affinity the chart refuses, or one that cannot carry the kit it is being given.

The kit is a parameter rather than something looked up from the archetype, because the two differ the moment the kit is edited, and it is the edited kit the write will be checked against.

func (*Library) ValidateKit

func (l *Library) ValidateKit(answer string) error

ValidateKit rejects a comma separated kit that names an unknown skill, names one twice, or names none at all.

func (*Library) ValidateKitFor

func (l *Library) ValidateKitFor(answer string, who Carrier) error

ValidateKitFor is ValidateKit plus the restrictions the kit's skills declare, checked against whatever the draft has settled so far.

It is the kit question's own check: by the time the kit is asked the id and the preset are known, so a skill only somebody else may carry is refused where it is typed rather than at the write. The element is usually still unanswered at that point, and an unanswered element restricts nothing — see Carrier.

func (*Library) ValidateNewID

func (l *Library) ValidateNewID(id string) error

ValidateNewID rejects an id that is malformed or already taken.

func (*Library) ValidateNewSkillID

func (l *Library) ValidateNewSkillID(id string) error

ValidateNewSkillID rejects a skill with no id or one the book already holds.

It checks no shape beyond that, and the omission is deliberate: skill.ParseBook asks only that an id is not empty, and the shipped ids are written with underscores, so a slug rule imposed here would refuse a name the game accepts.

func (*Library) ValidateOrigin

func (l *Library) ValidateOrigin(id string) error

ValidateOrigin rejects a work that is not in the catalog, and says how to add it.

func (*Library) ValidateRestrictedArchetypes

func (l *Library) ValidateRestrictedArchetypes(answer string) error

The ValidateRestricted* family rejects an allowlist naming something that does not exist, or naming it twice.

An empty answer is accepted, and that is the load-bearing half: an absent list restricts nothing, which is how the common pool is the default shape of a skill. It must not be confused with the list that is present and empty, which skill.ParseBook refuses because nobody satisfies it — an answer nobody typed and an allowlist nobody can meet are different things.

These are stricter than skill.ParseBook, which cannot see either book: cast imports skill, so a skill validated against the cast would be an import cycle, and the parser therefore only checks the names of a restriction on a skill somebody already carries. Refusing an unknown name here rather than at the first character to try it is the same bringing-forward CheckSkill does, and it is the reason the full-screen client offers all of these as a list rather than a text field: a name that cannot be typed cannot be wrong.

func (*Library) ValidateRestrictedCharacters

func (l *Library) ValidateRestrictedCharacters(answer string) error

func (*Library) ValidateRestrictedOrigins

func (l *Library) ValidateRestrictedOrigins(answer string) error

func (*Library) ValidateRestrictedSpecies

func (l *Library) ValidateRestrictedSpecies(answer string) error

func (*Library) ValidateSpecies

func (l *Library) ValidateSpecies(id string) error

ValidateSpecies rejects a kind of creature that is not in the catalog, and says how to add it.

func (*Library) ValidateSpeciesList

func (l *Library) ValidateSpeciesList(answer string) error

ValidateSpeciesList rejects a comma separated answer naming a kind that does not exist, or naming one twice. An empty answer is accepted: being nothing in particular is what most characters are.

func (*Library) Weigh

func (l *Library) Weigh(request WeighRequest) (WeighReport, error)

Weigh prices one field on one skill, as one character carries it, against a copy of itself.

What it is

Both sides are the same character, at the same level, in the same form, with the same stats, the same trait and the same four skills — and the challenger's copy of the one skill has the one field moved. Every duel is fought from both slots and added, so the turn queue's tie-break cancels the way it does in a spar. What is left when everything else has been made identical is the price of that field, and it is read as a deviation from an even split.

What it is not

It is not a roster win rate, and the reason that matters is that a roster win rate was tried first and does not work. Giving the ally more damage *lowers* its share against the shipped roster by about as much as adding a crit chance does, so the rate is not monotone in ally damage and a change measured through it is priced by whatever the placement happens to be — the same change read +2.4 points before a placement change and −2.1 after. A price taken here is a price on this carrier at this level against itself, and it does not transfer.

⚠️ The two twins share one *rng.Source, so a change on one side re-scrambles every draw after it. That is roll drift, and it is why the variance is what it is; it biases nothing, because both arrangements fight the same seeds. Do not try to fix it by seeding the two units separately — there is no such seam, and making one would be a change to internal/core in order to make a measurement prettier.

func (*Library) WeighCarriers

func (l *Library) WeighCarriers(request CarriersRequest) (CarriersReport, error)

WeighCarriers prices one field on one skill once per carrier that brings it.

What it is

len(Rows) independent weighings, each with its own exactly-even control, laid out in one table. It is not one measurement over many carriers: it is many measurements printed together, and the difference is the whole design — see the note at the top of this file for why there is no average and no headline figure.

Who is in it

Every character whose *fielded kit* includes the skill at this level and form. Membership is decided by running the weighing and catching NotBroughtError, rather than by testing the kit here, so there is exactly one place that knows what "brings" means. A character that does not bring it is skipped — absent from the table, counted in the footer — because a zero row and a row that was never fought print identically.

What refuses the whole run, and what refuses one row

Seeds, level, the skill's name and every swept *value* are refused whole: they are the request, and a request that cannot be answered has no rows to put the refusal on. A value in particular is a fact about the skill rather than about any carrier, so it is checked once before a die is rolled — printing the same parser sentence once per row would bury it in its own repetition. Anything a *battle* discovers refuses one row and leaves the others standing.

A table with no rows at all is refused rather than printed empty, on the same principle every refusal here rests on: nought rows and nought carriers look the same on a page and mean different things.

type Matchup

type Matchup struct {
	Against Duellist
	// First and Second are the challenger placed before and after its opponent.
	// The slot and the order are one thing here — the ally slot is enlisted
	// first — so the two are swapped together and the pair of them is what
	// balances.
	First  Tally
	Second Tally
	// Turns is the median length of the duels that finished, and zero when none
	// did. A pairing whose win rate is even can still be badly matched — forty
	// turns of nothing is not the same fight as four — and a rate cannot say so.
	Turns int
	// Strikes is **the challenger's**, across both halves, and counts only the
	// skill the caller asked to count.
	//
	// Whose it is has to be written down because nothing in the type says so and
	// nothing on a screen would: the challenger stands in the ally slot for one
	// half and the enemy slot for the other, so a reader — and a fold that took
	// the wrong id — would get the opponent's attacks with no sign of it.
	Strikes Strikes
	// Effects is the same tally for everything that skill did which was not a
	// strike, and is whose and counts what Strikes does. It is a second field
	// rather than four more on Strikes because the two answer to different
	// questions — "how hard did it hit" and "did it work at all" — and a skill of
	// nought power has the second and not the first.
	Effects Effects
	// Mirror marks the row where a character meets itself. It is the control,
	// and it reads as one only because the halves are kept apart: the combined
	// rate of a mirror is exactly even by construction and therefore says
	// nothing, while First.Rate is what moving first is worth to this character
	// and is the number every other row on the screen has to be read against.
	Mirror bool
}

Matchup is what happened over every seed against one opponent, both ways round.

Both ways is not thoroughness, it is the measurement. The turn queue breaks a tie by enlistment order, so of two units with the same speed the one placed first acts first for the whole battle — and that is worth so much that a character duelling an identical copy of itself wins about seven times in ten from the first slot. A one-way rate would be that advantage plus the character, with no way to tell which was which. Swapping the slots and adding the halves cancels it exactly, and leaves the two halves on the record so the size of what was cancelled is still readable.

func (Matchup) Edge

func (m Matchup) Edge() int

Edge is what the first slot was worth in this pairing, in parts per thousand: the gap between winning from it and winning from the other one.

It is worth reporting rather than merely cancelling because a large edge means the pairing is decided before either unit acts, which is a fact about the two kits — a race between two units that both kill in three turns has an enormous edge, and two units that both survive twenty have almost none.

func (Matchup) Rate

func (m Matchup) Rate() int

Rate is the challenger's balanced share of this matchup, in parts per thousand.

func (Matchup) Total

func (m Matchup) Total() Tally

Total is both halves together, which is the row's actual answer.

type Mechanism

type Mechanism uint8

Mechanism is one thing a skill does when it works, and therefore one kind of evidence that the skill was in the fight at all.

It is a closed table for the reason WeighField is, and it exists because that evidence used to be one thing: a count of landed damaging strikes. That is the right proof for a skill whose mechanism *is* damage and no proof at all for one whose power is nought — poison_powder lands nothing however well it works, so every buff, debuff, heal, cleanse and summon in the book came back "cast N time(s) and landed none", which was true and was not the question. The refusal was right and its evidence was mis-specified; this is the evidence.

⚠️ A mechanism is not a WeighField and the two must not be read as a pair. A field is a dial an author moves; a mechanism is what the skill does when the dial is where it is. `cooldown` moves no mechanism of its own — it decides how often the skill is cast at all — and what proves a cooldown weighing measured anything is whatever that skill does taking hold at least once.

const (
	// Striking through Summoning are declared in the order they are drawn, so a
	// report's columns are declaration order and the two cannot drift apart.
	Striking Mechanism = iota
	Applying
	Restoring
	Cleansing
	Summoning
)

func Mechanisms

func Mechanisms(declared skill.Skill) []Mechanism

Mechanisms is what a skill declares it does, in declaration order.

⚠️ It reads the skill **as fought** rather than as shipped, and that matters on the one field that can change what a skill is: a power swept up from nought makes a support skill damaging for those rows, and a power swept down to nought takes the damage away. A row checked against the shipped skill's mechanism would be checked against a mechanism that row did not have.

A skill that declares none at all comes back empty, and Weigh refuses such a row in so many words. That is not a gap to be filled with a default: a skill which strikes for nothing, applies nothing, restores nothing, cleanses nothing and summons nothing does nothing, and there is no field on it whose worth could be anything but the noise.

func (Mechanism) Count

func (m Mechanism) Count(strikes Strikes, effects Effects) int

Count is how often the log recorded this mechanism over a row.

func (Mechanism) Nothing

func (m Mechanism) Nothing() string

Nothing is how this mechanism reads when the log recorded none of it.

func (Mechanism) String

func (m Mechanism) String() string

String is the mechanism's name as it is printed.

type MissingArtProblem

type MissingArtProblem struct {
	ID string
	// Stage is the form whose art is missing, empty when it is the character's
	// own. It is on the problem rather than folded into the sentence because
	// cmd/hexforge-tui says these in the author's language, and "which stage"
	// is a fact rather than a phrase.
	Stage string
	Image string
	Path  string
}

MissingArtProblem is a character naming art that is not on disk. This is the one question internal/core is not allowed to ask.

func (*MissingArtProblem) Error

func (p *MissingArtProblem) Error() string

type MissingElementError

type MissingElementError struct{}

MissingElementError is an empty answer where an affinity was wanted.

func (*MissingElementError) Error

func (e *MissingElementError) Error() string

type MissingNameError

type MissingNameError struct{ ID string }

MissingNameError is a character with nothing to be called. The id is empty when the check was made before an id was settled, which is the difference between the two wordings the command line has always used.

func (*MissingNameError) Error

func (e *MissingNameError) Error() string

type MissingSkillIDError

type MissingSkillIDError struct{}

MissingSkillIDError is a skill with nothing to be called.

func (*MissingSkillIDError) Error

func (e *MissingSkillIDError) Error() string

type NotBroughtError

type NotBroughtError struct {
	Carrier string
	Skill   string
	Level   int
	Stage   string
	// Brings is the kit the carrier actually fielded, which is the half of the
	// sentence that tells an author what to weigh instead.
	Brings []string
}

NotBroughtError is a skill the carrier does not field.

It is a type rather than a sentence for one reason, and it is not translation: a sweep over the whole cast has to decide which characters are *in* the table, and "brings the skill" is exactly this refusal read as a question. A sweep that answered it for itself would hold a second copy of the kit rule — free to disagree with the one a single weighing enforces — so the membership test is this error, matched with errors.As.

The wording is what Weigh printed before the type existed, unchanged.

func (*NotBroughtError) Error

func (e *NotBroughtError) Error() string

type Note

type Note struct {
	Kind NoteKind
	// ID is the character written, on NoteWrote.
	ID string
	// Path is the file written, on NoteWrote, or the art that is missing, on
	// NoteArtMissing.
	Path string
}

Note is one line of a write's confirmation, held as what it is about rather than as a sentence, so each front-end can word it in its own language.

type NoteKind

type NoteKind int

NoteKind is which of the things a front-end says after a write.

const (
	// NoteWrote names the character and the file it landed in.
	NoteWrote NoteKind = iota
	// NoteArtMissing warns that the art named is not on disk yet, so a check
	// will keep failing on this character until it is.
	NoteArtMissing
	// NoteRebuild warns that the game boots from the embedded copy, so an edit
	// is not in a battle until the binary is rebuilt.
	NoteRebuild
	// NoteEdited names the skill that was changed and the file it was changed
	// in. It is a separate note from NoteWrote rather than the same one reworded,
	// because the two are different events to the reader: one added something
	// nobody carries yet, and the other changed something units already carry.
	NoteEdited
	// NoteBattleVerify is what to do with a battle log once it is written, and
	// it carries the rebuild warning rather than sitting beside one: a log is
	// re-run against the copy baked into the game binary, so "rebuild first" is
	// part of the instruction rather than a separate caution about this file.
	NoteBattleVerify
	// NoteGoldensMove warns that a balance change has moved the golden files,
	// and that reading that diff is the next step rather than an afterthought.
	// It follows a skill, because a skill is balance: its power reaches the
	// damage tables, the hits-to-kill ladder and the scenario measurements.
	NoteGoldensMove
)

type NumberError

type NumberError struct {
	Raw string
	Err error
}

NumberError is an answer that was meant to be a number and is not.

It carries no bounds, deliberately: what a legal power or a legal cooldown is belongs to skill.ParseBook, and a second opinion here would be a second declaration of it. This is only the difference between "that is not a number" and "that number will not do".

func (*NumberError) Error

func (e *NumberError) Error() string

func (*NumberError) Unwrap

func (e *NumberError) Unwrap() error

type OriginRestrictedError

type OriginRestrictedError struct {
	Character string
	Skill     string
	Allowed   []string
}

OriginRestrictedError is a skill kept for a work the character was not borrowed from.

It carries the character for SpeciesRestrictedError's reason, and it is a type of its own rather than a species error with a different list because the two refusals are about different things: one says the holder is the wrong kind of creature and the other says it is out of the wrong story, and a front-end has to be able to say which.

func (*OriginRestrictedError) Error

func (e *OriginRestrictedError) Error() string

type OriginTakenError

type OriginTakenError struct{ ID string }

OriginTakenError is a work whose id is already catalogued.

func (*OriginTakenError) Error

func (e *OriginTakenError) Error() string

type Preset

type Preset struct {
	Skills  []string
	Demands []string
}

Preset is a role preset as a chooser wants it: the kit it supplies and the elements that kit will insist on, both as the ids they are written with.

func PresetFacts

func PresetFacts(preset cast.Archetype) Preset

PresetFacts reads a preset without wording anything about it.

type PresetLineageSkillError

type PresetLineageSkillError struct {
	Archetype string
	Skill     string
	Allowed   []string
}

PresetLineageSkillError is an archetype preset whose kit holds a skill kept for a lineage.

Its own type beside PresetOwnedSkillError rather than one type with an axis field, because the two sentences have nothing in common but their shape: one says the skill belongs to somebody and the other that it belongs to a kind of body. A reader of the refusal needs to be told which, and a single type would make that a switch at every place that words it.

⚠️ This closes a gap rather than opening a feature. cast has refused a lineage skill in a preset since that axis arrived, and this walk did not recognise the refusal — which was never a wrong answer, because the re-parse is the authority here and a refusal nobody recognises keeps the parser's own words, but it was a refusal that named nobody.

There is deliberately no origin twin. See cast.resolveArchetype: a work is universal where a lineage is exceptional, so that ban would empty every preset rather than trim two.

func (*PresetLineageSkillError) Error

func (e *PresetLineageSkillError) Error() string

type PresetOwnedSkillError

type PresetOwnedSkillError struct {
	Archetype string
	Skill     string
	Allowed   []string
}

PresetOwnedSkillError is an archetype preset whose kit holds a skill kept for named characters.

The judgement is cast.resolveArchetype's, brought forward by CheckPresetKit. It is a refusal the engine can never make, for the same reason ArchetypeRestrictedError is: a roster entry carries no archetype.

func (*PresetOwnedSkillError) Error

func (e *PresetOwnedSkillError) Error() string

The sentence names the skill and its owners and leaves the preset out, even though the preset is carried in a field. Whoever shows this has the preset's id already — it is what they asked about — and a refusal that named it here as well would say it twice in one line.

type Problem

type Problem interface {
	error
	// contains filtered or unexported methods
}

Problem is one reason a check fails.

It is an interface over a closed set of causes rather than a string, because cmd/hexforge-tui says these in the author's language and a sentence cannot be translated once it has been built. The unexported method is what closes the set: only this package can add a cause, so a front-end switching over them has a knowable list — and it still needs a default, which prints the cause's own English rather than nothing.

type Report

type Report struct {
	Dir        string
	Origins    int
	Archetypes int
	Rows       []CharacterReport
	// Problems are the reasons a check fails. Each is a value carrying what it
	// is about, and its Error method is the English cmd/hexforge prints, so a
	// front-end may draw either the sentence or the facts.
	Problems []Problem
	// Warnings are things worth saying that are not reasons to fail.
	//
	// The distinction is the whole reason there are two lists. A short-ranged
	// character on a back column is a design an author may well mean — the rest
	// of the squad stands in front of it, and it is the squad rather than the
	// character that has to reach — so refusing it here would refuse a legal
	// game. Saying nothing at all is the other mistake: that is the shape a
	// battle nobody can act in is built out of, and the moment to notice it is
	// while the character is still in front of whoever wrote it.
	Warnings []Warning
}

Report is the whole result of an inspection, assembled without printing anything.

Separating the finding from the rendering is what makes the check testable and what lets two front-ends draw it differently: a test asks the report whether the missing art was noticed instead of scraping it back out of a screen, and a full-screen client lays the same rows out its own way.

func Inspect

func Inspect(dir string) (Report, error)

Inspect parses the books from disk and asks the filesystem the one question the parsers may not.

A book that will not parse comes back as an error rather than a report: there is nothing to tabulate if the data does not load, and the parser's own message already says exactly what is wrong.

func (Report) OK

func (r Report) OK() bool

OK reports whether the data directory is in a state worth shipping.

type ResolveProblem

type ResolveProblem struct {
	ID  string
	Err error
}

ResolveProblem is a character whose evolution line will not resolve at one of the levels a check tries.

func (*ResolveProblem) Error

func (p *ResolveProblem) Error() string

func (*ResolveProblem) Unwrap

func (p *ResolveProblem) Unwrap() error

type Result

type Result uint8

Result is how one duel ended, from the challenger's side.

const (
	// Won, Lost and Drawn are the three ways a duel that finished can read.
	// Drawn is both a stalemate and a mutual kill: they are different events in
	// the engine and the same answer to "which of these two was better".
	Won Result = iota
	Lost
	Drawn
	// Endless is the turn limit reached with both still standing and still
	// acting — two units buffing themselves at each other for ever. It is kept
	// apart from a draw because a draw is an answer and this is the absence of
	// one.
	Endless
)

type ShapeCoverage

type ShapeCoverage struct {
	Shape string
	// AimedAt is the side the skill carrying this shape aims at, because it
	// changes what the shape covers: a skill aimed at both halves spreads across
	// the midline where every other one stops at it.
	AimedAt skill.Side
	Primary hex.Offset
	Splash  []hex.Offset
	// Max is how many cells the shape covers when nothing is dropped, so a
	// caller can say that this aim loses one rather than only how many it got.
	Max int
}

ShapeCoverage is what a shape catches from the diagram's cell: values, for a screen to draw.

Splash is separate from Primary rather than being the tail of one list, because the two are not worth the same — the primary takes a skill's whole power and a splash cell takes the pattern book's share of it — and a renderer that has to know which end of a slice is which would be a renderer deciding it.

func (ShapeCoverage) Covered

func (c ShapeCoverage) Covered() int

Covered is how many cells the shape really catches from here.

func (ShapeCoverage) Whole

func (c ShapeCoverage) Whole() bool

Whole reports whether the shape draws in full from this cell.

type ShortReachWarning

type ShortReachWarning struct {
	ID        string
	Archetype string
	// Range is the deepest the character's kit can be pointed, in ranks.
	Range int
}

ShortReachWarning is a character whose kit can only ever hit the enemy's front rank.

⚠️ It used to mean something else: a unit whose range could not span the cells between it and the nearest enemy, which battle.New refused outright. Reach is counted in ranks now, so distance can no longer strand anybody and that refusal is gone — see CLAUDE.md § Invariants.

What is left is worth saying at authoring time all the same. A kit that stops at the first rank can do nothing at all until the enemy's front line is dead, so the character is a passenger for the opening of every battle it is in. That is a legal thing to build and sometimes a deliberate one, which is why it is a warning rather than a refusal.

func (*ShortReachWarning) Error

func (w *ShortReachWarning) Error() string

type SkillCasts added in v0.2.0

type SkillCasts struct {
	Skill string
	Cast  int
}

SkillCasts is how often one of a build's skills was actually cast.

A count rather than a share, because the question a census answers is whether a slot is used *at all*, and a share of nought is that same nought with a division in front of it.

type SkillChange

type SkillChange struct {
	Before, After             skill.Skill
	BeforeDamage, AfterDamage SkillPreview
}

SkillChange is a written edit: the skill before and after, and what each is worth.

The two damage figures are the point of returning a value at all rather than just an error. A skill is balance, so what an author needs after a write is not that it succeeded but what moved — and both figures come from the one PreviewDamage reference, so the before is comparable with the after and both are comparable with skills.golden's own column.

func (SkillChange) DamageSummary

func (c SkillChange) DamageSummary() string

DamageSummary is MovesDamage's figures as the English cmd/hexforge prints.

func (SkillChange) MovesDamage

func (c SkillChange) MovesDamage() bool

MovesDamage reports whether the edit changed what the skill is worth.

A front-end uses it to leave the before-and-after line out when there is nothing to compare: an edit to a restriction or a targeting side moves no damage, and a line saying a number did not change is a line that has to be read to learn nothing.

type SkillDraft

type SkillDraft struct {
	ID string
	// Name is the skill's display name, which is authored here rather than
	// compiled in: see skill.Skill.Name. An empty answer is an absent name and
	// the skill renders as its bare id, which is why nothing here defaults it.
	Name string
	// Flavour is the clause a description opens with — prose, and never a figure,
	// which skill.ParseBook refuses. Authored here for the same reason Name is:
	// the words a skill is read in are written in the same sitting as the skill.
	Flavour  string
	Element  string
	Target   string
	Range    string
	Pattern  string
	Power    string
	Strikes  string
	Accuracy string
	Cooldown string
	// Applies is the statuses the skill inflicts, comma separated, each written
	// "status:chance" or "status:chance:stacks".
	Applies string
	// SelfApplies is the same list, put on the caster instead of the target. It
	// is a separate answer rather than a marker inside Applies because the two
	// reach different units and a skill regularly does both.
	SelfApplies string
	// Pierce is the share of the target's defence the skill ignores, in parts
	// per thousand. Empty is the common case and means none.
	Pierce string
	// Crit is the chance each strike lands critically, in parts per thousand.
	// Empty is the common case and means never.
	Crit string
	// Restores is health given to whoever the skill targets, in parts per
	// thousand of the caster's scaling stat.
	Restores string
	// Drains is the share of the damage dealt that comes back to the caster,
	// also in parts per thousand.
	Drains string
	// The five allowlists, comma separated. An empty answer is an absent list,
	// which is what makes the common pool the default shape: a skill authored
	// with nothing filled in here is written with no restrict block at all,
	// rather than with an empty one, which would be the error case.
	RestrictElements   string
	RestrictArchetypes string
	RestrictCharacters string
	RestrictSpecies    string
	RestrictOrigins    string
}

SkillDraft is every answer that makes a skill, held as text until Resolve.

Text rather than numbers for the same reason Draft holds text: a flag-only invocation, a prompted one and a form driven by keystrokes have to turn into the same skill, and they only do if they meet at one parse. The alternative — typed flags — would leave the command line refusing a bad power in the flag package's words and the form refusing it in this package's, which is one rule worded twice.

func SkillAnswers

func SkillAnswers(current skill.Skill) SkillDraft

SkillAnswers is a skill written back out as the answers it would be authored from, which is what prefilling an edit needs.

It is resolveOnto's inverse, and it exists so that accepting every field as it stands reproduces the skill exactly — the same property FormatApplications and FormatCurve have, for the same reason. A front-end that formatted these itself would be free to write a power as "1200 " or an absent restriction as an empty list, and either would turn "change nothing" into a change.

func (SkillDraft) Resolve

func (d SkillDraft) Resolve(lib *Library) (skill.Skill, error)

Resolve turns a draft into a skill, or says which answer is wrong.

The candidate is appended to a copy of the book, which validates it exactly as loading the file would — every bound on a power, an accuracy or a stack count is skill.ParseBook's, and none of them is restated here.

func (SkillDraft) ResolveEdit

func (d SkillDraft) ResolveEdit(lib *Library, id string) (skill.Skill, error)

ResolveEdit turns a draft into the skill it would change an existing one into, or says which answer is wrong.

It is Resolve's other half and differs in exactly two ways. The candidate goes through skill.Book.Replace rather than Append, so the skill keeps its place in declaration order — the reason that matters is on Replace. And it is built onto the skill as it stands rather than onto an empty one, so the blocks the form does not ask about survive; see resolveOnto.

The id is not editable, and an attempt to change it is refused here rather than in either front-end. A rename would have to cascade through every character's kit, every preset's kit and every restrict.characters list that names the old id, and a half-built rename that moved the declaration and left the references behind would leave a book that does not load.

func (SkillDraft) Restriction

func (d SkillDraft) Restriction() (*skill.Restriction, error)

Restriction is the five allowlists a draft names, or nil when it names none.

Nil rather than an empty block is the whole of the common pool being the default: skill.ParseBook refuses a restrict block that restricts nothing, so a form that always wrote one would refuse every ordinary skill.

type SkillEdit

type SkillEdit struct {
	// ID is only ever here to be refused. It is carried so that a front-end can
	// pass on what was asked for and get this package's refusal rather than
	// wording one of its own. See SkillDraft.ResolveEdit.
	ID   *string
	Name *string
	// Flavour is the authored opening clause. It is here so that the CLI can
	// write one at all: until it was, the clause could only be typed into the
	// TUI or into the JSON by hand, which made the one field a person actually
	// composes the one field a pipe could not reach.
	//
	// An empty string clears it, on the same terms as the allowlists below — a
	// skill with no clause opens with the derived sentence instead, which is a
	// real answer rather than a missing one.
	Flavour *string
	// Element and the rest are the fields an edit may name.
	Element  *string
	Target   *string
	Range    *string
	Pattern  *string
	Power    *string
	Strikes  *string
	Accuracy *string
	Cooldown *string
	// SelfApplies, Pierce, Crit, Restores and Drains, like every other field here, are nil
	// when the flag was not given and point at an answer when it was — so an
	// empty string clears a list or zeroes a figure, and an absent flag leaves
	// it alone.
	SelfApplies *string
	Pierce      *string
	Crit        *string
	Restores    *string
	Drains      *string
	Applies     *string

	RestrictElements   *string
	RestrictArchetypes *string
	RestrictCharacters *string
	RestrictSpecies    *string
	RestrictOrigins    *string
}

SkillEdit is a partial change to a skill: a field it does not name is left exactly as it is.

A pointer per field rather than a string, and that is the trap this type exists to close: an answer nobody gave and an answer of zero are different things, and a zero value cannot tell them apart. `--cooldown 0` means make the cooldown zero; no `--cooldown` at all means leave whatever is there. A front-end comparing against "" would silently turn the first into the second, and the author would be left with a cooldown they had explicitly cleared and which had not moved.

An explicitly empty string is therefore a real answer, and on the three allowlists it is the only way to say "clear this": SplitList reads it as no entries, and Restriction turns three empty lists into no restrict block at all, which is a skill back in the common pool.

func (SkillEdit) Draft

func (e SkillEdit) Draft(current skill.Skill) SkillDraft

Draft lays a partial change over a skill as it stands, producing the whole set of answers the skill would be authored from.

A partial edit and a filled-in form therefore arrive at the same place — one SkillDraft — which is what keeps a flag-driven edit and a form-driven one from applying different rules. The answers not named come from SkillAnswers, so they are the values the file already holds.

func (SkillEdit) Names

func (e SkillEdit) Names() bool

Names reports whether an edit changes anything at all, which is what a front-end refusing an empty invocation needs.

type SkillEditBreaksError

type SkillEditBreaksError struct {
	Carrier BrokenCarrier
	// ID is the character or preset that would break, empty when the refusal
	// belongs to no single one.
	ID    string
	Skill string
	Err   error
}

SkillEditBreaksError is an edit that would leave something already authored unable to carry the skill.

Err is the reason, and it is either one of this package's own typed refusals — the classified case, where a carrier walk found who breaks and why — or the parser's own words, for a refusal about a kit as a whole rather than about one skill in it. ID is empty in that second case, and a front-end then says what the parser said rather than blaming a carrier that may not be at fault.

func (*SkillEditBreaksError) Error

func (e *SkillEditBreaksError) Error() string

func (*SkillEditBreaksError) Unwrap

func (e *SkillEditBreaksError) Unwrap() error

type SkillPreview

type SkillPreview struct {
	// Attack and Defense are the reference figures the damage is measured
	// against, carried so a front-end can name them rather than assume them.
	//
	// Defense is what the skill faces rather than what the defender has: a
	// piercing skill's share is already off it. That keeps the line able to
	// explain itself — a reader who divides by the defence named here reproduces
	// the damage named beside it — which is the same reason the event log carries
	// the pierce it resolved at.
	Attack, Defense int64
	// PerStrike is one strike's damage and Total is every strike's, which is
	// the figure to compare two skills of different strike counts by.
	PerStrike, Total int64
	Strikes          int
	// Amplified is Total with everything the skill asks for holding, or zero when
	// it asks for nothing. The authoring form cannot write a condition, but it
	// can edit the power of a skill that has one.
	//
	// ⚠️ **Everything, not only the target's condition.** A skill has three terms
	// that can raise its power and two of them are read against the *caster* —
	// `self_requires` as a threshold and `self_gradient` as a curve — so a preview
	// that read only `requires` showed `outrage` and `comeback` at their plain
	// power and an author editing either had no figure at all for the thing that
	// makes the skill what it is.
	Amplified int64
}

SkillPreview is what a skill would do, measured before it is written.

A skill is balance rather than content, so the figure that matters is not whether the answers parse but what they are worth against a reference target. Without it an author picks a power, saves, and finds out at the next test run that a dozen golden numbers moved.

type SkillRenameError

type SkillRenameError struct{ From, To string }

SkillRenameError is an edit that would change a skill's id.

It is a refusal rather than a rename because a rename is a different operation: the id is named by every kit that carries the skill, by every preset's kit, and by every restrict.characters list that keeps it for somebody, so moving the declaration alone would leave a book that does not load. The refusal says so rather than saying no, because an author who typed a new id wants to know what would have to happen, not only that it did not.

func (*SkillRenameError) Error

func (e *SkillRenameError) Error() string

type SkillTakenError

type SkillTakenError struct{ ID string }

SkillTakenError is an id that is already in the skill book.

func (*SkillTakenError) Error

func (e *SkillTakenError) Error() string

type SparReport

type SparReport struct {
	Challenger Duellist
	// Seeds is how many duels each half of each row was fought over, so a row
	// counts twice this many.
	Seeds    int
	Matchups []Matchup
}

SparReport is a character measured against the cast it belongs to.

func (SparReport) Opponents

func (r SparReport) Opponents() int

Opponents is how many rows the headline rate was taken from.

func (SparReport) Rate

func (r SparReport) Rate() int

Rate is the challenger's share across every opponent, the mirror excluded.

The mirror is left out because it is a control rather than a matchup: a balanced mirror is exactly even whatever the character is, so counting it drags every answer towards the middle and hides exactly what the report is for.

type SpeciesRestrictedError

type SpeciesRestrictedError struct {
	Character string
	Skill     string
	Allowed   []string
}

SpeciesRestrictedError is a skill kept for a lineage the character is not.

It carries the character rather than only the skill for the same reason CharacterRestrictedError does: the refusal is about a pairing, and a front-end wording it has to be able to name both halves.

func (*SpeciesRestrictedError) Error

func (e *SpeciesRestrictedError) Error() string

type SpeciesTakenError

type SpeciesTakenError struct{ ID string }

SpeciesTakenError is a kind whose id is already catalogued.

func (*SpeciesTakenError) Error

func (e *SpeciesTakenError) Error() string

type SquadReport

type SquadReport struct {
	Home, Away placement.Squad
	// Seeds is how many battles each half was fought over, so a report counts
	// twice this many.
	Seeds int
	// AsAlly and AsEnemy are the home squad's tallies from each half of the
	// swap, kept apart rather than folded because the difference between them is
	// a finding in its own right: it is what the side itself is worth, and on
	// this board that is not nothing.
	AsAlly, AsEnemy Tally
	// Turns is the median length of a battle that finished, in turns.
	Turns int
	// Without names the composition bonuses that were switched off for this run,
	// and it is on the report rather than only in the call because a rate
	// measured with a bonus disabled is a rate about a different game. A figure
	// quoted without its condition is the shape this repository has had to
	// re-measure before.
	Without []string
}

SquadReport is what two squads came to over a number of seeds.

It is read from the **home** squad throughout, the way a SparReport is read from its challenger: a rate needs a subject, and a report that reported both would be two numbers that always add to a thousand.

func (SquadReport) Mirror

func (r SquadReport) Mirror() bool

Mirror reports whether a squad was fought against itself, which is a control rather than a matchup: it reads exactly even by construction, and a figure that did not would mean the swap was not cancelling what it is there to cancel.

func (SquadReport) Rate

func (r SquadReport) Rate() int

Rate is the home squad's share in parts per thousand.

func (SquadReport) Total

func (r SquadReport) Total() Tally

Total is the home squad's record across both halves.

type Stage

type Stage struct {
	Name     string
	MinLevel int
}

Stage is one step of an evolution line: what it is called and the level it takes over at.

func StageFacts

func StageFacts(character cast.Character) []Stage

StageFacts is an evolution line as the pairs behind it.

type StatFieldError

type StatFieldError struct {
	Kind progression.Kind
	Err  error
}

StatFieldError names which stat a curve refusal belongs to, which a form column already shows and a flag-driven run does not.

func (*StatFieldError) Error

func (e *StatFieldError) Error() string

func (*StatFieldError) Unwrap

func (e *StatFieldError) Unwrap() error

type StatusFacts

type StatusFacts struct {
	ID       string
	Category string
	// Duration is how many of the holder's turns one fresh stack lasts, and
	// MaxStacks how many can be layered.
	Duration, MaxStacks int
	// Ticks is whether the status deals damage of its own each turn, which is
	// the one thing about a status that changes what a skill applying it is
	// worth.
	Ticks bool
	// Permanent is a status that never runs out, and it is carried because
	// Duration says nothing about one: a permanent status holds a duration of
	// nought, so a reader handed only the number prints it as a status about to
	// expire.
	Permanent bool
}

StatusFacts is one status as a chooser wants to show it.

Values rather than a sentence, on the terms the rest of this package hands facts over: two front-ends and two languages word the same numbers, and a sentence built here would be built in one of them.

type Strikes

type Strikes struct {
	Cast     int
	Landed   int
	Critical int
	Damage   int64
}

Strikes is what one unit's attacking came to over a set of duels.

It is here rather than derived from a rate because a rate cannot say whether anything happened. A skill that was never cast, or cast and never landed, has a perfectly ordinary-looking win rate beside it — and a figure that prices a mechanism which never fired is worth less than no figure at all, because it reads as "rated at nought" when it means "not rated". Cast, Landed and Critical are what let a report refuse such a row instead of printing it.

Cast counts one per use, Landed counts one per strike that connected, so a two-strike skill lands twice per cast at most and the two columns are not comparable to each other. Damage is the total dealt, which is the size of what the other three are counting.

type Tally

type Tally struct {
	Wins    int
	Losses  int
	Draws   int
	Endless int
}

Tally is what a set of duels came to, from the challenger's side.

func (Tally) Battles

func (t Tally) Battles() int

Battles is how many duels this tally counts.

func (Tally) Rate

func (t Tally) Rate() int

Rate is the challenger's share in parts per thousand, a draw counting half to each side. An endless duel is left out of both halves of the fraction: it is not a result, and scoring it as one would let a pair that never resolves drag a rate towards whichever number the code picked.

Parts per thousand rather than a float, for the reason every other ratio in this repository is: the engine has no floats in it, and a tool reporting in them would be the only thing here that could disagree with itself about what a number is. A tally with nothing decided is zero, which is what its counts say.

type TraitBudget

type TraitBudget struct {
	Trait  string
	Values progression.Values
	Budget Budget
}

TraitBudget is what one character costs while one trait is held.

It exists because the budget on the row above it is measured against a line nobody fights on. See Library.Held for the whole of why that is, and why the answer here is a figure rather than a refusal.

type TraitCarrier

type TraitCarrier struct {
	// Character is the character's id, which is what a listing shows: a name is
	// authored prose and two characters may share one.
	Character string
	// AtLevel is the first level it has the trait at, and Stages the forms that
	// may hold it — the same two gates cast.Unlock declares, carried through so
	// a listing can say "endurance@16" without re-reading the learnset.
	AtLevel int
	Stages  []string
}

TraitCarrier is one character that learns a trait, and where in its life.

type UnevenControlError

type UnevenControlError struct {
	Skill string
	Field WeighField
	Value int
	Rate  int
	Tally Tally
}

UnevenControlError is a control row that did not come out exactly even.

It is a type for the reason above and one more: across a table of carriers every other refusal says the *carrier* is uninteresting, and this one says the *harness* leaked. Those must not print as the same kind of line, and a reader asked to tell them apart by reading the sentence will one day not.

func (*UnevenControlError) Error

func (e *UnevenControlError) Error() string

type UnknownArchetypeError

type UnknownArchetypeError struct {
	ID    string
	Known []string
}

UnknownArchetypeError is a preset that does not exist, with the ones that do.

func (*UnknownArchetypeError) Error

func (e *UnknownArchetypeError) Error() string

type UnknownCharacterError

type UnknownCharacterError struct{ ID string }

UnknownCharacterError is a name that is not in the cast. It is raised by an allowlist naming somebody who does not exist, which is the same mistake as an empty allowlist: nobody satisfies it.

func (*UnknownCharacterError) Error

func (e *UnknownCharacterError) Error() string

type UnknownElementError

type UnknownElementError struct {
	Name string
	Err  error
}

UnknownElementError is a name that is not an element. element.Parse decides; this carries what was typed so a form can say so in its own language.

func (*UnknownElementError) Error

func (e *UnknownElementError) Error() string

func (*UnknownElementError) Unwrap

func (e *UnknownElementError) Unwrap() error

type UnknownOriginError

type UnknownOriginError struct{ ID string }

UnknownOriginError is a work that is not in the catalog. It carries the command that would add it, because a refusal an author cannot act on is only half a refusal.

func (*UnknownOriginError) AddCommand

func (e *UnknownOriginError) AddCommand() string

AddCommand is what a person would type to catalog the missing work.

func (*UnknownOriginError) Error

func (e *UnknownOriginError) Error() string

type UnknownPatternError

type UnknownPatternError struct {
	Name string
	Err  error
}

UnknownPatternError is a shape the pattern book does not hold. The judgement is pattern.Book.Lookup's; this only carries the name alongside it.

func (*UnknownPatternError) Error

func (e *UnknownPatternError) Error() string

func (*UnknownPatternError) Unwrap

func (e *UnknownPatternError) Unwrap() error

type UnknownSkillError

type UnknownSkillError struct {
	ID  string
	Err error
}

UnknownSkillError is a kit naming a skill the book does not hold. The judgement is skill.Book.Lookup's; this only carries the id alongside it.

func (*UnknownSkillError) Error

func (e *UnknownSkillError) Error() string

func (*UnknownSkillError) Unwrap

func (e *UnknownSkillError) Unwrap() error

type UnknownSpeciesError

type UnknownSpeciesError struct{ ID string }

UnknownSpeciesError is a kind of creature that is not in the catalog. Like UnknownOriginError it carries the command that would add it.

func (*UnknownSpeciesError) AddCommand

func (e *UnknownSpeciesError) AddCommand() string

AddCommand is what a person would type to catalog the missing species.

func (*UnknownSpeciesError) Error

func (e *UnknownSpeciesError) Error() string

type UnknownStatusError

type UnknownStatusError struct {
	ID  string
	Err error
}

UnknownStatusError is a status the book does not hold, on the same terms.

func (*UnknownStatusError) Error

func (e *UnknownStatusError) Error() string

func (*UnknownStatusError) Unwrap

func (e *UnknownStatusError) Unwrap() error

type UnknownTargetError

type UnknownTargetError struct {
	Name string
	Err  error
}

UnknownTargetError is a targeting side that is not one, on the same terms.

func (*UnknownTargetError) Error

func (e *UnknownTargetError) Error() string

func (*UnknownTargetError) Unwrap

func (e *UnknownTargetError) Unwrap() error

type Warning

type Warning interface {
	error
	// contains filtered or unexported methods
}

Warning is something a check noticed that is not a reason to fail.

It is a closed set of causes with the same shape as Problem, and for the same reason: cmd/hexforge-tui says these in the author's language, and a sentence cannot be translated once it has been built.

type WeighField

type WeighField uint8

WeighField is the one number a weighing moves.

It is not called Field because this package already has one: forge.Field names which authored answer internal/core/cast refused, and the two have nothing to do with each other. The longer name is the cost of keeping both legible.

It is a closed table rather than a name looked up by reflection, and what is *not* in it is the design rather than an omission.

Every member is one bounded integer whose bound skill.resolve already enforces, so a value out of range comes back in the parser's own words and this package never restates a rule the parser holds.

⚠️ `self_gradient` is in the table, and it is the one member whose *off* state is not a number. skill.Gradient has exactly one field, AtEmpty — its own doc says why there is no second one: the top of the curve is not a choice — so a sweep of it is one line rather than a surface, and MonotoneWorth keeps exactly the meaning it has on every other field here: one field, one sweep, one answer to whether more of this is sometimes worth less. What is different is the bottom of that line. resolveGradient refuses AtEmpty below one, so a skill that declares no gradient carries a nil pointer where every other field is off at a nought a crit is legal at. `of` reads that absence as nought — nil-safe the way Gradient.Share is — and `set` hands the nought straight back to the parser rather than translating it.

⚠️ The honest consequence, stated here rather than worked around: this field prices **how much** a gradient is worth and never **whether to have one**. A sweep may not contain the control row of a skill that declares none, because that control is a nought and the parser refuses it — so no report here has a row for "this skill without a gradient at all", and none can be read as one. Mapping the nought back to nil inside `set` would buy that row and would be this package holding a second copy of a bound skill.resolve owns, which is the one thing `set` exists not to do. See TODO.md.

⚠️ Nothing shipped carries it either: `comeback` is the only skill in the book that declares a gradient and no character fields it, so `--carriers all` on it is an empty table of skips. That is the state of the data rather than a fault in the field, and the fix is a character bringing it, not a change here.

Every non-scalar is left out for a different reason: `applies`, `strips`, `summons`, `restriction`, `element`, `target` and `pattern` are not dials. Changing one authors a *different skill*, so the deviation measured against the control would be the worth of that other skill rather than the price of a value, and the whole claim a weighing makes is that the two sides differ in one number.

const (
	// WeighAccuracy through WeighStrikes are declared in the order their names
	// sort, so WeighFields is declaration order and the two cannot drift apart.
	WeighAccuracy WeighField = iota
	WeighCooldown
	WeighCrit
	WeighDrains
	WeighPierce
	WeighPower
	WeighRange
	WeighSelfBonus
	WeighSelfGradient
	WeighStrikes
)

func ParseWeighField

func ParseWeighField(name string) (WeighField, error)

ParseWeighField resolves a field by name.

func WeighFields

func WeighFields() []WeighField

WeighFields is every weighable field, sorted by name.

func (WeighField) String

func (f WeighField) String() string

String is the field's name as it is typed and printed.

type WeighReport

type WeighReport struct {
	Carrier Duellist
	Skill   string
	Field   WeighField
	// Shipped is the value the book declares, which is the control row's value.
	Shipped int
	Seeds   int
	// Band is the two-sigma width of a row's rate in parts per thousand: the
	// figure a difference has to clear before it is a finding rather than noise.
	Band int
	// Mechanisms is what the swept skill does, which is what a row has to have
	// done to be believed and what the drawing gives a column each. It is the
	// union over the swept values rather than the control's own: see
	// mechanismsOver.
	Mechanisms []Mechanism
	Rows       []Weighing
}

WeighReport is a sweep of one field, and everything needed to read it.

func (WeighReport) Battles

func (r WeighReport) Battles() int

Battles is how many duels the whole report was taken from.

func (WeighReport) MonotoneTurns

func (r WeighReport) MonotoneTurns() bool

MonotoneTurns reports the same about the median turn count.

It is a separate answer from MonotoneWorth and is reported separately, because the two can disagree and the disagreement is the finding: a row whose worth sits inside the band while its turns moved has a real effect that the rate was too lumpy to see.

func (WeighReport) MonotoneWorth

func (r WeighReport) MonotoneWorth() bool

MonotoneWorth reports whether worth only ever moves one way across the sweep, counting a step inside the band as no step at all.

A dial that is not monotone is not priced, whatever the numbers say: if more of a thing is sometimes worth less, then the figure beside any one value is not the value's worth. This is the check the roster win rate failed — more ally damage lowered it — and it is on the report so that it is read every time rather than remembered.

type WeighRequest

type WeighRequest struct {
	Character string
	Skill     string
	Field     WeighField
	// Values are the values to sweep. The skill's own value is always added, so
	// a sweep that forgot the control still has one.
	Values []int
	Level  int
	// Seeds is how many battles each half of each row is fought over, so a row
	// costs twice this many.
	Seeds int
	// Stage is the form the carrier is weighed as, and is only ever needed on a
	// line that forks — absent means the furthest the level reaches, which is
	// what every weighing meant before any line had two arms. A forking carrier
	// with none is refused naming both, because a price is a fact about one
	// stat line and two arms are two of them.
	Stage string
}

WeighRequest is one price to be taken: one field, on one skill, as one character carries it.

type Weighing

type Weighing struct {
	Value int
	// Control marks the row where the field is left at the value the book
	// declares. Both sides are then the same skill under two ids, so it must
	// read exactly even — and a report whose control does not is refused whole.
	Control bool
	// Rate is the challenger's balanced share in parts per thousand, both slots
	// added up.
	Rate int
	// Turns is the median length of the duels that finished.
	Turns int
	// Edge is what moving first was worth in this row, in parts per thousand.
	Edge    int
	Tally   Tally
	Strikes Strikes
	// Effects is everything the skill did that was not a strike, which for a
	// skill of nought power is everything it did at all.
	Effects Effects
}

Weighing is one row: what the field was set to, and what that was worth.

func (Weighing) Worth

func (w Weighing) Worth() int

Worth is the deviation from an even split, signed, in parts per thousand.

This is the whole of what a weighing reports. The two sides are the same unit, the same stats, the same kit, the same placement and the same level, fought from both slots so the queue's tie-break cancels — so everything that could make the figure anything other than the price of the one field has been made identical on purpose, and what is left over is that field.

type YearError

type YearError struct {
	Raw string
	Err error
}

YearError is a work's year that will not read as a number.

func (*YearError) Error

func (e *YearError) Error() string

func (*YearError) Unwrap

func (e *YearError) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL