29 entry = &
TECHS[
id - 1];
48 for (i = 0; i < 3; i++) {
61 chance += fighter->
sleep >> 3;
88#elif VERSION_EU || VERSION_JP
96 entry = &
TECHS[
id - 1];
103 chance = value + 0x40;
111 chance += fighter->
sleep >> 3;
140 entry = &
TECHS[
id - 1];
182 entry = &
TECHS[
id - 1];
215 entry = &
TECHS[
id - 1];
227 if (chance >= 0x80) {
258 entry = &
TECHS[
id - 1];
268 if (chance >= 0x80) {
306 entry = &
TECHS[
id - 1];
311 if (chance >= 0x80) {
351 entry = &
TECHS[
id - 1];
377#elif VERSION_EU || VERSION_JP
380 entry = &
TECHS[
id - 1];
419 entry = &
TECHS[
id - 1];
434#if VERSION_EU || VERSION_JP
439 s32 chance = (damage << 6) / fighter->
maxHp + 32;
487#if VERSION_EU || VERSION_JP
530 chance = chance + luck - delay;
Battle FIGHTSTG_battle
the battle: its fighters, speed and drawing functions
BattleFuncs FIGHTSTG_battleFuncs
the battle's stats and the functions that compute with them
#define FIGHTER_PARALYZED
loses turns at random (FIGHTSTG_battleFuncs.testParalysis)
#define HIT_DRAIN
its power is in 128ths of the damage
#define TECH_EFFECT_FIRST
A technique's effect (TechData.effect), which FIGHTSTG_applyTechEffect carries out when its hit lands...
#define FIGHTER_NO_SWITCH
can't switch out or run away (TECH_EFFECT_NO_SWITCH)
#define BATTLE_STAT_SPEED
physical accuracy, evasion and running away
#define HIT_POISON
The statuses a weapon's hits can inflict (BattleStats.statuses)
#define RESIST_POISON
BattleStats.resist's indices: against the elements (element - ELEMENT_FIRST), then against the status...
#define HIT_KNOCK_OUT
its power is read by nothing
#define EVENT_STATUS_END
10-12: the end of FIGHTER_PARALYZED, FIGHTER_CONFUSED or FIGHTER_ASLEEP
#define BATTLE_KIND_FINAL_LAST
its third enemy; winning plays the ending
#define BATTLE_STAT_WISDOM
magic accuracy, statuses and heals
#define BATTLE_STAT_DEFENSE
against it
#define FIGHTER_ASLEEP
can't act or run away; a hit may wake it up
#define SIDE_PLAYER
The battle's sides, as the functions that take a side want them: side >> 4 is its row of FIGHTSTG_bat...
#define ELEMENT_FIRST
The elements (TechData.element, BattleStats.element) and the families (TechData.family,...
#define TECH_EFFECT_CRITICAL
raises the critical hit chance
EventQueue FIGHTSTG_events
the battle's events and their functions
BattleStats * FIGHTSTG_computeStats(u8 side, s32 which, s32 index)
Works out a side's stats into its BattleStats: the partner's totals with the fighter's boosts,...
FIGHTSTG.PRO: the battle.
BattleTableEntry *(* FIGHTSTG_battleTableFunc)(s32 id)
how the fight stage and WFIGHTMN read the battle table
DigimonData DIGIMON_DATA[55]
55 entries: the 52 Digimon, then three placeholders (0x1D4-0x1D6)
#define BATTLE_BLOCK_SLEEP
#define BATTLE_BLOCK_RUN_AWAY
#define BATTLE_BLOCK_STEAL
#define BATTLE_BLOCK_POISON
BattleSetup.blocks' indices: the encounter keeps the player from inflicting a status,...
#define BATTLE_BLOCK_CONFUSION
#define BATTLE_BLOCK_KNOCK_OUT
#define BATTLE_BLOCK_PARALYSIS
#define BATTLE_BLOCK_DRAIN
TechData TECHS[443]
The techniques, from 1: technique n is TECHS[n - 1].
s32 FIGHTSTG_testWakeUp(u8 side, s32 value)
FIGHTSTG_battleFuncs.testWakeUp: whether a hit of value wakes side's fighter up, likelier the bigger ...
s32 FIGHTSTG_rollCounter(s32 side, s32 damage)
FIGHTSTG_battleFuncs.rollCounter: a random test, likelier the bigger damage is next to the player's f...
static s32 rollStatus(u8 side, s32 id, s32 block, s32 status, s32 resist, s32 element)
Whether a hit inflicts status, like rollPoison without its power: BLOCK keeps the player from it,...
s32 FIGHTSTG_rollSleep(u8 side, s32 id)
Whether a hit puts the target to sleep, like rollPoison with the technique's chance (BATTLE_BLOCK_SLE...
s32 FIGHTSTG_rollNoSwitch(s32 actor, s32 id)
Whether TECH_EFFECT_NO_SWITCH works: the technique's chance.
s32 FIGHTSTG_rollMagicHit(u8 side, s32 id)
Whether a magic hit lands: the technique's accuracy with the wisdom and level differences; the player...
s32 FIGHTSTG_rollDrain(u8 side, s32 id)
Whether a hit drains HP: the technique's chance, or the accessory's for a technique without an effect...
s32 FIGHTSTG_rollNoDigivolve(s32 actor, s32 id)
Whether TECH_EFFECT_NO_DIGIVOLVE works: the technique's chance.
s32 FIGHTSTG_rollDedigivolve(s32 actor, s32 id)
Whether a technique turns the player's fighter back: never when it is one of the partners' own Digimo...
s32 FIGHTSTG_testParalysis(u8 side)
FIGHTSTG_battleFuncs.testParalysis: whether side's paralysis costs it the turn, a random test of its ...
s32 FIGHTSTG_rollSteal(u8 side, s32 id)
Whether the player steals the enemy's item: its itemChance in 1024 by the speed ratio (at most twice)...
static s32 rollTechChance(s32 id)
Rolls a technique's effect chance (TechData.effectChance, in 128ths)
s32 FIGHTSTG_rollHit(u8 side, s32 id)
Whether a physical hit lands: the technique's accuracy with the speed and level differences and the a...
s32 FIGHTSTG_rollCritical(u8 side, s32 id)
Whether a physical hit is critical: a chance of 4 in 128 with the technique's critical boost or the a...
s32 FIGHTSTG_rollParalysis(u8 side, s32 id)
Whether a hit paralyzes, like rollPoison (BATTLE_BLOCK_PARALYSIS keeps the player from it)
s32 FIGHTSTG_rollPoison(u8 side, s32 id)
The poison a hit inflicts, or 0: the technique's or the accessory's chance and an eighth of the user'...
s32 FIGHTSTG_testRunAway(u8 side)
FIGHTSTG_battleFuncs.testRunAway: a random test for side running away, from both sides' stats; the pl...
s32 FIGHTSTG_rollStatusRaise(s32 actor, s32 id)
Whether a status raise works: the technique's chance and an eighth of what the enemy's wisdom has ove...
s32 FIGHTSTG_testConfusion(u8 side)
FIGHTSTG_battleFuncs.testConfusion: a random test of side's confusion against its resists 9 and 3.
s32 FIGHTSTG_rollKnockOut(u8 side, s32 id)
Whether a hit knocks the target out, like rollPoison (BATTLE_BLOCK_KNOCK_OUT keeps the player from it...
s32 FIGHTSTG_rollConfusion(u8 side, s32 id)
Whether a hit confuses, like rollPoison (BATTLE_BLOCK_CONFUSION keeps the player from it)
s32 FIGHTSTG_rollMagicCritical(u8 side, s32 id)
Whether a magic hit is critical: a chance from the technique's element power against the target's res...
One of the battle's fighters, three on each side (WFIGHTMN's BattleUnit): a partner's HP and MP go ba...
u8 paralysis
FIGHTER_PARALYZED's strength.
s16 id
the Digimon (DIGIMON_DATA)
u8 sleep
FIGHTER_ASLEEP's.
u8 confusion
FIGHTER_CONFUSED's.
u8 special
the partner's special state (EVENT_SPECIAL_END): doubles its effects
BattleStats stats[2]
the player's, then the enemy's
u8 blocks[12]
by BATTLE_BLOCK_*: what the player can't do in the battle
What a battle starts from: WFIGHTMN_start zeroes it as one block, and FIGHTSTG_testRunAway reads runA...
s16 runAttempts
the player's, each of which makes running away likelier (FIGHTSTG_testRunAway)
s32 active[2]
each side's fighter
BattleFighter fighters[2][3]
s16 kind
the kind of battle
A side's stats as FIGHTSTG_computeStats works them out.
u8 weaponFamilies[3]
from the equipment, as are the ones after
s16 stats[5]
with the fighter's boosts
u8 runAwayGuard
halves the enemy's chance to run away
u8 runAwayBonus
to the player's chance to run away
u8 criticalBonus
to plain techniques' critical chance, off their accuracy
HitStatus statuses[5]
by HIT_*, from the weapon
s16 itemChance
in 1024ths, less one
s32(* find)(s32 type, u8 side, s32 fighter)
s32(* next)(void)
0 to RANDOM_COUNT - 1
A technique (TECHS, from 1: technique n is TECHS[n - 1])
u8 effect
TECH_EFFECT_* (fightstg/battle.h), under TECH_EFFECT_FIRST none.
u8 family
FAMILY_FIRST and up, under it none.
u8 effectPower
the effect's strength (a boost's amount, a drain's 128ths)
u8 element
ELEMENT_FIRST and up, under it none.
u8 elementPower
how much the element adds, against the target's resistance