Namespace in reactor_ui_fight.js

H

62 public functions in 6 groups · show internal (_) functions

The Tactical battle HUD.

Quick Reference

Setup & Creation 1

initials() Initials.

Checks (True / False) 2

isFightNode() Whether it is fight node.
isAimedAt() Whether the action being aimed would land on unit where the cursor is now.

Actions 5

turnLayout() Where the turn tiles sit in a strip width x height.
turnSliders() Which tiles of the strip may slide to their new places.
turnHpFill() How many pixels of a tile's HP line are filled: the line is H.turnHpRect(size, border, out).width wide.
turnHpRect() The thin HP line along the foot of a turn tile, inside its frame.
turnWatchMark() The mark of a unit keeping watch: the upper right corner of its turn tile, inside the frame, a third of the t…

Events, Commands & Input 4

commandStyle() A project's own command words: all capitals?
commandLabel() What Wait or End Turn is called: the node's own word, else the project's (own), else the stock word in the pr…
commandText() A command of the battle's own as the window writes it: its word, led by its icon as an icon code where the pr…
commandGlyph() Whether the HUD draws its own icon beside a command: the project's commands carry icons and the text has none…

Updating & Drawing 11

drawGlyph() The icon the HUD draws for Wait (an hourglass), End Turn (a flag), Mount and Dismount (a wheel and an arrow),…
drawSilhouette() A plain figure for a unit whose portrait is not there yet: head and shoulders, in its side's color.
drawPortrait() Draws the portrait.
drawGauge() One gauge row. Clipped: the label in a column of its own, then a tall bar with two corners cut and the number…
drawUnit() A Unit Panel's contents at the origin.
drawWatchTag() A unit keeping watch says so on its panel: a dark band across the top of its portrait with the words in the a…
drawPreview() The aimed action's forecast, large: hit chance and damage on the first line, critical and what changes the bl…
drawTurnCell() One turn tile at the origin, size square with marker pixels under it for the acting mark.
drawTurnMore() The box that ends a side for the units the strip has no room for: "+N", edged in the side's color.
drawTurnOrder() A whole strip in one pass (the editor's canvas; the game moves one sprite per tile).
drawInfo() A Battle Text line at the origin.

Other 39

boundId() The id System binds as the Tactical battle HUD (0: none of its own, the stock layout plays).
poolOff() Whether key is a resource pool the project turned off (System.json rrPoolsOff, Database > System 1 > Options)…
defaultProps() What a new node of a type starts as (the editor's Add Node, and the base of normalizeProps).
normalizeProps() A stored node's map battle settings, every value in range (missing ones at their defaults).
label() Label.
teamColor() Team color.
reader() The battle as the HUD reads it: itself when it speaks the tactical calls, else a stand-in over it.
newUnitView() An empty unit view; fillUnitView writes into it so a panel keeps one for its whole life.
fillUnitView() What a panel shows of a unit, as plain values.
mix() A 32-bit mix of whole numbers: what a panel shows, folded into one number to compare against its last drawing.
viewKey() Everything a Unit Panel draws from a unit view, as one number: the same number, the same picture.
panelUnit() The unit a Unit Panel shows now, or null when it shows nothing.
previewFor() The aimed action's forecast on the unit a panel shows, or null: only a unit the action would land on has one.
areaSummary() Every target of the aimed action in one line's worth of numbers: { count, index, hitMin, hitMax, damageMin, d…
fitCommands() The command window fitted to its list: as wide as its widest row, and as tall as its rows, squeezed (never un…
blockedReason() Why the player cannot do what is highlighted, as a label key (whyCost comes with what is short in out.what),…
battleTerm() The battle's own words for a key (term(key): its terms, which a project replaces in one place), or '' when it…
reasonText() The words for why a choice cannot be made: the node's own label, else the battle's words for a reason it gave…
phaseText() The words for the side whose turn it is ("Player Phase"), or '' where the turns are not by side.
infoText() The text of a Battle Text node now.
bannerNotice() What the battle itself puts on the phase banner now (notice(): a goal that changed), or ''.
movingSide() Whose units are moving by themselves: what the battle says (actingTeam()), else the acting unit's side (the p…
keyName() A key by its code: its letter or digit, or its short name; '' for a key that has none.
keyRank() How well known a key is, lower first: the named keys of H.KEY_ORDER, then letters, digits, the other named ke…
buttonName() A gamepad button by its index (the standard layout); '' past the ones every pad has.
portraitKind() Which picture stands for a unit: its face, else a portrait of its model, else its map sprite's front frame, e…
characterFrame() The front-facing standing frame of a character sheet: [sx, sy, sw, sh] on a picture width x height.
portraitInset() A unit's picture in a square frame, centered in it with the same inset on every side and never over its borde…
unitLayout() Unit layout.
watchText() The words for a unit that keeps watch: the node's own label, else the battle's, else the HUD's.
percent() Percent.
rangeText() Range text.
previewNotes() What stands between the blow and its full weight, or adds to it: cover, the side it comes from, the height.
bannerAlpha() How visible the phase banner is frame frames after its side's turn began (0 to 1).
bannerState() A phase banner's own record: the words it plays (text, a 'phase' or a 'notice': kind), how far it is (frame o…
bannerStep() One frame of the phase banner.
stockNodes() Stock nodes.
stockRecord() The stock HUD as a whole record (what a project with no HUD of its own gets, and what Stock Layout builds).
sampleReader() Sample reader.

Setup & Creation

initials

static source
H.initials(name)

Initials.

Checks (True / False)

isFightNode

static source
H.isFightNode(type)

Whether it is fight node.

isAimedAt

static source
H.isAimedAt(reader, unit)

Whether the action being aimed would land on unit where the cursor is now.

Actions

turnLayout

static source
H.turnLayout(node, width, height, order, out)

Where the turn tiles sit in a strip width x height.

Details

Where the turn tiles sit in a strip width x height. order is the battle's turn order; the fallen are left out. A tile is out.size square (the node's Cell Size, else H.TURN_REST of the strip's room), one every size + cellGap (three gaps where the other side begins); the acting unit's is out.big, centered on its own place and never nearer than a pixel to its neighbors. When everyone fits, everyone has a tile; a long order shrinks the tiles (down to H.TURN_SMALL of their size) until it does. An army does not fit even so: each side then shows its first few (the side whose turn it is takes the larger share, and the acting unit is always among them) and ends in a box with the count of its others; under initiative, where the sides are mixed, the strip ends in one such box. Writes out.size, out.big, out.top (how far down a tile sits so its middle is level with the acting tile's), out.count, out.ids[], out.xs[], out.sizes[], out.entries[], and out.chips (out.chipCount of them: { x, count, team }, team '' for a mixed count), and returns out.

turnSliders

static source
H.turnSliders(before, count, out)

Which tiles of the strip may slide to their new places.

Details

Which tiles of the strip may slide to their new places. before[i] is where tile i stands now (not a number for a tile that was not there) and the tiles are given in their new order, left to right. Tiles that keep their order slide together and never cross; a tile that changes places with others (it acted and goes behind them, the sides swapped) would slide over them, so it goes out and comes up where it belongs. Writes out[i]: true for a tile that slides. The longest run that keeps its order slides.

turnHpFill

static source
H.turnHpFill(width, hp, mhp)

How many pixels of a tile's HP line are filled: the line is H.turnHpRect(size, border, out).width wide.

turnHpRect

static source
H.turnHpRect(size, border, out)

The thin HP line along the foot of a turn tile, inside its frame.

turnWatchMark

static source
H.turnWatchMark(size, border, out)

The mark of a unit keeping watch: the upper right corner of its turn tile, inside the frame, a third of the tile wide.

Events, Commands & Input

commandStyle

static source
H.commandStyle(terms)

A project's own command words: all capitals?

Details

A project's own command words: all capitals? carrying icons? (from its Attack, Skill and Item terms).

commandLabel

static source
H.commandLabel(node, key, own, style)

What Wait or End Turn is called: the node's own word, else the project's (own), else the stock word in the project's case.

commandText

static source
H.commandText(node, key, own, style, hasIcon)

A command of the battle's own as the window writes it: its word, led by its icon as an icon code where the project's commands carry icons (\\i[n] WAIT), so the window draws it the way it draws Attack.

Details

A command of the battle's own as the window writes it: its word, led by its icon as an icon code where the project's commands carry icons (\\i[n] WAIT), so the window draws it the way it draws Attack. hasIcon says whether the sheet has a picture at an index (none: no code).

commandGlyph

static source
H.commandGlyph(node, key, label, style)

Whether the HUD draws its own icon beside a command: the project's commands carry icons and the text has none (the sheet had no picture there).

Updating & Drawing

drawGlyph

static source
H.drawGlyph(ctx, key, x, y, size, color)

The icon the HUD draws for Wait (an hourglass), End Turn (a flag), Mount and Dismount (a wheel and an arrow), size square at x, y.

drawSilhouette

static source
H.drawSilhouette(ctx, x, y, size, color)

A plain figure for a unit whose portrait is not there yet: head and shoulders, in its side's color.

drawPortrait

static source
H.drawPortrait(ctx, x, y, size, view, theme, color, border, ring)

Draws the portrait.

drawGauge

static source
H.drawGauge(ctx, r, layout, label, value, rate, colors, back, theme, valueColor, mark, markColor)

One gauge row. Clipped: the label in a column of its own, then a tall bar with two corners cut and the numbers on it at its right end; the fill ends on the same slant.

Details

One gauge row. Clipped: the label in a column of its own, then a tall bar with two corners cut and the numbers on it at its right end; the fill ends on the same slant. Bar: the label and numbers over a thin bar. mark is a lighter stretch of the bar from mark.from to mark.to (0 to 1): what the aimed action would take, or what was just lost.

drawUnit

static source
H.drawUnit(ctx, width, height, node, view, theme)

A Unit Panel's contents at the origin.

Details

A Unit Panel's contents at the origin. Returns false while a picture it needs is still loading.

drawWatchTag

static source
H.drawWatchTag(ctx, layout, node, view, theme)

A unit keeping watch says so on its panel: a dark band across the top of its portrait with the words in the acting color (the states keep the portrait's foot); with no portrait, the same band under the panel's header.

drawPreview

static source
H.drawPreview(ctx, rect, node, preview, theme, area)

The aimed action's forecast, large: hit chance and damage on the first line, critical and what changes the blow on the second (a blow that finishes the target says so on a red band instead), and, for an action that lands on several units, all of them summed up on a third.

drawTurnCell

static source
H.drawTurnCell(ctx, size, marker, node, entry, view, theme)

One turn tile at the origin, size square with marker pixels under it for the acting mark.

Details

One turn tile at the origin, size square with marker pixels under it for the acting mark. A unit with life to show has it as a thin line along the tile's foot (low life in the warning color).

drawTurnMore

static source
H.drawTurnMore(ctx, size, count, theme, color)

The box that ends a side for the units the strip has no room for: "+N", edged in the side's color.

drawTurnOrder

static source
H.drawTurnOrder(ctx, width, height, node, order, viewOf, theme)

A whole strip in one pass (the editor's canvas; the game moves one sprite per tile).

drawInfo

static source
H.drawInfo(ctx, width, height, node, value, theme, team)

A Battle Text line at the origin.

Details

A Battle Text line at the origin. The phase banner sits on a band of its side's color.

Other

boundId

static source
H.boundId(system)

The id System binds as the Tactical battle HUD (0: none of its own, the stock layout plays).

poolOff

static source
H.poolOff(key)

Whether key is a resource pool the project turned off (System.json rrPoolsOff, Database > System 1 > Options): its gauge is not drawn.

Details

Whether key is a resource pool the project turned off (System.json rrPoolsOff, Database > System 1 > Options): its gauge is not drawn. HP is never off.

defaultProps

static source
H.defaultProps(type)

What a new node of a type starts as (the editor's Add Node, and the base of normalizeProps).

normalizeProps

static source
H.normalizeProps(source, type)

A stored node's map battle settings, every value in range (missing ones at their defaults).

label

static source
H.label(node, key)

Label.

teamColor

static source
H.teamColor(node, team)

Team color.

reader

static source
H.reader(fight)

The battle as the HUD reads it: itself when it speaks the tactical calls, else a stand-in over it.

newUnitView

static source
H.newUnitView()

An empty unit view; fillUnitView writes into it so a panel keeps one for its whole life.

fillUnitView

static source
H.fillUnitView(view, reader, unit, showTp, preview)

What a panel shows of a unit, as plain values.

Details

What a panel shows of a unit, as plain values. preview is the pending action's forecast on it, or null.

mix

static source
H.mix(hash, value)

A 32-bit mix of whole numbers: what a panel shows, folded into one number to compare against its last drawing.

viewKey

static source
H.viewKey(view)

Everything a Unit Panel draws from a unit view, as one number: the same number, the same picture.

panelUnit

static source
H.panelUnit(node, reader, cycle)

The unit a Unit Panel shows now, or null when it shows nothing.

Details

The unit a Unit Panel shows now, or null when it shows nothing. While an action that lands on several units is aimed, the focused panel steps through them (cycle picks which).

previewFor

static source
H.previewFor(reader, unit)

The aimed action's forecast on the unit a panel shows, or null: only a unit the action would land on has one.

Details

The aimed action's forecast on the unit a panel shows, or null: only a unit the action would land on has one. The acting unit under its own cursor, or anyone the cursor passes outside the action's reach, has none.

areaSummary

static source
H.areaSummary(reader, unit, out)

Every target of the aimed action in one line's worth of numbers: { count, index, hitMin, hitMax, damageMin, damageMax, defeats, heals } written into out, or null when it lands on fewer than two units.

fitCommands

static source
H.fitCommands(nodeHeight, widths, metrics, out)

The command window fitted to its list: as wide as its widest row, and as tall as its rows, squeezed (never under minRow) to keep the node's height where they allow.

Details

The command window fitted to its list: as wide as its widest row, and as tall as its rows, squeezed (never under minRow) to keep the node's height where they allow. widths are the rows' text widths.

blockedReason

static source
H.blockedReason(reader, menu, terms, out)

Why the player cannot do what is highlighted, as a label key (whyCost comes with what is short in out.what), or '' when nothing is in the way.

Details

Why the player cannot do what is highlighted, as a label key (whyCost comes with what is short in out.what), or '' when nothing is in the way. menu is the highlighted row: { kind: 'command' | 'skill' | 'item', symbol, enabled, item }, or null with no menu up.

battleTerm

static source
H.battleTerm(reader, key)

The battle's own words for a key (term(key): its terms, which a project replaces in one place), or '' when it has none.

reasonText

static source
H.reasonText(node, reader, key)

The words for why a choice cannot be made: the node's own label, else the battle's words for a reason it gave, else the HUD's.

phaseText

static source
H.phaseText(node, reader)

The words for the side whose turn it is ("Player Phase"), or '' where the turns are not by side.

infoText

static source
H.infoText(node, reader, menu, terms)

The text of a Battle Text node now.

Details

The text of a Battle Text node now. menu is the highlighted menu row (see blockedReason).

bannerNotice

static source
H.bannerNotice(reader)

What the battle itself puts on the phase banner now (notice(): a goal that changed), or ''.

movingSide

static source
H.movingSide(reader)

Whose units are moving by themselves: what the battle says (actingTeam()), else the acting unit's side (the player's own under Auto, an ally that fights by itself), else the side whose turn it is.

Details

Whose units are moving by themselves: what the battle says (actingTeam()), else the acting unit's side (the player's own under Auto, an ally that fights by itself), else the side whose turn it is. 'enemy' when nothing says.

keyName

static source
H.keyName(code)

A key by its code: its letter or digit, or its short name; '' for a key that has none.

keyRank

static source
H.keyRank(code)

How well known a key is, lower first: the named keys of H.KEY_ORDER, then letters, digits, the other named keys, the number pad, the function keys.

buttonName

static source
H.buttonName(index)

A gamepad button by its index (the standard layout); '' past the ones every pad has.

portraitKind

static source
H.portraitKind(view, theme)

Which picture stands for a unit: its face, else a portrait of its model, else its map sprite's front frame, else an enemy's battle picture, else its initials.

Details

Which picture stands for a unit: its face, else a portrait of its model, else its map sprite's front frame, else an enemy's battle picture, else its initials. theme.thumbnail(model) gives the model's portrait, null while it is being made (a plain figure stands in), false when there is none to be had; nothing here needs a 3D map.

characterFrame

static source
H.characterFrame(name, index, width, height)

The front-facing standing frame of a character sheet: [sx, sy, sw, sh] on a picture width x height.

Details

The front-facing standing frame of a character sheet: [sx, sy, sw, sh] on a picture width x height.

portraitInset

static source
H.portraitInset(size, border)

A unit's picture in a square frame, centered in it with the same inset on every side and never over its border.

Details

A unit's picture in a square frame, centered in it with the same inset on every side and never over its border. A face fills the picture's square (its cell is one); a model's portrait likewise; a map sprite is enlarged in whole steps and an enemy's battle picture scaled to fit, both shown whole and centered. ring, when given, is the frame's color (the acting unit's gold) with the side's color as a line inside it. Returns false when its picture is still loading.

unitLayout

static source
H.unitLayout(node, width, height, showTp, forecast, vehicle)

Unit layout.

watchText

static source
H.watchText(node, view)

The words for a unit that keeps watch: the node's own label, else the battle's, else the HUD's.

percent

static source
H.percent(rate)

Percent.

rangeText

static source
H.rangeText(min, max)

Range text.

previewNotes

static source
H.previewNotes(node, preview, out)

What stands between the blow and its full weight, or adds to it: cover, the side it comes from, the height.

bannerAlpha

static source
H.bannerAlpha(frame, frames)

How visible the phase banner is frame frames after its side's turn began (0 to 1).

bannerState

static source
H.bannerState()

A phase banner's own record: the words it plays (text, a 'phase' or a 'notice': kind), how far it is (frame of span), how visible (alpha), and a notice waiting its turn (next).

Details

A phase banner's own record: the words it plays (text, a 'phase' or a 'notice': kind), how far it is (frame of span), how visible (alpha), and a notice waiting its turn (next). team and notice are what the battle said when last read.

bannerStep

static source
H.bannerStep(state, frames, read, team, phase, notice, hold)

One frame of the phase banner.

Details

One frame of the phase banner. It plays the phase's words each time the turn passes to a side, and what the battle announces (notice(): a new goal) each time that changes. The phase's words come first: they take the banner at once, and a notice that arrives while they play, or that they cut short, plays in full when they are done. read is true on a frame the battle changed, with team, phase (its words) and notice as they are now; hold keeps the banner where it is (out of sight behind a menu, it would play for nobody). Returns true when what is drawn changed.

stockNodes

static source
H.stockNodes(metrics)

Stock nodes.

stockRecord

static source
H.stockRecord(metrics)

The stock HUD as a whole record (what a project with no HUD of its own gets, and what Stock Layout builds).

sampleReader

static source
H.sampleReader(data, options)

Sample reader.