Namespace in reactor_fight.js

F

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

A Tactical battle: climbing onto a roof.

Quick Reference

Setup & Creation 2

makeRewards() Makes the rewards.
makeRun() Makes the run.

Getting Information 3

resolveMode() The mode of the next battle against a troop (0: none): the next-battle setting, then the troop's, then the mo…
resolveTurns() Resolve turns.
dataUnitSpec() Data unit spec.

Checks (True / False) 7

isFoeTeam() Whether a side is against the player's.
isHeld() Whether it is held.
isMode() Whether it is mode.
isOnMap() Whether it is on map.
isSide() Whether a side is what F.oppose answered: the one other side, or with more than two ("!ally") any but that on…
isBattlePage() Whether an interpreter runs a page of the battle itself (a battle page, or a common event one called): such a…
hasOwnPicture() Whether the picture an event shows is its own: a tile or a character sheet, but not the sheet Spawn Unit wrot…

Actions 10

changeMode() The Change Battle Mode command: scope game / map / next; mode "default" clears that scope.
giveRewards() Give rewards.
showResults() The results of a battle that was won: the rewards are given and shown, and done() says the player has read th…
endRegroup() The walk back is over (or cut short): followers trail the leader as they always do.
putBeside() Puts a follower beside lead, on the level a step from the lead's cell ends on, and lets it fade in; where nob…
spawnData() Spawn data.
restoreSpawned() Restores the spawned.
setBattleBranch() The result an event's If Win / If Escape / If Lose rows read, and the variable its command names.
startScreen() Start Battle on Map where the mode is Classic: the battle screen opens against the troop the command names, e…
placePopup() Puts a damage number where its unit is now.

Updating & Drawing 2

stepToward() One step toward a cell as a walker takes it: the diagonal, else along the longer way, else the other.
updateRegroup() One frame of the walk back, before the followers' own update.

Other 62

