Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
battle.h
Go to the documentation of this file.
1#ifndef FIGHTSTG_BATTLE_H
2#define FIGHTSTG_BATTLE_H
3
4/* FIGHTSTG's battle state: the battle table, stats, elements and
5 resistances, the fighters, the events queue, the action and its effects,
6 the rolls and the damage (battle.c, battle_table.c, stats.c, damage.c,
7 rolls.c, boosts.c, events.c, speed.c, tech_effects.c, enemy_turn.c and
8 start.c). */
9
12
13/* A table of 0x46-byte entries that start with an s16 id, 0 after the
14 last (FIGHTSTG_findBattleTableIndex) */
15#if VERSION_US || VERSION_JP
16#define FILE_BATTLE_TABLE 0xBE
17#elif VERSION_EU
18#define FILE_BATTLE_TABLE 0x1CF
19#endif
20
21/* What an enemy does: its target (FIGHTSTG_getEnemyAction) when the condition holds */
22typedef struct BattleTableAction {
23 /* 0x0 */ u8 target;
24 /* 0x1 */ u8 condition;
25 /* 0x2 */ s16 conditionArg;
27
28/* BattleStats.stats' indices: the partner's first five battle stats */
29#define BATTLE_STAT_ATTACK 0 /* physical damage */
30#define BATTLE_STAT_DEFENSE 1 /* against it */
31#define BATTLE_STAT_SPIRIT 2 /* magic damage, and against it */
32#define BATTLE_STAT_WISDOM 3 /* magic accuracy, statuses and heals */
33#define BATTLE_STAT_SPEED 4 /* physical accuracy, evasion and running away */
34
35/* The elements (TechData.element, BattleStats.element) and the families
36 (TechData.family, BattleStats.family) start at 2: under it, none */
37#define ELEMENT_FIRST 2
38#define ELEMENT_COUNT 7
39#define FAMILY_FIRST 2
40
41/* TechData.icon's kinds of attack */
42#define TECH_PHYSICAL 2 /* FIGHTSTG_rollHit and FIGHTSTG_computeDamage */
43#define TECH_MAGIC 3 /* FIGHTSTG_rollMagicHit and FIGHTSTG_computeMagicDamage */
44
45/* BattleStats.resist's indices: against the elements (element -
46 ELEMENT_FIRST), then against the statuses */
47#define RESIST_POISON 7
48#define RESIST_PARALYSIS 8
49#define RESIST_CONFUSION 9
50#define RESIST_SLEEP 10
51#define RESIST_KNOCK_OUT 11
52#define RESIST_COUNT 12
53
54/* BattleTableEntry.actions' last one, which the enemy takes when none of
55 the others' conditions holds: its own is never tested */
56#define BATTLE_TABLE_FALLBACK 3
57
58typedef struct BattleTableEntry {
59 /* 0x00 */ s16 id;
60 /* 0x02 */ s16 item; /* what the enemy may leave */
61 /* 0x04 */ s16 itemChance; /* in 1024ths, less one */
62 /* 0x06 */ s16 nameId; /* string in file 0x4F */
63 /* 0x08 */ s16 techs[3]; /* its first, then those of FIGHTSTG_getEnemyAction's kinds 2 and 3 */
64 /* 0x0E */ s16 stats[5]; /* by BATTLE_STAT_*, scaled by the enemy's strength / 16 */
65 /* 0x18 */ s16 resist[RESIST_COUNT];
66 /* 0x30 */ u8 family; /* FAMILY_*, the enemy's stats' */
67 /* 0x32 */ BattleTableAction actions[BATTLE_TABLE_FALLBACK + 1]; /* the first whose condition holds (FIGHTSTG_testEnemyCondition) */
68 /* 0x42 */ BattleTableAction counter; /* its counterattack (FIGHTSTG_updateCounterattack) */
70
71/* FIGHTSTG_startEnemyTurn's task */
72typedef struct EnemyTurn {
74 /* 0x50 */ s32 lines[10]; /* FIGHTSTG_updateMessage's, 0 ends them */
75 /* 0x78 */ s32 target; /* -2 to -4 for an enemy, else any but the active one */
76 /* 0x7C */ s32 switchTo; /* the enemy fighter it brings in (FIGHTSTG_pickEnemySwitch) */
77} EnemyTurn;
78
79/* The types of the battle's events: WFIGHTMN runs a state for each
80 (WFIGHTMN_runTurn) */
81#define EVENT_END_BATTLE 1 /* FIGHTSTG_endBattle */
82#define EVENT_PLAYER_TURN 2
83#define EVENT_ENEMY_TURN 3
84#define EVENT_RUN_AWAY 4
85#define EVENT_AUTO_RECOVER_END 5
86#define EVENT_RECOVERY 6
87#define EVENT_CLEAR_FIELD 7
88#define EVENT_PARTNER_TECH 8 /* a technique of the partner's, run as its command */
89#define EVENT_STATUS_DAMAGE 9 /* the damage of a poisoned fighter (FIGHTER_POISONED) */
90#define EVENT_STATUS_END 10 /* 10-12: the end of FIGHTER_PARALYZED, FIGHTER_CONFUSED or FIGHTER_ASLEEP */
91#define EVENT_BOOST_END 13 /* 13-15: the end of a boost, by the stat */
92#define EVENT_RESTRICTION_END 16 /* 16-17: the end of a restriction (FIGHTER_NO_SWITCH or FIGHTER_NO_DIGIVOLVE) */
93#define EVENT_BLAST 18 /* the partner's digivolution for the battle */
94#define EVENT_BLAST_END 19
95#define EVENT_KNOCK_OUT 20
96#define EVENT_SPECIAL_END 21 /* the end of the partner's special state */
97#define EVENT_DIGIDEVOLVE 22
98#define EVENT_LAST_ENEMY 23 /* the last battle's third enemy comes in */
99#define EVENT_WEAKNESS_END 24 /* the end of the enemy's weakness (BATTLE_KIND_FINAL_LAST) */
100
101/* An event of the battle, as it is queued (FIGHTSTG_pushEvent) */
102typedef struct BattleEvent {
103 /* 0x00 */ s32 type; /* EVENT_END_BATTLE... */
104 /* 0x04 */ s32 delay;
105 /* 0x08 */ s32 args[6];
107
108/* A queued event: its time counts down to when it runs */
109typedef struct QueuedEvent {
110 /* 0x00 */ s16 type; /* 0 for a free entry */
111 /* 0x02 */ s16 time;
112 /* 0x04 */ s32 args[6];
114
115/* What FIGHTSTG_removeEvents removes the events of: an event's first two
116 args, as FIGHTSTG_queueRecovery and the others push them */
117typedef struct EventKey {
118 /* 0x0 */ u8 side; /* SIDE_PLAYER or SIDE_ENEMY */
119 /* 0x4 */ s32 fighter; /* its index in the side's fighters */
120} EventKey;
121
122/* The kinds of battle (Battle.kind), which WFIGHTMN picks by the battle and
123 the mode it came from */
124#define BATTLE_KIND_NORMAL 0
125#define BATTLE_KIND_ESCAPE 1 /* the enemy runs away under a tenth of its HP */
126#define BATTLE_KIND_UNK2 2 /* the enemy keeps an eleventh of its HP */
127#define BATTLE_KIND_NO_DAMAGE 3 /* the partner's hits do no damage */
128#define BATTLE_KIND_FINAL 4 /* battle 0x144, the last one: its first enemy */
129#define BATTLE_KIND_FINAL_SECOND 5 /* its second enemy */
130#define BATTLE_KIND_FINAL_LAST 6 /* its third enemy; winning plays the ending */
131
132/* How a battle ends (FIGHTSTG_endBattle) */
133#define BATTLE_FLED 0 /* a side ran away */
134#define BATTLE_WON 1
135#define BATTLE_LOST 2
136
137/* The event queue's functions (FIGHTSTG_events.funcs) */
138typedef struct EventQueueFuncs {
139 /* 0x00 */ u8 result; /* the battle's, for WFIGHTMN (BATTLE_FLED...) */
140 /* 0x01 */ u8 statusStrength; /* getDelay's, for the end of a status (kinds 9 to 11) */
141 /* 0x04 */ void (*push)(BattleEvent *event);
142 /* 0x08 */ void (*pushFirst)(BattleEvent *event); /* before all the others */
143 /* 0x0C */ s32 (*pop)(void); /* the next event due */
144 /* 0x10 */ s32 (*first)(s32 type);
145 /* 0x14 */ s32 (*next)(void);
146 /* 0x18 */ s32 (*find)(s32 type, u8 side, s32 fighter);
147 /* 0x1C */ void (*remove)(EventKey *key); /* the events whose first two args are its */
148 /* 0x20 */ s32 (*getDelay)(u8 side, s32 kind); /* FIGHTSTG_getEventDelay: when an event of side's runs */
149 /* 0x24 */ void (*cureStatus)(u8 side, s32 fighter, s32 item); /* FIGHTSTG_cureStatus: an item's cure */
151
152/* An event kind's delay range (FIGHTSTG_eventDelays, by kind): FIGHTSTG_getEventDelay
153 adds a random part below div, and clamps to min and max where they are
154 not 0 */
155typedef struct EventDelay {
156 /* 0x0 */ s16 div;
157 /* 0x2 */ s16 min;
158 /* 0x4 */ s16 max;
159} EventDelay;
160
162
163/* The battle's events (FIGHTSTG_events) */
164typedef struct EventQueue {
165 /* 0x000 */ QueuedEvent events[99];
166 /* 0xAD4 */ u8 pad[0x1C]; /* never read or written: room for a 100th QueuedEvent, which the loops (i < 99) never reach */
167 /* 0xAF0 */ s8 curType; /* the type of the event popped last */
168 /* 0xAF1 */ s8 curIndex; /* and where it is */
169 /* 0xAF2 */ s8 findType; /* what first and next look for, 1-24 */
170 /* 0xAF3 */ s8 found; /* the event they found, or -1 */
172} EventQueue;
173
174/* The battle's sides, as the functions that take a side want them: side >> 4
175 is its row of FIGHTSTG_battle.state.fighters, and SIDE_ENEMY - side the other
176 side */
177#define SIDE_PLAYER 0
178#define SIDE_ENEMY 0x10
179
180/* BattleFighter.flags: the statuses, which the techniques give
181 (FIGHTSTG_inflict*) and events of type EVENT_STATUS_END + n end */
182#define FIGHTER_POISONED 1 /* takes damage (EVENT_STATUS_DAMAGE) */
183#define FIGHTER_PARALYZED 2 /* loses turns at random (FIGHTSTG_battleFuncs.testParalysis) */
184#define FIGHTER_CONFUSED 4
185#define FIGHTER_ASLEEP 8 /* can't act or run away; a hit may wake it up */
186#define FIGHTER_NO_SWITCH 0x10 /* can't switch out or run away (TECH_EFFECT_NO_SWITCH) */
187#define FIGHTER_NO_DIGIVOLVE 0x20 /* can't digivolve or use a switch-in technique (TECH_EFFECT_NO_DIGIVOLVE) */
188
189/* One of the battle's fighters, three on each side (WFIGHTMN's BattleUnit):
190 a partner's HP and MP go back to the party when the battle ends */
191typedef struct BattleFighter {
192 /* 0x00 */ s16 id; /* the Digimon (DIGIMON_DATA) */
193 /* 0x02 */ s16 prevId; /* its own id while id is a temporary one */
194 /* 0x04 */ s16 turns; /* an enemy's, for its battle table's conditions */
195 /* 0x06 */ s16 maxHp;
196 /* 0x08 */ s16 hp;
197 /* 0x0A */ s16 maxMp;
198 /* 0x0C */ s16 mp;
199 /* 0x0E */ s16 charge; /* added in 64ths to its next technique's damage, which uses it up */
200 /* 0x10 */ s16 boosts[4]; /* added to the stats FIGHTSTG_boostStats picks */
201 /* 0x18 */ s16 item; /* an enemy's */
202 /* 0x1A */ u8 temporary; /* id is a temporary Digimon */
203 /* 0x1B */ u8 special; /* the partner's special state (EVENT_SPECIAL_END): doubles its effects */
204 /* 0x1C */ u8 flags; /* FIGHTER_* */
205 /* 0x1D */ u8 paralysis; /* FIGHTER_PARALYZED's strength */
206 /* 0x1E */ u8 sleep; /* FIGHTER_ASLEEP's */
207 /* 0x1F */ u8 confusion; /* FIGHTER_CONFUSED's */
209
210/* How the battle's frames go by (FIGHTSTG_setSpeed sets it) */
211typedef struct BattleSpeed {
212 /* 0x0 */ s32 mode; /* 1: stopped, 2: slowed (a frame per 4 of time), 3: double */
213 /* 0x4 */ s32 rest; /* the time mode 2 hasn't counted yet */
215
216/* The battle's element boost: one element's techniques do more damage, and
217 the ones of the element it weakens less (FIGHTSTG_getElementBoost) */
218typedef struct ElementBoost {
219 /* 0x0 */ s16 element; /* under ELEMENT_FIRST: none */
220 /* 0x2 */ s16 amount; /* in 128ths */
222
223/* What a battle starts from: WFIGHTMN_start zeroes it as one block, and
224 FIGHTSTG_testRunAway reads runAttempts through a pointer to it */
225typedef struct BattleState {
226 /* 0x00 */ s32 active[2]; /* each side's fighter */
227 /* 0x08 */ BattleFighter fighters[2][3];
228 /* 0xC8 */ ElementBoost boost;
229 /* 0xCC */ s16 runAttempts; /* the player's, each of which makes running away likelier (FIGHTSTG_testRunAway) */
230 /* 0xCE */ s16 kind; /* the kind of battle */
231 /* 0xD0 */ s16 tech; /* a technique id, set by WFIGHTMN */
232 /* 0xD2 */ s8 hitCount; /* BATTLE_KIND_FINAL_LAST: the partner's hits that did damage */
233 /* 0xD3 */ u8 weakened; /* BATTLE_KIND_FINAL_LAST: the enemy is weakened (FIGHTSTG_weakenEnemy) */
235
236/* FIGHTSTG_battle: the battle */
237typedef struct Battle {
238 /* 0x00 */ s32 pad; /* never read or written */
239 /* 0x04 */ s32 frames; /* since the last update */
240 /* 0x08 */ BattleState state;
241 /* 0xDC */ BattleSpeed speed;
242 /* 0xE4 */ void (*countFrames)(void);
243 /* 0xE8 */ void (*setSpeed)(s32 mode);
244 /* 0xEC */ void (*project)(Layer *layer, SVECTOR *pos, ShortVec3 *out); /* FIGHTSTG_projectPoint */
245 /* 0xF0 */ void (*drawQuad)(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors);
246 /* 0xF4 */ void (*drawBlendedQuad)(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors);
247} Battle;
248
249/* A technique's effect (TechData.effect), which FIGHTSTG_applyTechEffect
250 carries out when its hit lands, and BattleAction.effects' index */
251#define TECH_EFFECT_FIRST 2 /* under it, the technique has none */
252#define TECH_EFFECT_POISON 2
253#define TECH_EFFECT_PARALYSIS 3
254#define TECH_EFFECT_CONFUSION 4
255#define TECH_EFFECT_SLEEP 5
256#define TECH_EFFECT_KNOCK_OUT 6
257#define TECH_EFFECT_DRAIN 8 /* HP, in 128ths of the damage */
258#define TECH_EFFECT_MULTI_HIT 9
259#define TECH_EFFECT_ENEMY_ONLY 10 /* does nothing but for the enemy whose battle table entry lists it first */
260#define TECH_EFFECT_CRITICAL 11 /* raises the critical hit chance */
261#define TECH_EFFECT_STEAL 12 /* the enemy's item */
262#define TECH_EFFECT_NO_SWITCH 13 /* FIGHTER_NO_SWITCH for a while */
263#define TECH_EFFECT_NO_DIGIVOLVE 14 /* FIGHTER_NO_DIGIVOLVE for a while */
264#define TECH_EFFECT_LOWER_ATTACK 26
265#define TECH_EFFECT_LOWER_DEFENSE 27
266#define TECH_EFFECT_DRAIN_MP 29 /* the partner's, in 128ths of its max MP */
267#define TECH_EFFECT_DOUBLE_MAGIC 31 /* two magic hits, as techniques 0x1B9 and 0x1BA */
268#define TECH_EFFECT_RAISE_ONE_STATUS 32 /* PartnerStats.status: one at random */
269#define TECH_EFFECT_RAISE_EACH_STATUS 33 /* each one that a roll lets */
270#define TECH_EFFECT_RAISE_ALL_STATUS 34
271#define TECH_EFFECT_END_BATTLE 35 /* in BATTLE_KIND_UNK2: takes 70 percent of the partner's HP, ends as BATTLE_FLED */
272
273/* FIGHTSTG_action: the technique being carried out */
274typedef struct BattleAction {
275 /* 0x00 */ u8 pad[0x20]; /* never read or written */
276 /* 0x20 */ u8 side; /* the acting side, SIDE_PLAYER or SIDE_ENEMY */
277 /* 0x24 */ s32 tech; /* the technique */
278 /* 0x28 */ s32 damage; /* per hit */
279 /* 0x2C */ s32 drain; /* the HP or MP that TECH_EFFECT_DRAIN or TECH_EFFECT_DRAIN_MP takes */
280 /* 0x30 */ u8 hits[4]; /* whether each hit lands */
281 /* 0x34 */ s16 hitsLanded;
282 /* 0x36 */ s16 hitCount; /* rolled in hits */
283 /* 0x38 */ u8 effects[0x28]; /* by TECH_EFFECT_*: what each one does, 0 for none */
284 /* 0x60 */ s32 hitDamage[2]; /* TECH_EFFECT_DOUBLE_MAGIC's */
285 /* 0x68 */ void (*start)(u8 side, s32 tech); /* FIGHTSTG_startAction */
287
288/* The statuses a weapon's hits can inflict (BattleStats.statuses) */
289#define HIT_POISON 0
290#define HIT_PARALYSIS 1
291#define HIT_CONFUSION 2
292#define HIT_KNOCK_OUT 3 /* its power is read by nothing */
293#define HIT_DRAIN 4 /* its power is in 128ths of the damage */
294#define HIT_STATUS_COUNT 5
295
296/* A status a weapon's hits can inflict */
297typedef struct HitStatus {
298 /* 0x0 */ u8 chance; /* in 128ths */
299 /* 0x1 */ u8 power;
300} HitStatus;
301
302/* A side's stats as FIGHTSTG_computeStats works them out. A family is the
303 kind of Digimon that a technique (TechData.family) or a weapon does half again
304 the damage to, and to which it lands critical hits more often. */
305typedef struct BattleStats {
306 /* 0x00 */ s16 level;
307 /* 0x02 */ s16 stats[5]; /* with the fighter's boosts */
309 /* 0x24 */ u8 flags; /* the fighter's */
310 /* 0x25 */ u8 family;
311 /* 0x26 */ u8 damageBonus; /* in 64ths: the fighter's charge */
312 /* 0x27 */ u8 damageCut; /* taken off each hit */
313 /* 0x28 */ u8 weaponFamilies[3]; /* from the equipment, as are the ones after */
314 /* 0x2B */ u8 element; /* the accessory's, for techniques without one */
315 /* 0x2C */ u8 elementPower;
316 /* 0x2D */ HitStatus statuses[HIT_STATUS_COUNT]; /* by HIT_*, from the weapon */
317 /* 0x37 */ u8 tripleHit; /* plain physical techniques hit 3 times for 0.4 of the damage */
318 /* 0x38 */ u8 criticalBonus; /* to plain techniques' critical chance, off their accuracy */
319 /* 0x39 */ u8 counter; /* answers hits with the partner's first skill */
320 /* 0x3A */ u8 accuracy;
321 /* 0x3B */ u8 evasion;
322 /* 0x3C */ u8 runAwayBonus; /* to the player's chance to run away */
323 /* 0x3D */ u8 runAwayGuard; /* halves the enemy's chance to run away */
324 /* 0x3E */ u8 stealBonus;
325 /* 0x3F */ u8 pad; /* only cleared with the rest (HEAP.zero of sizeof); BattleFuncs.stats[2] spans 0x80 bytes */
327
328/* FIGHTSTG_battleFuncs */
329typedef struct BattleFuncs {
330 /* 0x00 */ BattleStats stats[2]; /* the player's, then the enemy's */
331 /* 0x80 */ BattleStats *(*computeStats)(u8 side, s32 which, s32 index);
332 /* 0x84 */ s32 (*computeDamage)(u8 side, s32 tech); /* of each hit */
333 /* 0x88 */ s32 (*computeMagicDamage)(u8 side, s32 id);
334 /* 0x8C */ s32 (*getDamage)(s32 *args); /* of the event whose args these are */
335 /* 0x90 */ s32 (*computeCounterDamage)(u8 side, s32 id, s32 value);
336 /* 0x94 */ s32 (*computeHeal)(u8 side, s32 id);
337 /* 0x98 */ s32 (*getHeal)(u8 side, s32 index, s32 big); /* a part of its max HP */
338 /* 0x9C */ s32 (*rollHit)(u8 side, s32 tech); /* whether a hit lands */
339 /* 0xA0 */ s32 (*rollMagicHit)(u8 side, s32 id);
340 /* 0xA4 */ s32 (*rollPoison)(u8 side, s32 id);
341 /* 0xA8 */ s32 (*rollParalysis)(u8 side, s32 id);
342 /* 0xAC */ s32 (*rollConfusion)(u8 side, s32 id);
343 /* 0xB0 */ s32 (*rollSleep)(u8 side, s32 id);
344 /* 0xB4 */ s32 (*rollKnockOut)(u8 side, s32 id);
345 /* 0xB8 */ s32 (*rollSteal)(u8 side, s32 id);
346 /* 0xBC */ s32 (*rollDrain)(u8 side, s32 id);
347 /* 0xC0 */ s32 (*rollDedigivolve)(s32 actor, s32 id);
348 /* 0xC4 */ s32 (*rollStatusRaise)(s32 actor, s32 id);
349 /* 0xC8 */ s32 (*rollNoSwitch)(s32 actor, s32 id);
350 /* 0xCC */ s32 (*rollNoDigivolve)(s32 actor, s32 id);
351#if VERSION_EU || VERSION_JP
352 /* 0xD0 */ s32 (*rollCounter)(s32 arg0, s32 arg1);
353#endif
354 /* the European version's offsets are 4 more from here */
355 /* 0xD0 */ s32 (*testRunAway)(u8 side);
356 /* 0xD4 */ s32 (*testWakeUp)(u8 side, s32 value);
357 /* 0xD8 */ s32 (*testConfusion)(u8 side);
358 /* 0xDC */ s32 (*testParalysis)(u8 side); /* whether side's paralysis costs it the turn */
359 /* 0xE0 */ void (*changeBoost)(u8 side, s32 index, s32 stat, s32 percent); /* changes a fighter's stat boost */
360 /* 0xE4 */ s32 (*getGaugeGain)(s32 damage); /* from the partner's damage, up to 1000 */
361 /* 0xE8 */ s32 (*getTechCost)(u8 side, s32 id);
363
364/* The tasks FIGHTSTG starts for WFIGHTMN and WFIGHTTS */
365/* WFIGHTMN passes them the battle, which they don't read; its code loads
366 it, so no parameter list */
367EnemyTurn *FIGHTSTG_startEnemyTurn(); /* (void): unprototyped, as WFIGHTMN passes it &FIGHTSTG_battle */
368
369/* The events they queue for WFIGHTMN, and its turn's substate */
370void FIGHTSTG_queuePlayerTurn(s32 delay);
371void FIGHTSTG_queueEnemyTurn(s32 delay);
372void FIGHTSTG_endBattle(s32 result);
373void FIGHTSTG_queueRunAway(u8 side);
374void FIGHTSTG_queueRecovery(u8 side, s32 fighter, s32 big);
375void FIGHTSTG_queueKnockOut(u8 side);
376void FIGHTSTG_queueBlast(void);
377void FIGHTSTG_queueBlastEnd(s32 kind);
378void FIGHTSTG_queueSpecialEnd(void);
379void FIGHTSTG_weakenEnemy(void);
381
382/* Shared between the overlay's objects */
385/* FIGHTSTG_action's bytes before start, which a new action clears */
386#define BATTLE_ACTION_STATE_SIZE ((u8 *)&FIGHTSTG_action.start - (u8 *)&FIGHTSTG_action)
388extern s16 FIGHTSTG_boostStats[];
390extern u8 FIGHTSTG_statusEvents[]; /* FIGHTSTG_cureStatus's event types */
391extern u8 FIGHTSTG_statusFlags[]; /* and the status flags they clear */
393extern BattleTableEntry *(*FIGHTSTG_battleTableFunc)(s32 id);
400s32 FIGHTSTG_findEvent(s32 type, u8 side, s32 fighter);
402void FIGHTSTG_updateRoot(Task *task, Task **children);
404void FIGHTSTG_updateEnemyTurn(EnemyTurn *task, BattleChild *children);
405void FIGHTSTG_queueLastEnemy(void);
406s32 FIGHTSTG_testEnemyCondition(u8 condition, s16 arg);
408s32 FIGHTSTG_getEventDelay(u8 side, s32 kind);
409void FIGHTSTG_cureStatus(u8 side, s32 fighter, s32 item);
410void FIGHTSTG_tryPoison(void);
411void FIGHTSTG_tryParalysis(void);
412void FIGHTSTG_tryConfusion(void);
413void FIGHTSTG_trySleep(void);
414void FIGHTSTG_tryKnockOut(void);
415void FIGHTSTG_rollMultiHit(void);
416void FIGHTSTG_tryDrain(void);
417void FIGHTSTG_markEnemyOnly(void);
418void FIGHTSTG_markCritical(void);
419void FIGHTSTG_lowerAttack(void);
420void FIGHTSTG_lowerDefense(void);
421void FIGHTSTG_drainMp(void);
422void FIGHTSTG_raiseOneStatus(void);
423void FIGHTSTG_raiseEachStatus(void);
424void FIGHTSTG_raiseAllStatus(void);
425void FIGHTSTG_tryNoSwitch(void);
427void FIGHTSTG_startEndBattle(void);
428void FIGHTSTG_applyTechEffect(void);
429void FIGHTSTG_trySteal(void);
430void FIGHTSTG_queueBoostEnd(u8 side, s32 fighter, s32 kind, s32 tech);
433BattleStats *FIGHTSTG_computeStats(u8 side, s32 which, s32 index);
435extern s32 FIGHTSTG_eventPopModes[]; /* per event type, FIGHTSTG_popEvent takes (1), peeks at (-1) or skips (0) it */
436s32 FIGHTSTG_getElementBoost(s32 value, s32 element);
437s32 FIGHTSTG_adjustDamage(u8 side, s32 id, s32 value);
440extern s32 FIGHTSTG_boostEvents[]; /* FIGHTSTG_queueBoostEnd's event types */
441extern s32 FIGHTSTG_techEvents[]; /* and of FIGHTSTG_startRestriction */
442
443/* events.c's statuses and events */
445void FIGHTSTG_inflictConfusion(u8 side, s32 fromTech, u8 strength);
446void FIGHTSTG_inflictPoison(u8 side, s32 fighter, s32 damage);
447void FIGHTSTG_inflictParalysis(u8 side, s32 unused, u8 strength);
448void FIGHTSTG_inflictSleep(u8 side, s32 unused, u8 strength);
453
454/* the functions of FIGHTSTG_battle, FIGHTSTG_action and FIGHTSTG_battleFuncs */
455void FIGHTSTG_startAction(u8 side, s32 tech);
456void FIGHTSTG_countFrames(void);
457void FIGHTSTG_setSpeed(s32 mode);
463s32 FIGHTSTG_getHeal(u8 side, s32 index, s32 big);
464s32 FIGHTSTG_rollHit(u8 side, s32 id);
466s32 FIGHTSTG_rollPoison(u8 side, s32 id);
469s32 FIGHTSTG_rollSleep(u8 side, s32 id);
471s32 FIGHTSTG_rollSteal(u8 side, s32 id);
472s32 FIGHTSTG_rollDrain(u8 side, s32 id);
478#if VERSION_EU || VERSION_JP
479s32 FIGHTSTG_rollCounter(s32 side, s32 damage);
480#endif
481s32 FIGHTSTG_testWakeUp(u8 side, s32 value);
484void FIGHTSTG_changeBoost(u8 side, s32 index, s32 stat, s32 percent);
487
488/* SIDE's active fighter as its row plus the index, which GCC adds with the
489 row's address first. The battle code reaches the active fighter in three
490 ways that compile to different instructions: this one,
491 &fighters[side][active[side]] (most of it) and FIGHTSTG_getActiveFighter's
492 below; the match depends on which one each place uses. */
493#define ACTIVE_FIGHTER(side) (FIGHTSTG_battle.state.fighters[side] + FIGHTSTG_battle.state.active[side])
494
495/* Row's active fighter (FIGHTSTG_battle.state.fighters[row][active[row]]), as the
496 row's offset in bytes added to the slot's fighter in row 0 */
498 s32 offset = row * sizeof(FIGHTSTG_battle.state.fighters[0]);
500
501 return (BattleFighter *)(offset + (s32)slot);
502}
503
504#endif /* FIGHTSTG_BATTLE_H */
s32 FIGHTSTG_testWakeUp(u8 side, s32 value)
FIGHTSTG_battleFuncs.testWakeUp: whether a hit of value wakes side's fighter up, likelier the bigger ...
Definition rolls.c:510
s32 FIGHTSTG_findNextEvent(void)
FIGHTSTG_events.funcs.next: the next queued event of the same type, or -1.
Definition events.c:181
void FIGHTSTG_trySleep(void)
TECH_EFFECT_SLEEP: puts the target to sleep when rollSleep lets it, twice as strongly when the acting...
void FIGHTSTG_cureStatus(u8 side, s32 fighter, s32 item)
An item's cure (FIGHTSTG_events.funcs.cureStatus): items 0xBE-0xC5 clear a status of the fighter and ...
Definition events.c:310
EventDelay FIGHTSTG_eventDelays[]
the delay ranges of FIGHTSTG_getEventDelay's kinds
Definition events.c:214
void FIGHTSTG_raiseOneStatus(void)
TECH_EFFECT_RAISE_ONE_STATUS: when rollStatusRaise lets it, raises one of the partner's status values...
s32 FIGHTSTG_rollCounter(s32 side, s32 damage)
FIGHTSTG_battleFuncs.rollCounter: a random test, likelier the bigger damage is next to the player's f...
Definition rolls.c:437
void FIGHTSTG_inflictConfusion(u8 side, s32 fromTech, u8 strength)
Confuses side's active fighter (FIGHTER_CONFUSED) with a strength, and queues its end (put off by the...
Definition events.c:506
static BattleFighter * FIGHTSTG_getActiveFighter(s32 row)
Row's active fighter (FIGHTSTG_battle.state.fighters[row][active[row]]), as the row's offset in bytes...
Definition battle.h:497
#define HIT_STATUS_COUNT
Definition battle.h:294
void FIGHTSTG_tryDrain(void)
When rollDrain allows it, the action's drain becomes its damage times a 128th of the technique's effe...
void FIGHTSTG_markEnemyOnly(void)
TECH_EFFECT_ENEMY_ONLY outside its own enemy's hands: marks the effect, which takes the place of the ...
void FIGHTSTG_tryConfusion(void)
TECH_EFFECT_CONFUSION: confuses the target when rollConfusion lets it, with the technique's effectPow...
void FIGHTSTG_tryNoSwitch(void)
TECH_EFFECT_NO_SWITCH: marks the effect when rollNoSwitch lets it.
s32 FIGHTSTG_getEnemyAction(u8 kind)
What an enemy's action target makes it do (EnemyTurn.target): 1 its first technique,...
Definition enemy_turn.c:438
s32 FIGHTSTG_findBattleTableIndex(s32 id)
Enemy Digimon id's index in the battle table (FILE_BATTLE_TABLE: each enemy's stats,...
Definition battle_table.c:7
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 ...
Definition events.c:417
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...
Definition rolls.c:288
void FIGHTSTG_queueAutoRecoverEnd(u8 side)
Queues the end of side's automatic recovery (item 0xBD), or pushes back the one already queued.
Definition events.c:396
s32 FIGHTSTG_rollNoSwitch(s32 actor, s32 id)
Whether TECH_EFFECT_NO_SWITCH works: the technique's chance.
Definition rolls.c:425
void FIGHTSTG_tryKnockOut(void)
TECH_EFFECT_KNOCK_OUT: knocks the target out when rollKnockOut lets it.
void FIGHTSTG_markCritical(void)
TECH_EFFECT_CRITICAL: marks the effect, which rollCritical has used.
void FIGHTSTG_startAction(u8 side, s32 tech)
the functions of FIGHTSTG_battle, FIGHTSTG_action and FIGHTSTG_battleFuncs
s32 FIGHTSTG_testEnemyCondition(u8 condition, s16 arg)
Whether the condition of an enemy's action holds (BattleTableAction): always, a chance in 128,...
Definition enemy_turn.c:303
s32 FIGHTSTG_rollMagicHit(u8 side, s32 id)
Whether a magic hit lands: the technique's accuracy with the wisdom and level differences; the player...
Definition rolls.c:165
void FIGHTSTG_queueClearField(s32 time)
events.c's statuses and events
Definition events.c:436
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...
Definition rolls.c:367
s32 FIGHTSTG_rollNoDigivolve(s32 actor, s32 id)
Whether TECH_EFFECT_NO_DIGIVOLVE works: the technique's chance.
Definition rolls.c:430
s32 FIGHTSTG_techEvents[]
and of FIGHTSTG_startRestriction
Definition battle.c:7
void FIGHTSTG_tryPoison(void)
TECH_EFFECT_POISON: poisons the target when rollPoison lets it, twice as strongly when the acting fig...
Definition tech_effects.c:7
void FIGHTSTG_pushEventFirst(BattleEvent *event)
FIGHTSTG_events.funcs.pushFirst: queues an event ahead of all the others, which wait its delay longer...
Definition events.c:54
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.
Definition damage.c:306
void FIGHTSTG_countFrames(void)
How many frames the battle moves on this frame by its speed mode: as many as went by,...
Definition speed.c:7
void FIGHTSTG_queueBlast(void)
Queues the partner's digivolution for the battle (event 18), now.
Definition battle.c:90
BattleAction FIGHTSTG_action
the command being carried out
Definition battle.c:12
Battle FIGHTSTG_battle
Shared between the overlay's objects.
Definition battle.c:16
void FIGHTSTG_startDoubleMagic(void)
Starts a TECH_EFFECT_DOUBLE_MAGIC technique: two magic hits, each with the damage of technique 0x1B9 ...
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...
Definition rolls.c:400
s32 FIGHTSTG_testParalysis(u8 side)
FIGHTSTG_battleFuncs.testParalysis: whether side's paralysis costs it the turn, a random test of its ...
Definition rolls.c:560
void FIGHTSTG_inflictParalysis(u8 side, s32 unused, u8 strength)
Paralyzes side's active fighter (FIGHTER_PARALYZED) with a strength, and queues its end,...
Definition events.c:481
void FIGHTSTG_drainMp(void)
TECH_EFFECT_DRAIN_MP: takes the technique's effectPower in 128ths of the player's fighter's max MP,...
void FIGHTSTG_lowerAttack(void)
TECH_EFFECT_LOWER_ATTACK: lowers the attack of the other side's active fighter by the technique's eff...
s32 FIGHTSTG_boostEvents[]
FIGHTSTG_queueBoostEnd's event types.
Definition events.c:558
s32 FIGHTSTG_getDamage(s32 *args)
getDamage: the damage of an event (args: the side, the fighter and the base damage) to the fighter if...
Definition damage.c:196
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)...
Definition rolls.c:325
void FIGHTSTG_weakenEnemy(void)
Weakens the enemy in BATTLE_KIND_FINAL_LAST: halves its boosts of stats 1 and 2 and queues the end (e...
Definition battle.c:160
void FIGHTSTG_inflictPoison(u8 side, s32 fighter, s32 damage)
Poisons a fighter (FIGHTER_POISONED), and queues its damage or updates the one already queued.
Definition events.c:456
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...
Definition rolls.c:123
void FIGHTSTG_removeEvents(EventKey *key)
FIGHTSTG_events.funcs.remove: drops every queued event of key's side and fighter.
Definition events.c:201
void FIGHTSTG_startRestriction(s32 tech)
Restricts the partner with technique tech: sets FIGHTER_NO_SWITCH or FIGHTER_NO_DIGIVOLVE by the tech...
Definition battle.c:43
void FIGHTSTG_updateEnemyTurn(EnemyTurn *task, BattleChild *children)
The enemy's turn: a message when its HP is under a tenth, then one when it is asleep,...
Definition enemy_turn.c:174
EnemyTurn * FIGHTSTG_startEnemyTurn()
WFIGHTMN passes them the battle, which they don't read; its code loads it, so no parameter list.
Definition enemy_turn.c:293
u8 FIGHTSTG_statusFlags[]
and the status flags they clear
Definition events.c:304
s32 FIGHTSTG_opposedElements[]
the element whose boost (FIGHTSTG_getElementBoost) weakens each one
Definition damage.c:6
s32 FIGHTSTG_eventPopModes[]
per event type, FIGHTSTG_popEvent takes (1), peeks at (-1) or skips (0) it
Definition events.c:32
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...
Definition damage.c:89
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...
Definition rolls.c:9
BattleTableEntry * FIGHTSTG_getBattleTableEntry(s32 id)
Enemy Digimon id's entry in the battle table, or NULL.
void FIGHTSTG_lowerDefense(void)
TECH_EFFECT_LOWER_DEFENSE: lowers the defense of the other side's active fighter by the technique's e...
#define RESIST_COUNT
Definition battle.h:52
void FIGHTSTG_trySteal(void)
TECH_EFFECT_STEAL: when the enemy's active fighter holds an item and rollSteal lets the player take i...
s32 FIGHTSTG_getEventDelay(u8 side, s32 kind)
FIGHTSTG_events.funcs.getDelay: the time until side's next event of kind (FIGHTSTG_eventDelays): rand...
Definition events.c:224
s32 FIGHTSTG_rollParalysis(u8 side, s32 id)
Whether a hit paralyzes, like rollPoison (BATTLE_BLOCK_PARALYSIS keeps the player from it)
Definition rolls.c:276
void FIGHTSTG_inflictSleep(u8 side, s32 unused, u8 strength)
Puts side's active fighter to sleep (FIGHTER_ASLEEP) with a strength, and queues its end,...
Definition events.c:535
#define BATTLE_TABLE_FALLBACK
BattleTableEntry.actions' last one, which the enemy takes when none of the others' conditions holds: ...
Definition battle.h:56
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...
Definition damage.c:16
void FIGHTSTG_tryParalysis(void)
TECH_EFFECT_PARALYSIS: paralyzes the target when rollParalysis lets it, with the technique's effectPo...
void FIGHTSTG_queueSpecialEnd(void)
Queues the end of the partner's special state (event 21): the USA version pushes back the one already...
Definition battle.c:117
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'...
Definition rolls.c:195
s32 FIGHTSTG_testRunAway(u8 side)
FIGHTSTG_battleFuncs.testRunAway: a random test for side running away, from both sides' stats; the pl...
Definition rolls.c:451
s32 FIGHTSTG_pickEnemySwitch(EnemyTurn *task)
The enemy that the enemy's turn (FIGHTSTG_updateEnemyTurn) switches to: task->target's,...
Definition enemy_turn.c:9
BattleFuncs FIGHTSTG_battleFuncs
the battle's stats and the functions that compute with them
Definition battle.c:25
void FIGHTSTG_updateRoot(Task *task, Task **children)
The mode's root task: loads WFIGHTTS (the battle test, with the mode's argument) or WFIGHTMN and star...
Definition start.c:7
void FIGHTSTG_endBattle(s32 result)
Ends the battle: queues event 1 ahead of the others, with how it ended (BATTLE_FLED,...
Definition events.c:377
void FIGHTSTG_pushEvent(BattleEvent *event)
FIGHTSTG_events.funcs.push: queues an event in the first free one of the 99 slots,...
Definition events.c:11
BattleEvent FIGHTSTG_newEvent
what FIGHTSTG_pushEvent is given
void FIGHTSTG_changeBoost(u8 side, s32 index, s32 stat, s32 percent)
Changes a fighter's stat boost by percent 128ths of the stat without it, between minus half the stat ...
Definition boosts.c:14
void FIGHTSTG_queuePlayerTurn(s32 delay)
The events they queue for WFIGHTMN, and its turn's substate.
Definition events.c:360
void FIGHTSTG_applyTechEffect(void)
Carries out the effect of a technique whose hit landed.
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...
Definition rolls.c:413
void FIGHTSTG_queueRunAway(u8 side)
Queues side's attempt to run away (event 4)
Definition events.c:386
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,...
Definition damage.c:35
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...
Definition damage.c:122
void FIGHTSTG_queueDigidevolve(void)
Queues the partner's digidevolution, first.
Definition battle.c:143
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 ...
Definition damage.c:272
EventQueue FIGHTSTG_events
the battle's events and their functions
Definition events.c:43
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...
Definition damage.c:232
u8 FIGHTSTG_statusEvents[]
FIGHTSTG_cureStatus's event types.
Definition events.c:299
s32 FIGHTSTG_getGaugeGain(s32 damage)
What the partner's damage adds to the gauge: the square of its percent of the max HP over 20,...
Definition boosts.c:46
s32 FIGHTSTG_testConfusion(u8 side)
FIGHTSTG_battleFuncs.testConfusion: a random test of side's confusion against its resists 9 and 3.
Definition rolls.c:536
s32 FIGHTSTG_findEventFrom(s32 start)
The first queued event from slot start of the type being looked for (FIGHTSTG_events....
Definition events.c:159
s32 FIGHTSTG_getTechCost(u8 side, s32 id)
A technique's MP cost; accessories 0x143 and 0x144 cut the player's, to no less than 1.
Definition boosts.c:74
s32 FIGHTSTG_findEvent(s32 type, u8 side, s32 fighter)
FIGHTSTG_events.funcs.find: the first queued event of type for side's fighter, or -1.
Definition events.c:187
void FIGHTSTG_queueLastEnemy(void)
Queues the coming in of the last battle's third enemy, first.
Definition battle.c:152
void FIGHTSTG_startEndBattle(void)
Starts a TECH_EFFECT_END_BATTLE technique: in BATTLE_KIND_UNK2 its effect, elsewhere a plain physical...
void FIGHTSTG_queueKnockOut(u8 side)
Queues the fall of side's active fighter (event 20), first.
Definition battle.c:107
void FIGHTSTG_endEnemyWeakness(void)
Ends the enemy's weakness now: its queued event 24 runs next.
Definition battle.c:173
void FIGHTSTG_rollMultiHit(void)
TECH_EFFECT_MULTI_HIT and the triple-hit accessory: rolls the other hits, 3 or the technique's hitCou...
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...
Definition rolls.c:319
s32 FIGHTSTG_findFirstEvent(s32 type)
FIGHTSTG_events.funcs.first: the first queued event of type, or -1.
Definition events.c:175
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,...
Definition stats.c:42
s32 FIGHTSTG_popEvent(void)
Pops the next event: the one due soonest (in EU, events of types 2 and 3 give way to any due no later...
Definition events.c:83
void FIGHTSTG_raiseAllStatus(void)
TECH_EFFECT_RAISE_ALL_STATUS: when rollStatusRaise lets it, raises all of the partner's status values...
void FIGHTSTG_raiseEachStatus(void)
TECH_EFFECT_RAISE_EACH_STATUS: raises each of the partner's status values that rollStatusRaise lets b...
s16 FIGHTSTG_boostStats[]
the stat of BattleStats.stats that each of BattleFighter.boosts adds to
Definition boosts.c:7
void FIGHTSTG_queueEnemyTurn(s32 delay)
Queues the enemy's turn (event 3) in delay.
Definition events.c:368
s32 FIGHTSTG_rollConfusion(u8 side, s32 id)
Whether a hit confuses, like rollPoison (BATTLE_BLOCK_CONFUSION keeps the player from it)
Definition rolls.c:282
void FIGHTSTG_queueBlastEnd(s32 kind)
Queues the end of the partner's digivolution for the battle (event 19), after delay kind + 3.
Definition battle.c:98
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 ...
Definition events.c:565
void FIGHTSTG_setSpeed(s32 mode)
Sets the battle's speed mode and counts this frame again.
Definition speed.c:35
void FIGHTSTG_queuePartnerTech(s32 tech)
Queues the partner's technique tech, to run as its command.
Definition battle.c:80
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...
Definition rolls.c:72
FIGHTSTG's shared declarations: the headers it builds on, the ids its tasks register with,...
signed int s32
Definition common.h:11
signed char s8
Definition common.h:7
signed short s16
Definition common.h:9
unsigned char u8
Definition common.h:8
#define TASK_HEADER(Type)
Definition task.h:39
FIGHTSTG's models: meshes and their drawing, bones, motions, the models task and its controls,...
Task * start(void)
The mode's entry point (MODE_ENTRY_POINTS): starts its root task (update_scene.inc....
Definition start.inc.c:3
FIGHTSTG_action: the technique being carried out.
Definition battle.h:274
s32 tech
the technique
Definition battle.h:277
u8 side
the acting side, SIDE_PLAYER or SIDE_ENEMY
Definition battle.h:276
s32 drain
the HP or MP that TECH_EFFECT_DRAIN or TECH_EFFECT_DRAIN_MP takes
Definition battle.h:279
u8 effects[0x28]
by TECH_EFFECT_*: what each one does, 0 for none
Definition battle.h:283
s16 hitCount
rolled in hits
Definition battle.h:282
void(* start)(u8 side, s32 tech)
FIGHTSTG_startAction.
Definition battle.h:285
s16 hitsLanded
Definition battle.h:281
s32 damage
per hit
Definition battle.h:278
u8 hits[4]
whether each hit lands
Definition battle.h:280
s32 hitDamage[2]
TECH_EFFECT_DOUBLE_MAGIC's.
Definition battle.h:284
u8 pad[0x20]
never read or written
Definition battle.h:275
An event of the battle, as it is queued (FIGHTSTG_pushEvent)
Definition battle.h:102
s32 delay
Definition battle.h:104
s32 args[6]
Definition battle.h:105
s32 type
EVENT_END_BATTLE...
Definition battle.h:103
One of the battle's fighters, three on each side (WFIGHTMN's BattleUnit): a partner's HP and MP go ba...
Definition battle.h:191
u8 paralysis
FIGHTER_PARALYZED's strength.
Definition battle.h:205
u8 flags
FIGHTER_*.
Definition battle.h:204
s16 charge
added in 64ths to its next technique's damage, which uses it up
Definition battle.h:199
u8 temporary
id is a temporary Digimon
Definition battle.h:202
s16 item
an enemy's
Definition battle.h:201
s16 id
the Digimon (DIGIMON_DATA)
Definition battle.h:192
s16 prevId
its own id while id is a temporary one
Definition battle.h:193
s16 boosts[4]
added to the stats FIGHTSTG_boostStats picks
Definition battle.h:200
u8 sleep
FIGHTER_ASLEEP's.
Definition battle.h:206
u8 confusion
FIGHTER_CONFUSED's.
Definition battle.h:207
s16 turns
an enemy's, for its battle table's conditions
Definition battle.h:194
u8 special
the partner's special state (EVENT_SPECIAL_END): doubles its effects
Definition battle.h:203
FIGHTSTG_battleFuncs.
Definition battle.h:329
s32(* rollCounter)(s32 arg0, s32 arg1)
Definition battle.h:352
s32(* rollMagicHit)(u8 side, s32 id)
Definition battle.h:339
s32(* rollSleep)(u8 side, s32 id)
Definition battle.h:343
s32(* getHeal)(u8 side, s32 index, s32 big)
a part of its max HP
Definition battle.h:337
s32(* testWakeUp)(u8 side, s32 value)
Definition battle.h:356
void(* changeBoost)(u8 side, s32 index, s32 stat, s32 percent)
changes a fighter's stat boost
Definition battle.h:359
s32(* getTechCost)(u8 side, s32 id)
Definition battle.h:361
s32(* rollKnockOut)(u8 side, s32 id)
Definition battle.h:344
BattleStats stats[2]
the player's, then the enemy's
Definition battle.h:330
s32(* rollNoSwitch)(s32 actor, s32 id)
Definition battle.h:349
s32(* rollConfusion)(u8 side, s32 id)
Definition battle.h:342
s32(* computeCounterDamage)(u8 side, s32 id, s32 value)
Definition battle.h:335
s32(* rollNoDigivolve)(s32 actor, s32 id)
Definition battle.h:350
s32(* testParalysis)(u8 side)
whether side's paralysis costs it the turn
Definition battle.h:358
s32(* getGaugeGain)(s32 damage)
from the partner's damage, up to 1000
Definition battle.h:360
s32(* rollPoison)(u8 side, s32 id)
Definition battle.h:340
s32(* rollHit)(u8 side, s32 tech)
whether a hit lands
Definition battle.h:338
s32(* computeMagicDamage)(u8 side, s32 id)
Definition battle.h:333
s32(* testConfusion)(u8 side)
Definition battle.h:357
s32(* computeHeal)(u8 side, s32 id)
Definition battle.h:336
s32(* rollDrain)(u8 side, s32 id)
Definition battle.h:346
s32(* rollSteal)(u8 side, s32 id)
Definition battle.h:345
s32(* rollStatusRaise)(s32 actor, s32 id)
Definition battle.h:348
s32(* computeDamage)(u8 side, s32 tech)
of each hit
Definition battle.h:332
s32(* rollDedigivolve)(s32 actor, s32 id)
Definition battle.h:347
s32(* rollParalysis)(u8 side, s32 id)
Definition battle.h:341
s32(* testRunAway)(u8 side)
Definition battle.h:355
s32(* getDamage)(s32 *args)
of the event whose args these are
Definition battle.h:334
How the battle's frames go by (FIGHTSTG_setSpeed sets it)
Definition battle.h:211
s32 rest
the time mode 2 hasn't counted yet
Definition battle.h:213
s32 mode
1: stopped, 2: slowed (a frame per 4 of time), 3: double
Definition battle.h:212
What a battle starts from: WFIGHTMN_start zeroes it as one block, and FIGHTSTG_testRunAway reads runA...
Definition battle.h:225
s16 runAttempts
the player's, each of which makes running away likelier (FIGHTSTG_testRunAway)
Definition battle.h:229
s8 hitCount
BATTLE_KIND_FINAL_LAST: the partner's hits that did damage.
Definition battle.h:232
s32 active[2]
each side's fighter
Definition battle.h:226
BattleFighter fighters[2][3]
Definition battle.h:227
s16 kind
the kind of battle
Definition battle.h:230
u8 weakened
BATTLE_KIND_FINAL_LAST: the enemy is weakened (FIGHTSTG_weakenEnemy)
Definition battle.h:233
ElementBoost boost
Definition battle.h:228
s16 tech
a technique id, set by WFIGHTMN
Definition battle.h:231
A side's stats as FIGHTSTG_computeStats works them out.
Definition battle.h:305
u8 tripleHit
plain physical techniques hit 3 times for 0.4 of the damage
Definition battle.h:317
u8 weaponFamilies[3]
from the equipment, as are the ones after
Definition battle.h:313
s16 stats[5]
with the fighter's boosts
Definition battle.h:307
u8 runAwayGuard
halves the enemy's chance to run away
Definition battle.h:323
u8 runAwayBonus
to the player's chance to run away
Definition battle.h:322
u8 pad
only cleared with the rest (HEAP.zero of sizeof); BattleFuncs.stats[2] spans 0x80 bytes
Definition battle.h:325
u8 damageCut
taken off each hit
Definition battle.h:312
u8 criticalBonus
to plain techniques' critical chance, off their accuracy
Definition battle.h:318
s16 resist[12]
Definition battle.h:308
s16 level
Definition battle.h:306
u8 accuracy
Definition battle.h:320
u8 flags
the fighter's
Definition battle.h:309
u8 elementPower
Definition battle.h:315
u8 damageBonus
in 64ths: the fighter's charge
Definition battle.h:311
HitStatus statuses[5]
by HIT_*, from the weapon
Definition battle.h:316
u8 counter
answers hits with the partner's first skill
Definition battle.h:319
u8 element
the accessory's, for techniques without one
Definition battle.h:314
u8 stealBonus
Definition battle.h:324
What an enemy does: its target (FIGHTSTG_getEnemyAction) when the condition holds.
Definition battle.h:22
s16 resist[12]
Definition battle.h:65
s16 nameId
string in file 0x4F
Definition battle.h:62
s16 stats[5]
by BATTLE_STAT_*, scaled by the enemy's strength / 16
Definition battle.h:64
u8 family
FAMILY_*, the enemy's stats'.
Definition battle.h:66
BattleTableAction actions[3+1]
the first whose condition holds (FIGHTSTG_testEnemyCondition)
Definition battle.h:67
s16 itemChance
in 1024ths, less one
Definition battle.h:61
BattleTableAction counter
its counterattack (FIGHTSTG_updateCounterattack)
Definition battle.h:68
s16 item
what the enemy may leave
Definition battle.h:60
s16 techs[3]
its first, then those of FIGHTSTG_getEnemyAction's kinds 2 and 3
Definition battle.h:63
FIGHTSTG_battle: the battle.
Definition battle.h:237
void(* countFrames)(void)
Definition battle.h:242
void(* drawQuad)(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors)
Definition battle.h:245
s32 frames
since the last update
Definition battle.h:239
BattleState state
Definition battle.h:240
void(* project)(Layer *layer, SVECTOR *pos, ShortVec3 *out)
FIGHTSTG_projectPoint.
Definition battle.h:244
BattleSpeed speed
Definition battle.h:241
void(* drawBlendedQuad)(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors)
Definition battle.h:246
s32 pad
never read or written
Definition battle.h:238
void(* setSpeed)(s32 mode)
Definition battle.h:243
The battle's element boost: one element's techniques do more damage, and the ones of the element it w...
Definition battle.h:218
s16 amount
in 128ths
Definition battle.h:220
s16 element
under ELEMENT_FIRST: none
Definition battle.h:219
FIGHTSTG_startEnemyTurn's task.
Definition battle.h:72
s32 lines[10]
FIGHTSTG_updateMessage's, 0 ends them.
Definition battle.h:74
s32 switchTo
the enemy fighter it brings in (FIGHTSTG_pickEnemySwitch)
Definition battle.h:76
s32 target
-2 to -4 for an enemy, else any but the active one
Definition battle.h:75
An event kind's delay range (FIGHTSTG_eventDelays, by kind): FIGHTSTG_getEventDelay adds a random par...
Definition battle.h:155
s16 min
Definition battle.h:157
s16 div
Definition battle.h:156
s16 max
Definition battle.h:158
What FIGHTSTG_removeEvents removes the events of: an event's first two args, as FIGHTSTG_queueRecover...
Definition battle.h:117
s32 fighter
its index in the side's fighters
Definition battle.h:119
u8 side
SIDE_PLAYER or SIDE_ENEMY.
Definition battle.h:118
The event queue's functions (FIGHTSTG_events.funcs)
Definition battle.h:138
u8 statusStrength
getDelay's, for the end of a status (kinds 9 to 11)
Definition battle.h:140
void(* push)(BattleEvent *event)
Definition battle.h:141
s32(* pop)(void)
the next event due
Definition battle.h:143
s32(* first)(s32 type)
Definition battle.h:144
s32(* next)(void)
Definition battle.h:145
s32(* getDelay)(u8 side, s32 kind)
FIGHTSTG_getEventDelay: when an event of side's runs.
Definition battle.h:148
u8 result
the battle's, for WFIGHTMN (BATTLE_FLED...)
Definition battle.h:139
void(* cureStatus)(u8 side, s32 fighter, s32 item)
FIGHTSTG_cureStatus: an item's cure.
Definition battle.h:149
void(* pushFirst)(BattleEvent *event)
before all the others
Definition battle.h:142
s32(* find)(s32 type, u8 side, s32 fighter)
Definition battle.h:146
void(* remove)(EventKey *key)
the events whose first two args are its
Definition battle.h:147
The battle's events (FIGHTSTG_events)
Definition battle.h:164
EventQueueFuncs funcs
Definition battle.h:171
s8 curIndex
and where it is
Definition battle.h:168
s8 findType
what first and next look for, 1-24
Definition battle.h:169
u8 pad[0x1C]
never read or written: room for a 100th QueuedEvent, which the loops (i < 99) never reach
Definition battle.h:166
s8 curType
the type of the event popped last
Definition battle.h:167
s8 found
the event they found, or -1
Definition battle.h:170
QueuedEvent events[99]
Definition battle.h:165
A status a weapon's hits can inflict.
Definition battle.h:297
u8 chance
in 128ths
Definition battle.h:298
u8 power
Definition battle.h:299
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
Definition gfx.h:128
A queued event: its time counts down to when it runs.
Definition battle.h:109
s16 type
0 for a free entry
Definition battle.h:110
s32 args[6]
Definition battle.h:112
A position or rotation, without the SVECTOR pad.
Definition model.h:14
Any task, seen through its header.
Definition task.h:62
A turn's or a counterattack's one child, and what WFIGHTMN's battle menu waits for (NULL when it is d...
Definition task.h:16