12 { 0xCC, -1, 0, 0x33 },
13 { 0xCD, -1, 1, 0x34 },
14 { 0xCE, -1, 1, 0x34 },
15 { 0xCF, -1, 2, 0x35 },
16 { 0xD0, -1, 2, 0x35 },
32#if VERSION_EU || VERSION_JP
59 task->
lines[0] = 0x3A;
68 s32 other = 1 - (task->
side >> 4);
81 if (children[0].task ==
NULL) {
87 if (task->
side != 0) {
106 other = task->
side == 0;
115 task->
lines[0] = other << 4;
122 task->
lines[0] = other << 4;
126#if VERSION_EU || VERSION_JP
128 if (task->
damage >= 10000) {
138 task->
lines[0] = other << 4;
143 task->
lines[0] = 0x1D;
144 task->
lines[1] = other << 4;
151 if (fighter->
hp <= 0) {
168 other = task->
side != 0;
169 switch (task->
tech) {
189 switch (task->
step) {
193 if (task->
tech & 1) {
210 task->
lines[0] = 0x2F;
214 for (i = 0; i < task->
counter; i++) {
228 switch (task->
step) {
238 for (i = 0; i < 3; i++) {
239 if (fighter[i].
id != 0 && fighter[i].hp == 0) {
240 fighter[i].
hp = fighter[i].
maxHp;
260 switch (task->
step) {
271 for (i = 0; i < 3; i++) {
272 if (fighter[i].
id != 0) {
273 if (fighter[i].hp == 0) {
276 fighter[i].
flags = 0;
277 fighter[i].
hp = fighter[i].
maxHp;
282 for (i = 0; i < 3; i++) {
298 if (task->
side != 0) {
301 switch (task->
step) {
310 if (task->
tech >= 0xBB) {
311 for (i = 0; i < 3; i++) {
312 if (fighters[i].
id != 0 && fighters[i].hp != 0) {
313 s32 lost = fighters[i].
maxHp - fighters[i].
hp;
322 if (task->
heal < most) {
326 task->
lines[2] = most;
332 lost = fighters[i].
maxHp - fighters[i].
hp;
338 if (task->
heal < most) {
342 task->
lines[1] = most;
351 if (task->
tech >= 0xBB) {
352 for (i = 0; i < 3; i++) {
353 if (fighters[i].
id != 0 && fighters[i].hp != 0) {
354 if (fighters[i].hp + task->
heal > fighters[i].
maxHp) {
355 fighters[i].
hp = fighters[i].
maxHp;
357 fighters[i].
hp += task->
heal;
363 if (fighters[i].hp + task->
heal > fighters[i].
maxHp) {
364 fighters[i].
hp = fighters[i].
maxHp;
366 fighters[i].
hp += task->
heal;
371 task->
lines[0] = 0x2F;
386 switch (task->
tech) {
391 task->
lines[0] = 0x27;
431 other = task->
side >> 4;
435 task->
lines[0] = 0x2F;
446 task->
lines[1] = other << 4;
462 for (i = 0; i < 3; i++) {
469 switch (boost->
stat) {
488 task->
lines[0] = 0x36;
502 if (from->
mp < amount) {
513 task->
lines[0] = 0x10;
514 task->
lines[1] = amount;
518 task->
lines[0] = 0x2F;
519 task->
lines[1] = 0x10;
529 fighter->
hp += task->
heal;
530 if (fighter->
hp > fighter->
maxHp) {
534 task->
lines[0] = 0x46;
535 task->
lines[1] = 0x10;
543 switch (task->
tech) {
566 task->
lines[0] = 0x44;
570 task->
lines[0] = 0x2F;
577 task->
lines[0] = 0x45;
581 task->
lines[0] = 0x2F;
590 task->
lines[0] = 0x2F;
618 if (amount >= 0x80) {
638 task->
lines[0] = 0x2B;
643 fighter->
flags &= ~FIGHTER_ASLEEP;
678 switch (task->
state) {
690 if (children[0].task !=
NULL) {
694 switch (tech->
icon) {
713 if (children[0].task ==
NULL) {
732 if (children[0].task ==
NULL) {
740 if (children[0].task !=
NULL) {
741 if (children[0].task->
state != 2) {
750 if (children[0].task ==
NULL) {
758 if (children[0].task ==
NULL) {
763 if (children[0].task ==
NULL) {
ActionEvents * FIGHTSTG_startActionEvents(s32 side)
Starts running the current action's events for SIDE (FIGHTSTG_updateActionEvents)
BattleAction FIGHTSTG_action
the command being carried out
Battle FIGHTSTG_battle
the battle: its fighters, speed and drawing functions
void FIGHTSTG_startRestriction(s32 tech)
Restricts the partner with technique tech: sets FIGHTER_NO_SWITCH or FIGHTER_NO_DIGIVOLVE by the tech...
BattleFuncs FIGHTSTG_battleFuncs
the battle's stats and the functions that compute with them
void FIGHTSTG_queueDigidevolve(void)
Queues the partner's digidevolution, first.
void FIGHTSTG_queueKnockOut(u8 side)
Queues the fall of side's active fighter (event 20), first.
void FIGHTSTG_queuePartnerTech(s32 tech)
Queues the partner's technique tech, to run as its command.
static BattleFighter * FIGHTSTG_getActiveFighter(s32 row)
Row's active fighter (FIGHTSTG_battle.state.fighters[row][active[row]]), as the row's offset in bytes...
#define BATTLE_ACTION_STATE_SIZE
FIGHTSTG_action's bytes before start, which a new action clears.
#define TECH_EFFECT_DOUBLE_MAGIC
two magic hits, as techniques 0x1B9 and 0x1BA
#define FIGHTER_PARALYZED
loses turns at random (FIGHTSTG_battleFuncs.testParalysis)
#define TECH_EFFECT_MULTI_HIT
#define EVENT_STATUS_DAMAGE
the damage of a poisoned fighter (FIGHTER_POISONED)
#define FIGHTER_POISONED
BattleFighter.flags: the statuses, which the techniques give (FIGHTSTG_inflict*) and events of type E...
#define TECH_MAGIC
FIGHTSTG_rollMagicHit and FIGHTSTG_computeMagicDamage.
#define TECH_EFFECT_ENEMY_ONLY
does nothing but for the enemy whose battle table entry lists it first
#define TECH_EFFECT_KNOCK_OUT
#define BATTLE_STAT_SPIRIT
magic damage, and against it
#define TECH_PHYSICAL
TechData.icon's kinds of attack.
#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 EVENT_RESTRICTION_END
16-17: the end of a restriction (FIGHTER_NO_SWITCH or FIGHTER_NO_DIGIVOLVE)
#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...
void FIGHTSTG_queueRecovery(u8 side, s32 fighter, s32 big)
Queues a fighter's recovery of HP (event 6, with what getHeal takes as big), or sets the one already ...
void FIGHTSTG_queueAutoRecoverEnd(u8 side)
Queues the end of side's automatic recovery (item 0xBD), or pushes back the one already queued.
void FIGHTSTG_queueClearField(s32 time)
Queues the field's clearing in time (at most 0x7FFF), or moves the one already queued to it.
EventQueue FIGHTSTG_events
the battle's events and their functions
void FIGHTSTG_queueBoostEnd(u8 side, s32 fighter, s32 kind, s32 tech)
Queues the end of a fighter's boost of stat kind, 12 frames on when a technique (tech) gave it and 8 ...
FIGHTSTG.PRO: the battle.
Counterattack * FIGHTSTG_startCounterattack(s32 side, s32 received, s32 noKnockOutEvent)
Starts SIDE's counterattack (FIGHTSTG_updateCounterattack) to RECEIVED damage; NOKNOCKOUTEVENT keeps ...
void FIGHTSTG_reviveFighter(s32 tech, s32 fighter)
Revives one of the player's fighters at full HP, clearing its status events, and raises its defense b...
EnemyAttack * FIGHTSTG_startEnemyAttack(s32 kind, s32 noKnockout)
Starts an attack on the player's active fighter (FIGHTSTG_updateEnemyAttack): kind 0 for the enemy's ...
#define TASK_INIT
Tasks: every game object is a task, a heap block that starts with this header and is updated once per...
#define BATTLE_BLOCK_LOWER_ATTACK
to 10: attack, defense, speed (a technique's boost stat + 8)
Heap HEAP
The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take othe...
TechData TECHS[443]
The techniques, from 1: technique n is TECHS[n - 1].
BattleMessageBox * FIGHTSTG_createMessage(void)
Creates a battle message box (FIGHTSTG_updateMessage)
void WFIGHTMN_checkEquip(s32 member)
Queues a recovery (FIGHTSTG_queueRecovery) for party member MEMBER's partner when it has WFIGHTMN_REC...
u8 effects[0x28]
by TECH_EFFECT_*: what each one does, 0 for none
void(* start)(u8 side, s32 tech)
FIGHTSTG_startAction.
u8 hits[4]
whether each hit lands
s32 hitDamage[2]
TECH_EFFECT_DOUBLE_MAGIC's.
One of the battle's fighters, three on each side (WFIGHTMN's BattleUnit): a partner's HP and MP go ba...
s16 charge
added in 64ths to its next technique's damage, which uses it up
s16 id
the Digimon (DIGIMON_DATA)
s32(* testWakeUp)(u8 side, s32 value)
void(* changeBoost)(u8 side, s32 index, s32 stat, s32 percent)
changes a fighter's stat boost
s32(* rollNoSwitch)(s32 actor, s32 id)
s32(* rollNoDigivolve)(s32 actor, s32 id)
s32(* computeHeal)(u8 side, s32 id)
s32(* rollDedigivolve)(s32 actor, s32 id)
BattleStats *(* computeStats)(u8 side, s32 which, s32 index)
void(* show)()
FIGHTSTG_showMessage: (task, type, data)
u8 blocks[12]
by BATTLE_BLOCK_*: what the player can't do in the battle
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.
s16 stats[5]
with the fighter's boosts
s16 element
under ELEMENT_FIRST: none
void(* cureStatus)(u8 side, s32 fighter, s32 item)
FIGHTSTG_cureStatus: an item's cure.
s32(* find)(s32 type, u8 side, s32 fighter)
void(* zero)(void *ptr, s32 size)
s16 type
0 for a free entry
Any task, seen through its header.
void(* nextState)(struct TechAction *task)
void(* nextSubstate)(struct TechAction *task)
void(* setSubstate)(struct TechAction *task, s32 substate)
s32 heal
the HP an item heals
s32 lines[8]
FIGHTSTG_updateMessage's.
u8 side
the side that uses it, 0 or 0x10
s32 asleep
whether the other side's fighter was asleep
s32 tech
the technique or item
void(* setState)(struct TechAction *task, s32 state)
A technique's boost (FIGHTSTG_techBoosts and FIGHTSTG_sideBoosts, each ended by -1)
s16 amount
times the technique's effectPower, below 0 for the other side
A technique (TECHS, from 1: technique n is TECHS[n - 1])
u8 effect
TECH_EFFECT_* (fightstg/battle.h), under TECH_EFFECT_FIRST 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 icon
a frame of the menu sprites, from 0x37
u8 script
its script in the user's archive (BattleScript.index); 5 and 12 are special
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
static void healEnemy(TechAction *task, BattleChild *children)
Technique 0x190: heals the enemy by FIGHTSTG_computeHeal and charges it.
static void healWithTech(TechAction *task, BattleChild *children)
The other item techniques: heal the user, or its whole side for 0xBB and above, by FIGHTSTG_computeHe...
static void boostSideStat(TechAction *task, BattleChild *children, TechData *tech)
Techniques 0xC7, 0xC9 and 0xCB (FIGHTSTG_sideBoosts): boost a stat of all the user's side.
static void reviveSide(TechAction *task, BattleChild *children)
Technique 0x64: revives the partners knocked out to their max HP.
static void boostFighterStat(TechAction *task, BattleChild *children, TechData *tech)
Techniques 0xC6-0xD0 (FIGHTSTG_techBoosts): boost a stat of the user, or lower the other side's,...
TechBoost FIGHTSTG_sideBoosts[]
and the ones that boost a stat of all the user's side
s32 FIGHTSTG_clearIds[]
the event types that the European version's FIGHTSTG_reviveFighter clears
s32 FIGHTSTG_statusTechArgs[]
the argument of message 9, which the odd techniques show,
static void useSupportTech(TechAction *task, BattleChild *children, TechData *tech)
A support technique: a boost, a charge, a restriction or digidevolving the enemy, or the enemy's drai...
void FIGHTSTG_updateTechAction(TechAction *task, BattleChild *children)
A side's technique or item (FIGHTSTG_startTechAction): state 0 shows its message (announceTech),...
s32 FIGHTSTG_statusTechLines[]
and the message shown when the target has the status
static void chargeUser(TechAction *task, BattleChild *children, TechData *tech)
Techniques 0xD1 and 0xD2: charge the user by the technique's power.
static void restoreSide(TechAction *task, BattleChild *children)
Technique 0x177: revives the partners and restores them whole, statuses included.
static void wakeUpOrCounter(TechAction *task, BattleChild *children)
After the technique: wakes the other side's fighter when it was asleep and the damage wakes it (or en...
static void announceTech(TechAction *task, BattleChild *children)
Starts the technique: its action for a physical or magic one, its message, and whether the other side...
TechBoost FIGHTSTG_techBoosts[]
the techniques that boost a stat of a fighter (FIGHTSTG_updateTechAction): the user's,...
static void drainMp(TechAction *task, BattleChild *children, TechData *tech)
Technique 0x188: the enemy drains the partner's MP by the technique's power in 128ths of its max MP.
static void dealTechDamage(TechAction *task, BattleChild *children)
A physical or magic technique: deals its damage to the other side's fighter (or its hits',...
static void boostFieldElement(TechAction *task, BattleChild *children, TechData *tech)
Icon 6's techniques: set the field's boosted element and its amount (the user's spirit / 10 plus the ...
u8 FIGHTSTG_statusTechFlags[]
techniques 0xBE-0xC5's four kinds of status (FIGHTSTG_updateTechAction): the flag of each in BattleFi...
TechAction * FIGHTSTG_startTechAction(s32 side, s32 tech)
Starts side's (0 or 0x10) technique or item tech.
static void startTechScript(TechAction *task, BattleChild *children)
Once the message is gone, starts the technique's script and spends the user's charge,...
static void useItemTech(TechAction *task, BattleChild *children)
An item technique: an auto-recovery, a cure, a revival or a heal.
static void cureStatusTech(TechAction *task, BattleChild *children)
Techniques 0xBE-0xC5: cure one of the four kinds of status (FIGHTSTG_statusTechFlags),...
BattleScript * WFIGHTMN_startTech(u8 actor, s32 id)
Starts the effect of actor's move id (FIGHTSTG's FIGHTSTG_createBattleScript): its kind and motions f...
void WFIGHTMN_chargeGauge(u8 side, s32 damage)
Adds what damage gives to the current partner's gauge (BATTLE_SETUP.gauges), up to 1000.
void WFIGHTMN_endWeakness(u8 side)
In BATTLE_KIND_FINAL_LAST, anything the partner does but an attack ends the enemy's weakness (FIGHTST...
A turn's or a counterattack's one child, and what WFIGHTMN's battle menu waits for (NULL when it is d...
Counterattack * counter
a counterattack (FIGHTSTG_startCounterattack)
ActionEvents * events
the queued events (FIGHTSTG_startActionEvents)
BattleMessageBox * message
FIGHTSTG_createMessage.
BattleScript * script
a technique's (FIGHTSTG_createBattleScript)
EnemyAttack * enemyAttack
an attack on the player's fighter (FIGHTSTG_startEnemyAttack)