fallPitch() How far over a falling body is (0 upright, 1 flat), t 0-1 through the fall: slow to tip, quick to land.
oppose() Oppose.
systemSettings() System settings.
overrides() Overrides.
modeNamed() The mode a word names, whatever its letter case ("firstperson" is First Person); "" when it names none.
mapMode() A map's own mode: the first <battle mode: x> tag of its Note, its value in any letter case; where the Note ha…
troopMode() Troop mode.
mapBattlesOn() The mode in force on the map the party is on: what a battle started here now would use with no troop and no n…
modeInForce() Mode in force.
spendNext() The next-battle setting is used up: by the battle it was set for, on the map or on the battle screen.
parseUnitText() <unit: enemy 5>, <unit: actor 3>, <unit: ally 2> (actor 2 on the allies' side), <unit: ally enemy 4>, <unit:…
normalizeUnit() Normalize unit.
ptbsUnit() The PTBS comments on an event's current page as a unit, or null.
eventList() An event's running command list; null while none of its pages meets its conditions.
unitSpecOf() The unit an event's data names: its card, else its note tag, else a page comment or PTBS comment.
pageUnit() The unit an event's data and one page's commands name, kept until the event's card or note changes.
normalizeHook() Normalize hook.
parseHookText() Parse hook text.
pageHook() Page hook.
eventUnit() The unit an event is now, or null.
eventSide() The side the unit an event is now fights on, or "" when it is no unit now: F.eventUnit's answer with no recor…
troopComes() Whether a troop would bring anyone: a member that is not hidden and whose enemy record exists.
keepResults() The results of older battles are let go: nothing waits for them any more.
normalizeObjective() Normalize objective.
staysDefeated() Whether an enemy placed on a map stays defeated once it falls (data: its event's data).
objectiveOfArgs() A command's goal fields as an objective (Start Battle on Map, Change Battle Goal).
standLevel() The height a body put on cell (x, y) stands at, or NaN when the cell holds no place for one.
groundLevel() The height a unit asked for by its cell alone stands at, or NaN.
reachedOnFoot() Whether a place to stand is ground a walker reaches: joined to some cell's own ground, through no more than F…
regroup() Starts the walk back: the frames it may take, and how many of the party walk the map (members: a follower pas…
besideLands() The height a walker leaving lead's cell is at on the cell (dx, dy) beside it, a diagonal one by either of its…
spotBeside() A free cell beside lead a body can stand on, one walked step from the lead's cell (never through a wall or up…
spotBesideOn() As spotBeside, by one rule: "plain" ground only, "any" place a body stands on, or the "water" the lead is in.
spotAround() Where a follower goes when no cell beside lead will do (the lead in a doorway, on a post, in a crowd): the ne…
standsBeside() Whether a follower beside lead stands where one walked step from the lead's cell ends: its own floor, a stair…
regroupStep() A follower's frame of the walk back to lead, the one before it in the line.
sharesCell() Whether a follower stands on the leader's cell or on that of a follower before it in the line.
sweepSpawned() Units spawned for a battle that fell and are gone from the map leave it: the event, its sprite, its place in…
freeEventId() An id after every authored event and below the props' range.
anyEventStarting() Whether an event of the map is about to start (no list is built to ask).
term() The words a battle shows, a project's own (System.json reactorBattle.terms) over the stock ones.
fallYaw() The way a character struck from from goes over: the angle, on the map, of the line from the blow to it (0 dow…
stand() A character is on its feet again: nothing of a fall is left on it.
remainsOf() What a fallen unit that an event stands for leaves, by its battler's Collapse Effect: "body" (Corpse: it fall…
collapseSound() The sound of an enemy going: its own if one is chosen for it, else the one its Collapse Effect has (Instant h…
inArea() In area.
feed() Feed.
meetsPageConditions() Meets page conditions.
stayingOf() The spawned units kept on map mapId ($gameSystem, so saved with the game); made when make, else null.
keepStaying() The map is being left: its spawned units that stay are kept where they stand and as they face; the fallen are…
reinstateSpawned() Reinstate spawned.
waitForBattle() An event waits for a battle on the map; its branch rows and variable take the result when it ends.
anyEnemyAmong() Whether an enemy unit is among events (with no list: among every event of the map).
throughEyes() Whether a character is the one whose eyes the battle is seen through: the player, in an Action or First Perso…
ownPopupPoint() Where the player's own number goes while the battle is seen through the eyes: over the HUD's vitals (the lowe…
pointSeen() Whether the map's camera sees a point of the world: nothing of the ground or of what is built stands on the w…
headPoint() Where a character's head is on screen: above its feet, through the 3D camera on a 3D map.
ownModelSpec() The model an event has of its own: its page's, or its note's.
lookUnit() The unit an event is on the page it shows, read for its look: its row or note tag, else a <unit: ...> or PTBS…
modelFailed() Whether a model's file could not be read: such a model is nobody's look.
unitLook() What a unit of this record (record: "actor" or "enemy", id) stands as when its event has no picture or model…
eventLook() What an event stands as: null when it is no unit on the page it shows; { kind: "own" } when it shows a pictur…

Setup & Creation

makeRewards

static source
F.makeRewards(enemies)

Makes the rewards.

makeRun

static source
F.makeRun(fight, unit, action, targets, via)

Makes the run.

Getting Information

resolveMode

static source
F.resolveMode(troopId)

The mode of the next battle against a troop (0: none): the next-battle setting, then the troop's, then the mode in force.

resolveTurns

static source
F.resolveTurns()

Resolve turns.

dataUnitSpec

static source
F.dataUnitSpec(data)

Data unit spec.

Checks (True / False)

isFoeTeam

static source
F.isFoeTeam(team)

Whether a side is against the player's.

Details

Whether a side is against the player's. There can be more than two: online, someone may fight for themselves.

isHeld

static source
F.isHeld()

Whether it is held.

isMode

static source
F.isMode(mode)

Whether it is mode.

isOnMap

static source
F.isOnMap(mode)

Whether it is on map.

isSide

static source
F.isSide(team, oppose)

Whether a side is what F.oppose answered: the one other side, or with more than two ("!ally") any but that one.

isBattlePage

static source
F.isBattlePage(interpreter)

Whether an interpreter runs a page of the battle itself (a battle page, or a common event one called): such a page never waits for the battle it runs in.

hasOwnPicture

static source
F.hasOwnPicture(event, unit)

Whether the picture an event shows is its own: a tile or a character sheet, but not the sheet Spawn Unit wrote into it from its record (unit: what the event is, F.lookUnit).

Actions

changeMode

static source
F.changeMode(mode, scope)

The Change Battle Mode command: scope game / map / next; mode "default" clears that scope.

giveRewards

static source
F.giveRewards(rewards)

Give rewards.

showResults

static source
F.showResults(fight, rewards, done)

The results of a battle that was won: the rewards are given and shown, and done() says the player has read them.

Details

The results of a battle that was won: the rewards are given and shown, and done() says the player has read them. Until it is called the battle is not over; after it the battle waits, as it always does, while a message is open. Here the message window shows them and holds the battle by itself, so nothing more is waited for.

endRegroup

static source
F.endRegroup(followers)

The walk back is over (or cut short): followers trail the leader as they always do.

putBeside

static source
F.putBeside(followers, follower, lead, index)

Puts a follower beside lead, on the level a step from the lead's cell ends on, and lets it fade in; where nobody can stand beside the lead, on the nearest standing place round it.

Details

Puts a follower beside lead, on the level a step from the lead's cell ends on, and lets it fade in; where nobody can stand beside the lead, on the nearest standing place round it. Only where the map holds no such place at all is it left on the lead's cell.

spawnData

static source
F.spawnData(eventId, spec, options)

Spawn data.

restoreSpawned

static source
F.restoreSpawned()

Restores the spawned.

setBattleBranch

static source
F.setBattleBranch(interpreter, result, variable)

The result an event's If Win / If Escape / If Lose rows read, and the variable its command names.

startScreen

static source
F.startScreen(interpreter, options)

Start Battle on Map where the mode is Classic: the battle screen opens against the troop the command names, else against the enemy rows near the party (who: "map": the rows of the whole map), made into a troop for that battle (reactor_fight_classic.js).

Details

Start Battle on Map where the mode is Classic: the battle screen opens against the troop the command names, else against the enemy rows near the party (who: "map": the rows of the whole map), made into a troop for that battle (reactor_fight_classic.js). The event's branch rows and variable take the result, as Battle Processing's do. Nobody to fight: the event carries on down If Win. Returns the troop's id, or 0.

placePopup

static source
F.placePopup(sprite)

Puts a damage number where its unit is now.

Details

Puts a damage number where its unit is now. Out of sight while the unit is behind the eye, off to the side of the picture, or (on a 3D map) behind the ground or behind something built that the picture does not show it through; never over the HUD along the bottom. Through the eyes the player's own number stands beside the HUD's vitals instead of in the world, where it would be at the eye itself.

Updating & Drawing

stepToward

static source
F.stepToward(character, x, y)

One step toward a cell as a walker takes it: the diagonal, else along the longer way, else the other.

Details

One step toward a cell as a walker takes it: the diagonal, else along the longer way, else the other. False when none is open.

updateRegroup

static source
F.updateRegroup(followers)

One frame of the walk back, before the followers' own update.

Other

fallPitch

static source
F.fallPitch(t)

How far over a falling body is (0 upright, 1 flat), t 0-1 through the fall: slow to tip, quick to land.

oppose

static source
F.oppose(team)

Oppose.

systemSettings

static source
F.systemSettings()

System settings.

overrides

static source
F.overrides()

Overrides.

modeNamed

static source
F.modeNamed(text)

The mode a word names, whatever its letter case ("firstperson" is First Person); "" when it names none.

mapMode

static source
F.mapMode(mapData)

A map's own mode: the first <battle mode: x> tag of its Note, its value in any letter case; where the Note has no such tag, its 3D sidecar's battle.mode.

Details

A map's own mode: the first <battle mode: x> tag of its Note, its value in any letter case; where the Note has no such tag, its 3D sidecar's battle.mode. "" when neither names one (a tag whose value is no mode names none, and the sidecar is not asked).

troopMode

static source
F.troopMode(troopId)

Troop mode.

mapBattlesOn

static source
F.mapBattlesOn()

The mode in force on the map the party is on: what a battle started here now would use with no troop and no next-battle setting.

Details

The mode in force on the map the party is on: what a battle started here now would use with no troop and no next-battle setting. A command for this map, else the map's own, else a command for the game, else System, else Classic.

modeInForce

static source
F.modeInForce()

Mode in force.

spendNext

static source
F.spendNext()

The next-battle setting is used up: by the battle it was set for, on the map or on the battle screen.

parseUnitText

static source
F.parseUnitText(text)

<unit: enemy 5>, <unit: actor 3>, <unit: ally 2> (actor 2 on the allies' side), <unit: ally enemy 4>, <unit: neutral>, with an optional move N.

Details

<unit: enemy 5>, <unit: actor 3>, <unit: ally 2> (actor 2 on the allies' side), <unit: ally enemy 4>, <unit: neutral>, with an optional move N. Null when the text names no unit.

normalizeUnit

static source
F.normalizeUnit(raw)

Normalize unit.

ptbsUnit

static source
F.ptbsUnit(list)

The PTBS comments on an event's current page as a unit, or null.

eventList

static source
F.eventList(event)

An event's running command list; null while none of its pages meets its conditions.

unitSpecOf

static source
F.unitSpecOf(data, list)

The unit an event's data names: its card, else its note tag, else a page comment or PTBS comment.

pageUnit

static source
F.pageUnit(data, list)

The unit an event's data and one page's commands name, kept until the event's card or note changes.

Details

The unit an event's data and one page's commands name, kept until the event's card or note changes. Shared: read it, never write it.

normalizeHook

static source
F.normalizeHook(raw)

Normalize hook.

parseHookText

static source
F.parseHookText(text)

Parse hook text.

pageHook

static source
F.pageHook(page)

Page hook.

eventUnit

static source
F.eventUnit(event)

The unit an event is now, or null.

Details

The unit an event is now, or null. An erased event, or one none of whose pages is met, is not on the map and is no unit; any other is what its card, its note tag or a comment on its page names (unitSpecOf), on the side Change Unit Side last gave it.

eventSide

static source
F.eventSide(event)

The side the unit an event is now fights on, or "" when it is no unit now: F.eventUnit's answer with no record made, for whoever asks about every event of the map (the map's own start, who joins a battle).

troopComes

static source
F.troopComes(troopId)

Whether a troop would bring anyone: a member that is not hidden and whose enemy record exists.

keepResults

static source
F.keepResults(fight)

The results of older battles are let go: nothing waits for them any more.

normalizeObjective

static source
F.normalizeObjective(raw)

Normalize objective.

staysDefeated

static source
F.staysDefeated(data)

Whether an enemy placed on a map stays defeated once it falls (data: its event's data).

Details

Whether an enemy placed on a map stays defeated once it falls (data: its event's data). Only an event whose own In battle row is on the Enemy side is remembered (one a command turned into an enemy stands again). The row's Comes back (returns) decides, else its enemy record's (rrBattle.comesBack, Database › Enemies), else it stays.

objectiveOfArgs

static source
F.objectiveOfArgs(args)

A command's goal fields as an objective (Start Battle on Map, Change Battle Goal).

standLevel

static source
F.standLevel(x, y, from, plain)

The height a body put on cell (x, y) stands at, or NaN when the cell holds no place for one.

Details

The height a body put on cell (x, y) stands at, or NaN when the cell holds no place for one. Coming from height from it is the place nearest that height, no more than a low step off it (the same floor, not the roof over it or the ledge beside it); with no from it is the place on the cell's own ground (a floor slab is a low step up from it; a crate, a counter, a rock or a wall is not). Either way a place the physics lets a body stand (ReactorPhysics.standingAt: wide and level enough, room for the body under whatever hangs over it, out of a bush that blocks, in water no deeper than a wade). plain: only the ground and what is built as ground (a floor, a stair, a block, rock), not the top of a shape (a bench, a crate, a deck). A map without 3D has one level, 0, on every cell.

groundLevel

static source
F.groundLevel(x, y)

The height a unit asked for by its cell alone stands at, or NaN.

Details

The height a unit asked for by its cell alone stands at, or NaN. The floor the party leader is on, where the cell has it (the battle is there); else the highest of the cell's places to stand that is ground: the cell's own ground, blocks or a floor no more than F.SPOT_STAGE over it (a stage), or a top a walker reaches (a hill of rock, a bridge over a ravine). Never the top of something that only stands there (a crate, a stall's roof, a house's, a fountain's rim): such a cell holds no place for a unit that names no height.

reachedOnFoot

static source
F.reachedOnFoot(x, y, height)

Whether a place to stand is ground a walker reaches: joined to some cell's own ground, through no more than F.SPOT_REACH cells, by steps from cell to cell no higher than a walked one.

Details

Whether a place to stand is ground a walker reaches: joined to some cell's own ground, through no more than F.SPOT_REACH cells, by steps from cell to cell no higher than a walked one. A stair's steps are higher, so an upper floor and a roof are not; neither is a top with a drop all round it.

regroup

static source
F.regroup(followers)

Starts the walk back: the frames it may take, and how many of the party walk the map (members: a follower past them stands for nobody).

besideLands

static source
F.besideLands(lead, dx, dy)

The height a walker leaving lead's cell is at on the cell (dx, dy) beside it, a diagonal one by either of its corners; NaN when no walked step leads there.

Details

The height a walker leaving lead's cell is at on the cell (dx, dy) beside it, a diagonal one by either of its corners; NaN when no walked step leads there. Up a stair it is the stair's next step, not the lead's height.

spotBeside

static source
F.spotBeside(followers, lead, index)

A free cell beside lead a body can stand on, one walked step from the lead's cell (never through a wall or up a ledge): the shared spotOut, or null.

Details

A free cell beside lead a body can stand on, one walked step from the lead's cell (never through a wall or up a ledge): the shared spotOut, or null. Plain ground first; beside a lead that is itself in deep water, the water it is in; then anything stood on. index is the follower's place in the line (those before it keep their cells).

spotBesideOn

static source
F.spotBesideOn(followers, lead, index, rule)

As spotBeside, by one rule: "plain" ground only, "any" place a body stands on, or the "water" the lead is in.

spotAround

static source
F.spotAround(followers, lead, index)

Where a follower goes when no cell beside lead will do (the lead in a doorway, on a post, in a crowd): the nearest free cell within F.REGROUP_AROUND a body can stand on, level with the lead first, else on its own ground.

Details

Where a follower goes when no cell beside lead will do (the lead in a doorway, on a post, in a crowd): the nearest free cell within F.REGROUP_AROUND a body can stand on, level with the lead first, else on its own ground. The shared spotOut, or null.

standsBeside

static source
F.standsBeside(lead, follower)

Whether a follower beside lead stands where one walked step from the lead's cell ends: its own floor, a stair's next step, not the roof over it or a ledge.

regroupStep

static source
F.regroupStep(followers, follower, lead, index, last)

A follower's frame of the walk back to lead, the one before it in the line.

Details

A follower's frame of the walk back to lead, the one before it in the line. False once it stands in its place.

sharesCell

static source
F.sharesCell(followers, follower, index)

Whether a follower stands on the leader's cell or on that of a follower before it in the line.

sweepSpawned

static source
F.sweepSpawned()

Units spawned for a battle that fell and are gone from the map leave it: the event, its sprite, its place in the saved list of spawned units and its self switches.

Details

Units spawned for a battle that fell and are gone from the map leave it: the event, its sprite, its place in the saved list of spawned units and its self switches. A map that hosts battle after battle (an army drill) would otherwise carry every fallen unit of every battle, each still a sprite updated every frame. One still standing, or still fading, stays.

freeEventId

static source
F.freeEventId()

An id after every authored event and below the props' range.

anyEventStarting

static source
F.anyEventStarting()

Whether an event of the map is about to start (no list is built to ask).

term

static source
F.term(key)

The words a battle shows, a project's own (System.json reactorBattle.terms) over the stock ones.

fallYaw

static source
F.fallYaw(from, character)

The way a character struck from from goes over: the angle, on the map, of the line from the blow to it (0 down the map, a quarter turn to the right of it), or null when the blow came from nowhere or from its own cell.

stand

static source
F.stand(character)

A character is on its feet again: nothing of a fall is left on it.

remainsOf

static source
F.remainsOf(unit, battler)

What a fallen unit that an event stands for leaves, by its battler's Collapse Effect: "body" (Corpse: it falls and lies for the rest of the battle, and gets up if it is revived; so does anyone on the party's side that an actor stands behind), "stand" (No Disappear: it stays as it stood), "gone" (Instant: it is not there the next frame), or "fade" (every other: it falls, lies a moment and fades).

collapseSound

static source
F.collapseSound(battler)

The sound of an enemy going: its own if one is chosen for it, else the one its Collapse Effect has (Instant has none).

inArea

static source
F.inArea(hook, x, y)

In area.

feed

static source
F.feed()

Feed.

meetsPageConditions

static source
F.meetsPageConditions(event, page)

Meets page conditions.

stayingOf

static source
F.stayingOf(mapId, make)

The spawned units kept on map mapId ($gameSystem, so saved with the game); made when make, else null.

Details

The spawned units kept on map mapId ($gameSystem, so saved with the game); made when make, else null.

keepStaying

static source
F.keepStaying(map)

The map is being left: its spawned units that stay are kept where they stand and as they face; the fallen are not.

reinstateSpawned

static source
F.reinstateSpawned(map)

Reinstate spawned.

waitForBattle

static source
F.waitForBattle(interpreter, serial, variable)

An event waits for a battle on the map; its branch rows and variable take the result when it ends.

Details

An event waits for a battle on the map; its branch rows and variable take the result when it ends. False for a page of that battle: it goes on, and none of its branch rows is taken.

anyEnemyAmong

static source
F.anyEnemyAmong(events)

Whether an enemy unit is among events (with no list: among every event of the map).

throughEyes

static source
F.throughEyes(character)

Whether a character is the one whose eyes the battle is seen through: the player, in an Action or First Person battle here, with the map's camera in the head.

Details

Whether a character is the one whose eyes the battle is seen through: the player, in an Action or First Person battle here, with the map's camera in the head. (A Tactical battle has its own view, whatever the map's camera is.)

ownPopupPoint

static source
F.ownPopupPoint(character, out)

Where the player's own number goes while the battle is seen through the eyes: over the HUD's vitals (the lower left where no HUD says).

Details

Where the player's own number goes while the battle is seen through the eyes: over the HUD's vitals (the lower left where no HUD says). Null in every other view, and for everyone else.

pointSeen

static source
F.pointSeen(world, character)

Whether the map's camera sees a point of the world: nothing of the ground or of what is built stands on the way to it.

Details

Whether the map's camera sees a point of the world: nothing of the ground or of what is built stands on the way to it. character is who stands there: what the cutaway has opened to show it (a corridor through a wall, a tactical battle's ground) is not in the way, only the ground still can be.

headPoint

static source
F.headPoint(character, out, tall)

Where a character's head is on screen: above its feet, through the 3D camera on a 3D map.

Details

Where a character's head is on screen: above its feet, through the 3D camera on a 3D map. Fills and returns out (a new record without one): x, y, whether it is in front of the camera (visible), and on a 3D map the point of the world it is (world). tall is the character's height in tiles when the caller knows it.

ownModelSpec

static source
F.ownModelSpec(character)

The model an event has of its own: its page's, or its note's.

lookUnit

static source
F.lookUnit(event)

The unit an event is on the page it shows, read for its look: its row or note tag, else a <unit: ...> or PTBS comment on that page.

Details

The unit an event is on the page it shows, read for its look: its row or note tag, else a <unit: ...> or PTBS comment on that page. Null for an event that is no unit there, is erased, or shows no page.

modelFailed

static source
F.modelFailed(spec)

Whether a model's file could not be read: such a model is nobody's look.

unitLook

static source
F.unitLook(record, id, team)

What a unit of this record (record: "actor" or "enemy", id) stands as when its event has no picture or model of its own: { kind: "model", spec } | { kind: "character", characterName, characterIndex } | { kind: "picture", folder, name, hue } | { kind: "figure" }, each with team and color (the side's: team, else the record's usual side).

Details

What a unit of this record (record: "actor" or "enemy", id) stands as when its event has no picture or model of its own: { kind: "model", spec } | { kind: "character", characterName, characterIndex } | { kind: "picture", folder, name, hue } | { kind: "figure" }, each with team and color (the side's: team, else the record's usual side). Never null while the look rule is loaded. The answer is shared and kept: read it, never write it.

eventLook

static source
F.eventLook(event)

What an event stands as: null when it is no unit on the page it shows; { kind: "own" } when it shows a picture or a model of its own; else its record's look (F.unitLook) on the side it is on now.

Details

What an event stands as: null when it is no unit on the page it shows; { kind: "own" } when it shows a picture or a model of its own; else its record's look (F.unitLook) on the side it is on now. Asked every frame by the event's sprite: the answer is kept beside the event, read again every F.LOOK_BEAT frames and at once when its page or its picture changes.