Skip to Content
The Alchemy Project

include/battle/battle_action.h

What a battle keeps for each unit (its battle object on the field, its command and action for the turn) and the spoils it has won so far.

Included by battle_internal.h, battle_effect_internal.h, window_internal.h, battle_actor.h, battle_camera.h and battle_state.h.

Structures

NameDescription
structBATTLE_OBJECTA unit's place on the battlefield: its sprite object, resources and animations, its anchor spot and scale, and the conditions it shows.
structBATTLE_ACTION_RECORDA unit's chosen action for the turn: its command, the command's parameter, its target and range, and its priority in the turn order.
structBATTLE_SPOILSA battle's spoils so far: coins, experience, enemies defeated and up to four items.
structBATTLE_ACTIONA unit's chosen action as the party's command menus write it: the BATTLE_ACTION_RECORD, read with its fields unsigned.

Macros

NameDescription
#defineDJINN_COMMAND (element, index) (((element) << 8) | (index))COMMAND_DJINN's parameter: the Djinni's element in bits 11 to 8, its number within the element below.
#defineDJINN_COMMAND_ELEMENT (parameter) (((parameter) >> 8) & 15)
#defineDJINN_COMMAND_INDEX (parameter) ((parameter) & 255)
#definePLACE_PARTY 0x100The list place codes the target pickers return (btFindUnitPlace): a place in the party's list or the enemies', or'd with the side's tag; PLACE_PARTY alone is the party's first place, the default target.
#definePLACE_ENEMY 0x180

Enumerations

NameDescription
enumBATTLE_COMMAND { COMMAND_ATTACK, COMMAND_PSYNERGY, COMMAND_ITEM, COMMAND_DEFE … }BATTLE_ACTION_RECORD.command and BATTLE_PLAN's copy of it: what a unit does on its turn.

Description

What a battle keeps for each unit (its battle object on the field, its command and action for the turn) and the spoils it has won so far.

Macros in detail

DJINN_COMMAND

#define DJINN_COMMAND(element, index) (((element) << 8) | (index))

COMMAND_DJINN's parameter: the Djinni's element in bits 11 to 8, its number within the element below.

Referenced by mnBattleDjinnMenuRun().

Definition at line 73 of file battle_action.h.

DJINN_COMMAND_ELEMENT

#define DJINN_COMMAND_ELEMENT(parameter) (((parameter) >> 8) & 15)

Referenced by btActionOrderSort(), btActionRunBuild(), mnBattleCollectPartyCommands() and mnBattleDjinnMenuShowChangePreview().

Definition at line 74 of file battle_action.h.

DJINN_COMMAND_INDEX

#define DJINN_COMMAND_INDEX(parameter) ((parameter) & 255)

Referenced by btActionOrderSort(), btActionRunBuild(), mnBattleCollectPartyCommands(), mnBattleDjinnMenuRun() and mnBattleDjinnMenuShowChangePreview().

Definition at line 75 of file battle_action.h.

PLACE_PARTY

#define PLACE_PARTY 0x100

The list place codes the target pickers return (btFindUnitPlace): a place in the party's list or the enemies', or'd with the side's tag; PLACE_PARTY alone is the party's first place, the default target.

Referenced by btAIChooseRandomTarget(), btAIChooseTarget(), btFindUnitPlace(), mnBattleCollectPartyCommands() and mnBattleTargetRunSelection().

Definition at line 80 of file battle_action.h.

PLACE_ENEMY

#define PLACE_ENEMY 0x180

Referenced by btAIChooseRandomTarget(), btAIChooseTarget(), btFindUnitPlace(), mnBattlePartySplitChoosers() and mnBattleTargetRunSelection().

Definition at line 81 of file battle_action.h.

Enumerations in detail

BATTLE_COMMAND

enum BATTLE_COMMAND

BATTLE_ACTION_RECORD.command and BATTLE_PLAN's copy of it: what a unit does on its turn.

EnumeratorValueDescription
COMMAND_ATTACK0
COMMAND_PSYNERGY1
COMMAND_ITEM2
COMMAND_DEFEND3
COMMAND_ABILITY4An enemy's ability.
COMMAND_DJINN5
COMMAND_SUMMON6
COMMAND_TOTAL_DEFENSE7An enemy's ABILITY_EFFECT_TOTAL_DEFENSE.
COMMAND_NONE8Nothing this turn.
COMMAND_DJINN_COUNTER9The ABILITY_DJINN_COUNTER a unit strikes back with, outside the turn order (btRun queues it for BATTLE_STATE.pendingUnit).
COMMAND_DAEDALUS10Daedalus's strike again at a turn's end,
COMMAND_FLEE99queued by btRun while summons of Daedalus are owed (btStagingPlanDaedalus).

Definition at line 50 of file battle_action.h.