Namespace in reactor_fight_tactical.js

G

31 public functions in 4 groups · show internal (_) functions

A Tactical battle on a 2D map.

Quick Reference

Getting Information 2

heightOf() The ground a character stands on, in tiles (0 on a 2D map).
heightAt() Height at.

Checks (True / False) 1

canStopAt() Whether it can stop at.

Actions 2

forget() What the grid kept of the map for this turn (the ways on from each cell, where a big body has room) is read a…
forgetSight() What was kept about which cells hide is asked again (the map calls this as it refreshes).

Other 26

levelHeights() Level heights.
stands() Stands.
crosses() Crosses.
is3D() Whether heights count here: a 3D map with the 3D world loaded.
groundAt() The ground at a cell, nearest the height near.
cellCost() What entering a cell costs: 1, a Set Terrain Cost for its region or terrain tag (0 shuts it), 2 for a bush or…
fitsAt() Whether a unit's body, facing d, fits with the unit on cell (x, y) at about height, as the field stands now.
flood() Every cell a unit can reach for budget, cheapest way first, from where it stands.
reachedBounds() Reached bounds.
floodStart() Flood start.
floodRun() Go on with the flood begun by floodStart until it is done or the clock passes deadline (a slice of cells is a…
costAt() After a flood: what a cell cost to reach (Infinity when it was not), whether a unit may stop on it, and the h…
lossAt() After a flood: the HP the way to a cell costs in falls (0 where none hurts, or it was not reached).
lethalAt() After a flood: whether the way to a cell ends in a fall that leaves the unit with no HP.
grappledAt() After a flood: whether a cell is reached by a grapple's pull (the edge itself, not a step walked on from it).
spentAt() After a flood: whether the way to a cell takes the unit's action (a grapple that costs it).
facingAt() After a flood: the way the unit faces when it arrives on a cell (2, 4, 6, 8: its last step's direction, or th…
reachedAt() After a flood: every level reached on a cell, as out = [height, cost, height, cost, ...]; returns how many.
pathTo() After a flood: the steps from the unit to a cell it reached (the level h of it), [{ x, y, d, hop, kind, heigh…
blocksSight() Whether a cell hides what is behind it by its tiles alone: one nobody can walk onto from any side, unless it…
sightBody() How tall the bodies of the battle stand, for where their eyes and chests are: the leader's model on a 3D map…
sight() Whether a unit at (ax, ay) standing at height ah has a line to one at (bx, by) at bh: from its eyes to the ot…
cover() The cover a target at (tx, ty) has from an attacker at (ax, ay), two cells or more away: 0 none, 1 half, 2 fu…
flank() Where a blow from (ax, ay) lands on a target at (tx, ty) facing d: "front", "side" or "back".
inArea() Whether cell (x, y) is in an area of that shape aimed at (cx, cy) by a user at (ux, uy).
areaCells() The cells of an area, as [{ x, y }] (for "all": none; the units decide).

Getting Information

heightOf

static source
G.heightOf(character)

The ground a character stands on, in tiles (0 on a 2D map).

heightAt

static source
G.heightAt(x, y, h)

Height at.

Checks (True / False)

canStopAt

static source
G.canStopAt(x, y, h)

Whether it can stop at.

Actions

forget

static source
G.forget()

What the grid kept of the map for this turn (the ways on from each cell, where a big body has room) is read again.

forgetSight

static source
G.forgetSight()

What was kept about which cells hide is asked again (the map calls this as it refreshes).

Other

levelHeights

static source
G.levelHeights(x, y)

Level heights.

stands

static source
G.stands(x, y, height)

Stands.

crosses

static source
G.crosses(x, y, height)

Crosses.

is3D

static source
G.is3D()

Whether heights count here: a 3D map with the 3D world loaded.

Details

Whether heights count here: a 3D map with the 3D world loaded. Everything reads level on a 2D map.

groundAt

static source
G.groundAt(x, y, near)

The ground at a cell, nearest the height near.

cellCost

static source
G.cellCost(fight, x, y, height, deep)

What entering a cell costs: 1, a Set Terrain Cost for its region or terrain tag (0 shuts it), 2 for a bush or wading.

fitsAt

static source
G.fitsAt(fight, unit, x, y, d, height)

Whether a unit's body, facing d, fits with the unit on cell (x, y) at about height, as the field stands now.

flood

static source
G.flood(fight, unit, budget)

Every cell a unit can reach for budget, cheapest way first, from where it stands.

Details

Every cell a unit can reach for budget, cheapest way first, from where it stands. The costs, the way back and the heights stay in the grid's buffers until the next flood. Returns the cells reached.

reachedBounds

static source
G.reachedBounds()

Reached bounds.

floodStart

static source
G.floodStart(fight, unit, budget)

Flood start.

floodRun

static source
G.floodRun(fight, deadline)

Go on with the flood begun by floodStart until it is done or the clock passes deadline (a slice of cells is always taken, so a late caller still gets on).

Details

Go on with the flood begun by floodStart until it is done or the clock passes deadline (a slice of cells is always taken, so a late caller still gets on). Returns true when the flood is complete.

costAt

static source
G.costAt(x, y, h)

After a flood: what a cell cost to reach (Infinity when it was not), whether a unit may stop on it, and the height it is reached at.

Details

After a flood: what a cell cost to reach (Infinity when it was not), whether a unit may stop on it, and the height it is reached at. h names the level on a cell with more than one (the nearest reached within LEVEL_GAP); without it, the cheapest.

lossAt

static source
G.lossAt(x, y, h)

After a flood: the HP the way to a cell costs in falls (0 where none hurts, or it was not reached).

lethalAt

static source
G.lethalAt(x, y, h)

After a flood: whether the way to a cell ends in a fall that leaves the unit with no HP.

grappledAt

static source
G.grappledAt(x, y, h)

After a flood: whether a cell is reached by a grapple's pull (the edge itself, not a step walked on from it).

spentAt

static source
G.spentAt(x, y, h)

After a flood: whether the way to a cell takes the unit's action (a grapple that costs it).

facingAt

static source
G.facingAt(x, y, h)

After a flood: the way the unit faces when it arrives on a cell (2, 4, 6, 8: its last step's direction, or the facing it kept while it backed up there), 0 on its own cell or one it did not reach.

reachedAt

static source
G.reachedAt(x, y, out)

After a flood: every level reached on a cell, as out = [height, cost, height, cost, ...]; returns how many.

Details

After a flood: every level reached on a cell, as out = [height, cost, height, cost, ...]; returns how many. One only passed over is not.

pathTo

static source
G.pathTo(x, y, h)

After a flood: the steps from the unit to a cell it reached (the level h of it), [{ x, y, d, hop, kind, height, face, loss }]; null if it did not.

Details

After a flood: the steps from the unit to a cell it reached (the level h of it), [{ x, y, d, hop, kind, height, face, loss }]; null if it did not. face is the way it faces on the step: d, or the other way round where a long body backs up. loss is the HP a fall on that step takes; a grapple's step also says where the body hangs and the hook holds (bx, by, hx, hy, lip).

blocksSight

static source
G.blocksSight(x, y)

Whether a cell hides what is behind it by its tiles alone: one nobody can walk onto from any side, unless it is water (a boat or a ship sails it), a counter, or has no tile at all.

Details

Whether a cell hides what is behind it by its tiles alone: one nobody can walk onto from any side, unless it is water (a boat or a ship sails it), a counter, or has no tile at all. The rule on a 2D map; a 3D map adds its heights.

sightBody

static source
G.sightBody()

How tall the bodies of the battle stand, for where their eyes and chests are: the leader's model on a 3D map (asked once a second), nothing where the party is sprites.

sight

static source
G.sight(ax, ay, ah, bx, by, bh, look)

Whether a unit at (ax, ay) standing at height ah has a line to one at (bx, by) at bh: from its eyes to the other's chest, stopped by a cell that hides (G.blocksSight) and, on a 3D map, by the ground, by what is built where it is solid (open air under a roof or beside a post stays open), by a shut door and by a model that stands in the way: the same line an Action battle's shots take (Reactor3D.wo…

Details

Whether a unit at (ax, ay) standing at height ah has a line to one at (bx, by) at bh: from its eyes to the other's chest, stopped by a cell that hides (G.blocksSight) and, on a 3D map, by the ground, by what is built where it is solid (open air under a roof or beside a post stays open), by a shut door and by a model that stands in the way: the same line an Action battle's shots take (Reactor3D.worldRay). It is the line an attack that needs sight is allowed by, so glass stops it as it stops a shot; look asks for the line a look takes, which passes glass.

cover

static source
G.cover(ax, ay, tx, ty, th)

The cover a target at (tx, ty) has from an attacker at (ax, ay), two cells or more away: 0 none, 1 half, 2 full.

Details

The cover a target at (tx, ty) has from an attacker at (ax, ay), two cells or more away: 0 none, 1 half, 2 full. What stands in the cell beside the target toward the attacker decides it: something a unit's height or more is full cover, half that (a counter, a low wall) is half; a target standing in a bush has half.

flank

static source
G.flank(ax, ay, tx, ty, d)

Where a blow from (ax, ay) lands on a target at (tx, ty) facing d: "front", "side" or "back".

inArea

static source
G.inArea(shape, size, ux, uy, cx, cy, x, y)

Whether cell (x, y) is in an area of that shape aimed at (cx, cy) by a user at (ux, uy).

areaCells

static source
G.areaCells(shape, size, ux, uy, cx, cy)

The cells of an area, as [{ x, y }] (for "all": none; the units decide).