A Tactical battle: climbing onto a roof.

Battle

Battles on the Live Map

reactor_fight.js · 3,851 lines · 231 public functions

A Tactical battle: climbing onto a roof.

What This Module Does

The framework for battles on the map: Tactical, Action and First Person. It tracks the units, turns, objectives and results; the reactor_fight_* modules add each mode. $gameFight is the running battle.

Example

// Start a Tactical battle against troop 3 right here on the map
$gameFight.start({ mode: "tactical", troopId: 3, canEscape: true });

// Who is still standing on the enemy side?
const foes = $gameFight.units({ team: "enemy", alive: true });

// Be told when it ends
ReactorEvents.on("mapBattleEnd", payload => console.log("Battle over", payload));

Classes & Namespaces

Design Notes from the Source Code

Classic battles stay the separate battle scene (Scene_Battle). Tactical, Action and First Person battles happen on the map itself: the fight is a state object beside the map ($gameFight), Scene_Map keeps running, map events keep running, and every unit is an ordinary character (the player, a follower or an event) carrying a Database battler. Damage, skills, items and states go through the stock Game_Action and Game_Battler math.

This file is the framework the three map modes share (docs/DESIGN-BATTLE- MODES.md, phase 1): the mode switch, units, hooks, outcomes and rewards, save and load mid-battle, and a minimal team-turn driver in which every unit approaches its nearest opponent and attacks or uses a skill.

View reactor_fight.js on GitHub · Hide internal (_) functions