Skip to Content
The Alchemy Project

src/battle/battle_enemy_ai.c

An enemy's choice of action, btAIChooseAction. More…

Included by battle.c.

Macros

NameDescription
#defineAI_MAX_FAILED_CHOICES 16The choices an enemy may fail to carry out before it defends instead.

Functions

NameDescription
UNREAD_RESULTbtAIChooseAction (BATTLE_ACTION *request, Sint32 acting)Chooses an enemy's action: one of the eight in its definition, picked by its strategy, and a target worth it; if a pick fails after more than AI_MAX_FAILED_CHOICES have failed before it, the enemy defends. acting is 0 as the turn is built, when only a guard is chosen, and 1 when the enemy acts.

Description

An enemy's choice of action, btAIChooseAction. Part of battle.c.

Macros in detail

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 6 of file battle_enemy_ai.c.

Functions in detail

btAIChooseAction

UNREAD_RESULT btAIChooseAction(BATTLE_ACTION *request, Sint32 acting)

Chooses an enemy's action: one of the eight in its definition, picked by its strategy, and a target worth it; if a pick fails after more than AI_MAX_FAILED_CHOICES have failed before it, the enemy defends. acting is 0 as the turn is built, when only a guard is chosen, and 1 when the enemy acts.

References BattleAIActionWeights, btAbilityIsPsynergy(), btAIChooseRandomTarget(), btAIChooseTarget(), btFindUnitPlace(), gmAbilityGetDefinitionStub(), gmBattleRandomStub(), gmEnemyGetDefinitionStub(), gmItemGetDefinitionStub(), gmUnitGetStub() and Sint32.

Referenced by btBuildEnemyActions() and btStagingDispatchAction().

Definition at line 12 of file battle_enemy_ai.c.