1#ifndef FIGHTSTG_BATTLE_H
2#define FIGHTSTG_BATTLE_H
15#if VERSION_US || VERSION_JP
16#define FILE_BATTLE_TABLE 0xBE
18#define FILE_BATTLE_TABLE 0x1CF
29#define BATTLE_STAT_ATTACK 0
30#define BATTLE_STAT_DEFENSE 1
31#define BATTLE_STAT_SPIRIT 2
32#define BATTLE_STAT_WISDOM 3
33#define BATTLE_STAT_SPEED 4
37#define ELEMENT_FIRST 2
38#define ELEMENT_COUNT 7
42#define TECH_PHYSICAL 2
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
56#define BATTLE_TABLE_FALLBACK 3
81#define EVENT_END_BATTLE 1
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
89#define EVENT_STATUS_DAMAGE 9
90#define EVENT_STATUS_END 10
91#define EVENT_BOOST_END 13
92#define EVENT_RESTRICTION_END 16
94#define EVENT_BLAST_END 19
95#define EVENT_KNOCK_OUT 20
96#define EVENT_SPECIAL_END 21
97#define EVENT_DIGIDEVOLVE 22
98#define EVENT_LAST_ENEMY 23
99#define EVENT_WEAKNESS_END 24
124#define BATTLE_KIND_NORMAL 0
125#define BATTLE_KIND_ESCAPE 1
126#define BATTLE_KIND_UNK2 2
127#define BATTLE_KIND_NO_DAMAGE 3
128#define BATTLE_KIND_FINAL 4
129#define BATTLE_KIND_FINAL_SECOND 5
130#define BATTLE_KIND_FINAL_LAST 6
178#define SIDE_ENEMY 0x10
182#define FIGHTER_POISONED 1
183#define FIGHTER_PARALYZED 2
184#define FIGHTER_CONFUSED 4
185#define FIGHTER_ASLEEP 8
186#define FIGHTER_NO_SWITCH 0x10
187#define FIGHTER_NO_DIGIVOLVE 0x20
251#define TECH_EFFECT_FIRST 2
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
258#define TECH_EFFECT_MULTI_HIT 9
259#define TECH_EFFECT_ENEMY_ONLY 10
260#define TECH_EFFECT_CRITICAL 11
261#define TECH_EFFECT_STEAL 12
262#define TECH_EFFECT_NO_SWITCH 13
263#define TECH_EFFECT_NO_DIGIVOLVE 14
264#define TECH_EFFECT_LOWER_ATTACK 26
265#define TECH_EFFECT_LOWER_DEFENSE 27
266#define TECH_EFFECT_DRAIN_MP 29
267#define TECH_EFFECT_DOUBLE_MAGIC 31
268#define TECH_EFFECT_RAISE_ONE_STATUS 32
269#define TECH_EFFECT_RAISE_EACH_STATUS 33
270#define TECH_EFFECT_RAISE_ALL_STATUS 34
271#define TECH_EFFECT_END_BATTLE 35
290#define HIT_PARALYSIS 1
291#define HIT_CONFUSION 2
292#define HIT_KNOCK_OUT 3
294#define HIT_STATUS_COUNT 5
351#if VERSION_EU || VERSION_JP
386#define BATTLE_ACTION_STATE_SIZE ((u8 *)&FIGHTSTG_action.start - (u8 *)&FIGHTSTG_action)
478#if VERSION_EU || VERSION_JP
493#define ACTIVE_FIGHTER(side) (FIGHTSTG_battle.state.fighters[side] + FIGHTSTG_battle.state.active[side])
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_findNextEvent(void)
FIGHTSTG_events.funcs.next: the next queued event of the same type, or -1.
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 ...
EventDelay FIGHTSTG_eventDelays[]
the delay ranges of FIGHTSTG_getEventDelay's kinds
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...
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...
static BattleFighter * FIGHTSTG_getActiveFighter(s32 row)
Row's active fighter (FIGHTSTG_battle.state.fighters[row][active[row]]), as the row's offset in bytes...
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,...
s32 FIGHTSTG_findBattleTableIndex(s32 id)
Enemy Digimon id's index in the battle table (FILE_BATTLE_TABLE: each enemy's stats,...
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 ...
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...
void FIGHTSTG_queueAutoRecoverEnd(u8 side)
Queues the end of side's automatic recovery (item 0xBD), or pushes back the one already queued.
s32 FIGHTSTG_rollNoSwitch(s32 actor, s32 id)
Whether TECH_EFFECT_NO_SWITCH works: the technique's chance.
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,...
s32 FIGHTSTG_rollMagicHit(u8 side, s32 id)
Whether a magic hit lands: the technique's accuracy with the wisdom and level differences; the player...
void FIGHTSTG_queueClearField(s32 time)
events.c's statuses and events
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_techEvents[]
and of FIGHTSTG_startRestriction
void FIGHTSTG_tryPoison(void)
TECH_EFFECT_POISON: poisons the target when rollPoison lets it, twice as strongly when the acting fig...
void FIGHTSTG_pushEventFirst(BattleEvent *event)
FIGHTSTG_events.funcs.pushFirst: queues an event ahead of all the others, which wait its delay longer...
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.
void FIGHTSTG_countFrames(void)
How many frames the battle moves on this frame by its speed mode: as many as went by,...
void FIGHTSTG_queueBlast(void)
Queues the partner's digivolution for the battle (event 18), now.
BattleAction FIGHTSTG_action
the command being carried out
Battle FIGHTSTG_battle
Shared between the overlay's objects.
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...
s32 FIGHTSTG_testParalysis(u8 side)
FIGHTSTG_battleFuncs.testParalysis: whether side's paralysis costs it the turn, a random test of its ...
void FIGHTSTG_inflictParalysis(u8 side, s32 unused, u8 strength)
Paralyzes side's active fighter (FIGHTER_PARALYZED) with a strength, and queues its end,...
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.
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_rollSteal(u8 side, s32 id)
Whether the player steals the enemy's item: its itemChance in 1024 by the speed ratio (at most twice)...
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...
void FIGHTSTG_inflictPoison(u8 side, s32 fighter, s32 damage)
Poisons a fighter (FIGHTER_POISONED), and queues its damage or updates the one already queued.
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...
void FIGHTSTG_removeEvents(EventKey *key)
FIGHTSTG_events.funcs.remove: drops every queued event of key's side and fighter.
void FIGHTSTG_startRestriction(s32 tech)
Restricts the partner with technique tech: sets FIGHTER_NO_SWITCH or FIGHTER_NO_DIGIVOLVE by the tech...
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,...
EnemyTurn * FIGHTSTG_startEnemyTurn()
WFIGHTMN passes them the battle, which they don't read; its code loads it, so no parameter list.
u8 FIGHTSTG_statusFlags[]
and the status flags they clear
s32 FIGHTSTG_opposedElements[]
the element whose boost (FIGHTSTG_getElementBoost) weakens each one
s32 FIGHTSTG_eventPopModes[]
per event type, FIGHTSTG_popEvent takes (1), peeks at (-1) or skips (0) it
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_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...
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...
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...
s32 FIGHTSTG_rollParalysis(u8 side, s32 id)
Whether a hit paralyzes, like rollPoison (BATTLE_BLOCK_PARALYSIS keeps the player from it)
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,...
#define BATTLE_TABLE_FALLBACK
BattleTableEntry.actions' last one, which the enemy takes when none of the others' conditions holds: ...
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...
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...
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_pickEnemySwitch(EnemyTurn *task)
The enemy that the enemy's turn (FIGHTSTG_updateEnemyTurn) switches to: task->target's,...
BattleFuncs FIGHTSTG_battleFuncs
the battle's stats and the functions that compute with them
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...
void FIGHTSTG_endBattle(s32 result)
Ends the battle: queues event 1 ahead of the others, with how it ended (BATTLE_FLED,...
void FIGHTSTG_pushEvent(BattleEvent *event)
FIGHTSTG_events.funcs.push: queues an event in the first free one of the 99 slots,...
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 ...
void FIGHTSTG_queuePlayerTurn(s32 delay)
The events they queue for WFIGHTMN, and its turn's substate.
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...
void FIGHTSTG_queueRunAway(u8 side)
Queues side's attempt to run away (event 4)
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...
void FIGHTSTG_queueDigidevolve(void)
Queues the partner's digidevolution, first.
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 ...
EventQueue FIGHTSTG_events
the battle's events and their functions
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...
u8 FIGHTSTG_statusEvents[]
FIGHTSTG_cureStatus's event types.
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,...
s32 FIGHTSTG_testConfusion(u8 side)
FIGHTSTG_battleFuncs.testConfusion: a random test of side's confusion against its resists 9 and 3.
s32 FIGHTSTG_findEventFrom(s32 start)
The first queued event from slot start of the type being looked for (FIGHTSTG_events....
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.
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.
void FIGHTSTG_queueLastEnemy(void)
Queues the coming in of the last battle's third enemy, first.
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.
void FIGHTSTG_endEnemyWeakness(void)
Ends the enemy's weakness now: its queued event 24 runs next.
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...
s32 FIGHTSTG_findFirstEvent(s32 type)
FIGHTSTG_events.funcs.first: the first queued event of type, or -1.
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,...
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...
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
void FIGHTSTG_queueEnemyTurn(s32 delay)
Queues the enemy's turn (event 3) in delay.
s32 FIGHTSTG_rollConfusion(u8 side, s32 id)
Whether a hit confuses, like rollPoison (BATTLE_BLOCK_CONFUSION keeps the player from it)
void FIGHTSTG_queueBlastEnd(s32 kind)
Queues the end of the partner's digivolution for the battle (event 19), after delay kind + 3.
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 ...
void FIGHTSTG_setSpeed(s32 mode)
Sets the battle's speed mode and counts this frame again.
void FIGHTSTG_queuePartnerTech(s32 tech)
Queues the partner's technique tech, to run as its command.
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...
FIGHTSTG's shared declarations: the headers it builds on, the ids its tasks register with,...
#define TASK_HEADER(Type)
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....
FIGHTSTG_action: the technique being carried out.
u8 side
the acting side, SIDE_PLAYER or SIDE_ENEMY
s32 drain
the HP or MP that TECH_EFFECT_DRAIN or TECH_EFFECT_DRAIN_MP takes
u8 effects[0x28]
by TECH_EFFECT_*: what each one does, 0 for none
s16 hitCount
rolled in hits
void(* start)(u8 side, s32 tech)
FIGHTSTG_startAction.
u8 hits[4]
whether each hit lands
s32 hitDamage[2]
TECH_EFFECT_DOUBLE_MAGIC's.
u8 pad[0x20]
never read or written
An event of the battle, as it is queued (FIGHTSTG_pushEvent)
s32 type
EVENT_END_BATTLE...
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 charge
added in 64ths to its next technique's damage, which uses it up
u8 temporary
id is a temporary Digimon
s16 id
the Digimon (DIGIMON_DATA)
s16 prevId
its own id while id is a temporary one
s16 boosts[4]
added to the stats FIGHTSTG_boostStats picks
u8 sleep
FIGHTER_ASLEEP's.
u8 confusion
FIGHTER_CONFUSED's.
s16 turns
an enemy's, for its battle table's conditions
u8 special
the partner's special state (EVENT_SPECIAL_END): doubles its effects
s32(* rollCounter)(s32 arg0, s32 arg1)
s32(* rollMagicHit)(u8 side, s32 id)
s32(* rollSleep)(u8 side, s32 id)
s32(* getHeal)(u8 side, s32 index, s32 big)
a part of its max HP
s32(* testWakeUp)(u8 side, s32 value)
void(* changeBoost)(u8 side, s32 index, s32 stat, s32 percent)
changes a fighter's stat boost
s32(* getTechCost)(u8 side, s32 id)
s32(* rollKnockOut)(u8 side, s32 id)
BattleStats stats[2]
the player's, then the enemy's
s32(* rollNoSwitch)(s32 actor, s32 id)
s32(* rollConfusion)(u8 side, s32 id)
s32(* computeCounterDamage)(u8 side, s32 id, s32 value)
s32(* rollNoDigivolve)(s32 actor, s32 id)
s32(* testParalysis)(u8 side)
whether side's paralysis costs it the turn
s32(* getGaugeGain)(s32 damage)
from the partner's damage, up to 1000
s32(* rollPoison)(u8 side, s32 id)
s32(* rollHit)(u8 side, s32 tech)
whether a hit lands
s32(* computeMagicDamage)(u8 side, s32 id)
s32(* testConfusion)(u8 side)
s32(* computeHeal)(u8 side, s32 id)
s32(* rollDrain)(u8 side, s32 id)
s32(* rollSteal)(u8 side, s32 id)
s32(* rollStatusRaise)(s32 actor, s32 id)
s32(* computeDamage)(u8 side, s32 tech)
of each hit
s32(* rollDedigivolve)(s32 actor, s32 id)
s32(* rollParalysis)(u8 side, s32 id)
s32(* testRunAway)(u8 side)
s32(* getDamage)(s32 *args)
of the event whose args these are
How the battle's frames go by (FIGHTSTG_setSpeed sets it)
s32 rest
the time mode 2 hasn't counted yet
s32 mode
1: stopped, 2: slowed (a frame per 4 of time), 3: double
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)
s8 hitCount
BATTLE_KIND_FINAL_LAST: the partner's hits that did damage.
s32 active[2]
each side's fighter
BattleFighter fighters[2][3]
s16 kind
the kind of battle
u8 weakened
BATTLE_KIND_FINAL_LAST: the enemy is weakened (FIGHTSTG_weakenEnemy)
s16 tech
a technique id, set by WFIGHTMN
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 runAwayGuard
halves the enemy's chance to run away
u8 runAwayBonus
to the player's chance to run away
u8 pad
only cleared with the rest (HEAP.zero of sizeof); BattleFuncs.stats[2] spans 0x80 bytes
u8 damageCut
taken off each hit
u8 criticalBonus
to plain techniques' critical chance, off their accuracy
u8 damageBonus
in 64ths: the fighter's charge
HitStatus statuses[5]
by HIT_*, from the weapon
u8 counter
answers hits with the partner's first skill
u8 element
the accessory's, for techniques without one
What an enemy does: its target (FIGHTSTG_getEnemyAction) when the condition holds.
s16 nameId
string in file 0x4F
s16 stats[5]
by BATTLE_STAT_*, scaled by the enemy's strength / 16
u8 family
FAMILY_*, the enemy's stats'.
BattleTableAction actions[3+1]
the first whose condition holds (FIGHTSTG_testEnemyCondition)
s16 itemChance
in 1024ths, less one
BattleTableAction counter
its counterattack (FIGHTSTG_updateCounterattack)
s16 item
what the enemy may leave
s16 techs[3]
its first, then those of FIGHTSTG_getEnemyAction's kinds 2 and 3
FIGHTSTG_battle: the battle.
void(* countFrames)(void)
void(* drawQuad)(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors)
s32 frames
since the last update
void(* project)(Layer *layer, SVECTOR *pos, ShortVec3 *out)
FIGHTSTG_projectPoint.
void(* drawBlendedQuad)(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors)
s32 pad
never read or written
void(* setSpeed)(s32 mode)
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
FIGHTSTG_startEnemyTurn's task.
s32 lines[10]
FIGHTSTG_updateMessage's, 0 ends them.
s32 switchTo
the enemy fighter it brings in (FIGHTSTG_pickEnemySwitch)
s32 target
-2 to -4 for an enemy, else any but the active one
An event kind's delay range (FIGHTSTG_eventDelays, by kind): FIGHTSTG_getEventDelay adds a random par...
What FIGHTSTG_removeEvents removes the events of: an event's first two args, as FIGHTSTG_queueRecover...
s32 fighter
its index in the side's fighters
u8 side
SIDE_PLAYER or SIDE_ENEMY.
The event queue's functions (FIGHTSTG_events.funcs)
u8 statusStrength
getDelay's, for the end of a status (kinds 9 to 11)
void(* push)(BattleEvent *event)
s32(* pop)(void)
the next event due
s32(* getDelay)(u8 side, s32 kind)
FIGHTSTG_getEventDelay: when an event of side's runs.
u8 result
the battle's, for WFIGHTMN (BATTLE_FLED...)
void(* cureStatus)(u8 side, s32 fighter, s32 item)
FIGHTSTG_cureStatus: an item's cure.
void(* pushFirst)(BattleEvent *event)
before all the others
s32(* find)(s32 type, u8 side, s32 fighter)
void(* remove)(EventKey *key)
the events whose first two args are its
The battle's events (FIGHTSTG_events)
s8 curIndex
and where it is
s8 findType
what first and next look for, 1-24
u8 pad[0x1C]
never read or written: room for a 100th QueuedEvent, which the loops (i < 99) never reach
s8 curType
the type of the event popped last
s8 found
the event they found, or -1
A status a weapon's hits can inflict.
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
A queued event: its time counts down to when it runs.
s16 type
0 for a free entry
A position or rotation, without the SVECTOR pad.
Any task, seen through its header.
A turn's or a counterattack's one child, and what WFIGHTMN's battle menu waits for (NULL when it is d...