Skip to Content
The Alchemy Project

src/battle/battle_enemy_ai.c

Included by battle.c.

Macros

NameDescription
#defineAI_BATTLE ((BATTLE_STATE *)RamHeapSlots->battleState)The battle's state, as the forms of Poseidon and the Doom Dragon read it before btAIChooseAction sets its own battle further on.
#defineDOOM_DRAGON_POSE_LOW 6The Doom Dragon's poses for its later actions in a turn, beside POSE_CAST, a head thrust forward: one head lunging low, and one reared high (battle_doom_dragon_a.png's pictures 6 and 8, and 14 and 16).
#defineDOOM_DRAGON_POSE_HIGH 7
#defineAI_MAX_FAILED_CHOICES 16The choices an enemy may fail to carry out before it defends instead.

Functions

NameDescription
Sint32btAIChooseAction (BATTLE_ACTION_RECORD *request, Sint32 retry)Chooses an enemy's action: one of the eight in its definition, picked by its action strategy, with an item instead where its item mask says so, and a target worth the ability.

Macros in detail

AI_BATTLE

#define AI_BATTLE ((BATTLE_STATE *)RamHeapSlots->battleState)

The battle's state, as the forms of Poseidon and the Doom Dragon read it before btAIChooseAction sets its own battle further on.

Referenced by btAIChooseAction().

Definition at line 5 of file battle_enemy_ai.c.

DOOM_DRAGON_POSE_LOW

#define DOOM_DRAGON_POSE_LOW 6

The Doom Dragon's poses for its later actions in a turn, beside POSE_CAST, a head thrust forward: one head lunging low, and one reared high (battle_doom_dragon_a.png's pictures 6 and 8, and 14 and 16).

Referenced by btAIChooseAction().

Definition at line 10 of file battle_enemy_ai.c.

DOOM_DRAGON_POSE_HIGH

#define DOOM_DRAGON_POSE_HIGH 7

Referenced by btAIChooseAction().

Definition at line 11 of file battle_enemy_ai.c.

AI_MAX_FAILED_CHOICES

#define AI_MAX_FAILED_CHOICES 16

The choices an enemy may fail to carry out before it defends instead.

Referenced by btAIChooseAction().

Definition at line 14 of file battle_enemy_ai.c.

Functions in detail

btAIChooseAction

Sint32 btAIChooseAction(BATTLE_ACTION_RECORD *request, Sint32 retry)

Chooses an enemy's action: one of the eight in its definition, picked by its action strategy, with an item instead where its item mask says so, and a target worth the ability. Called with retry 0 for each enemy as the turn is built and with retry 1 when it acts (btStagingDispatchAction).

References BattleAIActionWeights, BattleAIDullahanForms, btAbilityIsPsynergy(), btAIChooseRandomTarget(), btAIChooseTarget(), btDjinnCountStandby(), btEnemyHasSpriteRoom(), btFindUnitPlace(), gmAbilityGetDefinitionStub(), gmBattleRandomStub(), gmEnemyGetDefinitionStub(), gmItemGetDefinitionStub(), gmSummonDefinitionGetNearStub(), gmSummonListLearnedStub(), gmUnitGet() and Sint32.

Referenced by btBuildEnemyActions() and btStagingDispatchAction().

Definition at line 20 of file battle_enemy_ai.c.