Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
enemy_turn.c File Reference

FIGHTSTG's enemy turn: the enemy's pick of its action from its battle table entry, and its conditions. More...

Include dependency graph for enemy_turn.c:

Go to the source code of this file.

Functions

s32 FIGHTSTG_pickEnemySwitch (EnemyTurn *task)
 The enemy that the enemy's turn (FIGHTSTG_updateEnemyTurn) switches to: task->target's, or one of the others at random (not the active one), -1 for none.
 
static void fleeWhenWeak (EnemyTurn *task, BattleChild *children)
 In BATTLE_KIND_ESCAPE, the enemy flees once its HP is under a tenth; otherwise its turn goes on to the next state.
 
static void showRunAway (EnemyTurn *task, BattleChild *children)
 Shows the enemy's run-away event, if it has one, and clears it before its turn goes on.
 
static void useEnemyTech (EnemyTurn *task, BattleChild *children)
 Starts the enemy's attack (target 1) or technique TARGET, paying its MP, or shows the message for an enemy without the MP for it.
 
static void showEnemyName (EnemyTurn *task, BattleChild *children)
 Says the name of the enemy that came in.
 
static void switchEnemyOut (EnemyTurn *task, BattleChild *children)
 Picks the enemy to switch in (FIGHTSTG_pickEnemySwitch) and shows the switch's message, or the one for no enemy to switch in.
 
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, paralyzed or confused, or else the first action of its battle table entry whose condition holds, and what its target makes it do: attack, a technique, a switch to another enemy (FIGHTSTG_pickEnemySwitch) or a message.
 
EnemyTurn * FIGHTSTG_startEnemyTurn (void)
 Starts the enemy's turn (FIGHTSTG_updateEnemyTurn)
 
s32 FIGHTSTG_testEnemyCondition (u8 condition, s16 arg)
 Whether the condition of an enemy's action holds (BattleTableAction): always, a chance in 128, the enemy's or the partner's HP over or under a share, its MP, the partner's Digimon or flags, the other enemies, the battle and the enemy's boosts.
 
s32 FIGHTSTG_getEnemyAction (u8 kind)
 What an enemy's action target makes it do (EnemyTurn.target): 1 its first technique, its battle table entry's second or third technique, or -1 to -5 for the other actions.
 

Detailed Description

FIGHTSTG's enemy turn: the enemy's pick of its action from its battle table entry, and its conditions.

Definition in file enemy_turn.c.

Function Documentation

◆ FIGHTSTG_pickEnemySwitch()

s32 FIGHTSTG_pickEnemySwitch ( EnemyTurn *  task)

The enemy that the enemy's turn (FIGHTSTG_updateEnemyTurn) switches to: task->target's, or one of the others at random (not the active one), -1 for none.

Definition at line 9 of file enemy_turn.c.

Referenced by switchEnemyOut().

Here is the caller graph for this function:

◆ fleeWhenWeak()

static void fleeWhenWeak ( EnemyTurn *  task,
BattleChild *  children 
)
inlinestatic

In BATTLE_KIND_ESCAPE, the enemy flees once its HP is under a tenth; otherwise its turn goes on to the next state.

< the enemy runs away under a tenth of its HP

< a side ran away

Definition at line 68 of file enemy_turn.c.

Referenced by FIGHTSTG_updateEnemyTurn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showRunAway()

static void showRunAway ( EnemyTurn *  task,
BattleChild *  children 
)
inlinestatic

Shows the enemy's run-away event, if it has one, and clears it before its turn goes on.

Definition at line 89 of file enemy_turn.c.

Referenced by FIGHTSTG_updateEnemyTurn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ useEnemyTech()

static void useEnemyTech ( EnemyTurn *  task,
BattleChild *  children 
)
inlinestatic

Starts the enemy's attack (target 1) or technique TARGET, paying its MP, or shows the message for an enemy without the MP for it.

Definition at line 117 of file enemy_turn.c.

Referenced by FIGHTSTG_updateEnemyTurn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showEnemyName()

static void showEnemyName ( EnemyTurn *  task,
BattleChild *  children 
)
inlinestatic

Says the name of the enemy that came in.

Definition at line 139 of file enemy_turn.c.

Referenced by FIGHTSTG_updateEnemyTurn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ switchEnemyOut()

static void switchEnemyOut ( EnemyTurn *  task,
BattleChild *  children 
)
inlinestatic

Picks the enemy to switch in (FIGHTSTG_pickEnemySwitch) and shows the switch's message, or the one for no enemy to switch in.

Definition at line 150 of file enemy_turn.c.

Referenced by FIGHTSTG_updateEnemyTurn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIGHTSTG_updateEnemyTurn()

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, paralyzed or confused, or else the first action of its battle table entry whose condition holds, and what its target makes it do: attack, a technique, a switch to another enemy (FIGHTSTG_pickEnemySwitch) or a message.

The match depends on the goto into the confusion branch, the case -1 next to default, and the enemies pointers of showEnemyName and substate 5.

< can't act or run away; a hit may wake it up

< loses turns at random (FIGHTSTG_battleFuncs.testParalysis)

Definition at line 174 of file enemy_turn.c.

Referenced by FIGHTSTG_startEnemyTurn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIGHTSTG_startEnemyTurn()

EnemyTurn * FIGHTSTG_startEnemyTurn ( void  )

Starts the enemy's turn (FIGHTSTG_updateEnemyTurn)

WFIGHTMN passes them the battle, which they don't read; its code loads it, so no parameter list.

Definition at line 293 of file enemy_turn.c.

Referenced by WFIGHTMN_runTurn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIGHTSTG_testEnemyCondition()

s32 FIGHTSTG_testEnemyCondition ( u8  condition,
s16  arg 
)

Whether the condition of an enemy's action holds (BattleTableAction): always, a chance in 128, the enemy's or the partner's HP over or under a share, its MP, the partner's Digimon or flags, the other enemies, the battle and the enemy's boosts.

The match depends on the one fighter pointer that the cases set as they need it, on case 1 keeping its roll in the same variable as the HP share, and on case 10's own loop counter.

< can't act or run away; a hit may wake it up

Definition at line 303 of file enemy_turn.c.

Referenced by FIGHTSTG_updateCounterattack(), and FIGHTSTG_updateEnemyTurn().

Here is the caller graph for this function:

◆ FIGHTSTG_getEnemyAction()

s32 FIGHTSTG_getEnemyAction ( u8  kind)

What an enemy's action target makes it do (EnemyTurn.target): 1 its first technique, its battle table entry's second or third technique, or -1 to -5 for the other actions.

Definition at line 438 of file enemy_turn.c.

Referenced by FIGHTSTG_updateCounterattack(), and FIGHTSTG_updateEnemyTurn().

Here is the caller graph for this function: