22 if (element == boost->
element) {
23 return value * boost->
amount / 128;
26 return -(value * boost->
amount / 256);
48 for (i = 0; i < 3; i++) {
64 result = result * 4 / 10;
67 result += result * ((
RANDOM.
next() & 0x3F) + 0x20) / 64;
75 if (result > value * 5) {
78#if VERSION_EU || VERSION_JP
79 if (result >= 10000) {
104 tech = &
TECHS[
id - 1];
140 tech = &
TECHS[
id - 1];
151 if (power > base * 2) {
154 if (power < base / 2) {
162 result = result * (400 - resist * 3) / 100;
163 }
else if (resist >= 300) {
164 result = result * (65 - resist / 20) / 100;
166 result = result * (125 - resist / 4) / 100;
170 result += result / 2;
173 result += result * (
RANDOM.
next() % 65 + 0x20) / 64;
181 if (result > power * 5) {
184#if VERSION_EU || VERSION_JP
185 if (result >= 10000) {
218 maxHp = fighter->
maxHp;
223 if (result > maxHp / 2) {
261 entry = &
TECHS[
id - 1];
278#if VERSION_EU || VERSION_JP
291 entry = &
TECHS[
id - 1];
292 value = entry->
power;
295#elif VERSION_EU || VERSION_JP
320#if VERSION_EU || VERSION_JP
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 TECH_EFFECT_FIRST
A technique's effect (TechData.effect), which FIGHTSTG_applyTechEffect carries out when its hit lands...
#define BATTLE_STAT_ATTACK
BattleStats.stats' indices: the partner's first five battle stats.
#define BATTLE_STAT_SPIRIT
magic damage, and against it
#define RESIST_POISON
BattleStats.resist's indices: against the elements (element - ELEMENT_FIRST), then against the status...
#define BATTLE_STAT_WISDOM
magic accuracy, statuses and heals
#define BATTLE_STAT_DEFENSE
against it
#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,...
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
s32 FIGHTSTG_getHeal(u8 side, s32 index, s32 big)
The HP a fighter regains: 8 to 16 128ths of its max HP when big, 4 to 8 otherwise.
s32 FIGHTSTG_getDamage(s32 *args)
getDamage: the damage of an event (args: the side, the fighter and the base damage) to the fighter if...
s32 FIGHTSTG_opposedElements[]
the element whose boost (FIGHTSTG_getElementBoost) weakens each one
s32 FIGHTSTG_computeDamage(u8 side, s32 id)
A technique's power from the user's attack against the target's defense (an enemy's scaled by its unk...
s32 FIGHTSTG_getElementBoost(s32 value, s32 element)
What the battle's element boost adds to value for a technique of the given element: the boost's amoun...
s32 FIGHTSTG_adjustDamage(u8 side, s32 id, s32 value)
A hit's damage from its base value: the element boost, half again against the target's family,...
s32 FIGHTSTG_computeMagicDamage(u8 side, s32 id)
A magic technique's damage: its power by the user's spirit against the target's (half to twice as muc...
s32 FIGHTSTG_computeHeal(u8 side, s32 id)
The HP a healing technique restores: 64 times its power, and an eighth of it per point of the user's ...
s32 FIGHTSTG_computeCounterDamage(u8 side, s32 id, s32 value)
The damage of a counterattack on value: the partner's first skill deals it as one hit (the triple hit...
DigimonData *(* GET_DIGIMON)(s32 id)
getDigimon for the overlays, in the small data (.sdata) between game/items.c's and file/file_table....
TechData TECHS[443]
The techniques, from 1: technique n is TECHS[n - 1].
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_rollMagicCritical(u8 side, s32 id)
Whether a magic hit is critical: a chance from the technique's element power against the target's res...
s16 strength
its stats and techniques' power, in 16ths
One of the battle's fighters, three on each side (WFIGHTMN's BattleUnit): a partner's HP and MP go ba...
s16 id
the Digimon (DIGIMON_DATA)
u8 special
the partner's special state (EVENT_SPECIAL_END): doubles its effects
BattleStats stats[2]
the player's, then the enemy's
s32 active[2]
each side's fighter
BattleFighter fighters[2][3]
A side's stats as FIGHTSTG_computeStats works them out.
u8 tripleHit
plain physical techniques hit 3 times for 0.4 of the damage
u8 weaponFamilies[3]
from the equipment, as are the ones after
s16 stats[5]
with the fighter's boosts
u8 damageCut
taken off each hit
u8 damageBonus
in 64ths: the fighter's charge
u8 element
the accessory's, for techniques without one
u16 skills[7]
[1]-[6] are learnt at skillLevels
The battle's element boost: one element's techniques do more damage, and the ones of the element it w...
s16 element
under ELEMENT_FIRST: none
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)
u16 power
its damage, times the user's attack over the target's defense
u8 element
ELEMENT_FIRST and up, under it none.
u8 elementPower
how much the element adds, against the target's resistance
u8 script
its script in the user's archive (BattleScript.index); 5 and 12 are special