Skip to Content
The Alchemy Project

struct BATTLE_STATE

The battle's own state: its enemies, units and their objects, the turn's actions, the background palette and the events.

Declared in battle_state.h.

Fields

NameDescription
Sint32formationThe encounter's enemy formation.
Sint16spriteSlots [6]The unit in each enemy sprite slot, 0 when free.
Uint16enemyKinds [5]The kinds of enemy in the formation, for the letters that tell two of a kind apart: five at most, where The Broken Seal keeps six.
Uint16kindsEndRead only by the defeat search, as a sixth kind.
Uint32nameLetterMasks [6]For each kind, the name letters already given.
Sint8lastNameLetter [6]For each kind, the last name letter given.
Uint8unusedAfterNameLetters [2]No code names it.
Uint16firstDefeatedThe earliest kind in enemyKinds that fell, which the victory message names; ENEMY_BATTLE_SIZE until one falls.
Uint16defeatStateDEFEAT_ONE, DEFEAT_SEVERAL or DEFEAT_BY_PARTY_MEMBER.
Uint8enemyKindCountKinds of enemy listed, at most 5.
Uint8partyStatusHow the party status window draws.
Uint8layoutThe formation's layout: 0 or 1 lists the enemies in the order they were drawn.
Uint8challengeFlagbits: 1 a party unit was challenged
Uint8isLink1 in a link battle.
Uint8firstStrikeWho strikes first: 1 the party, 2 the enemies.
Uint8fleeFailuresFailed tries to flee this battle; each adds 2000 to the chance (btFleeCheckSuccess).
Uint8ceaseFireSet by Lull with MsgAllResting, "Everybody is resting!".
Uint8opponentSlots [8]For each party unit, its slot as a link opponent's enemy, minus 128; OPPONENT_SLOT_NONE for none.
Uint8linkSideThis console's multiplayer id.
Uint8linkMissesTicks the link has been down.
Uint8linkPausedSet when the link drops.
Uint8paddingAfterLinkUp to the word arrowTiles starts on.
Sint32arrowTilesResource entry of the advance arrow's tiles; -1 for none.
Sint16partyUnits [7]Ends with BATTLE_UNIT_LIST_END.
Sint16enemyIds [7]Ends with BATTLE_UNIT_LIST_END.
Uint8placement [16]Each unit's index in slots,
BATTLE_OBJECTslots [14]party ids 0 to 7 then the enemies; 255 for none (BATTLE_OBJECT_NONE).
BATTLE_ACTION_RECORDactions [BATTLE_ACTION_CAPACITY]The actions chosen for the turn.
Uint8unusedAfterActions [292]No code names it.
BATTLE_SPOILSspoilsWhat the battle has won so far.
Uint16palette [BATTLE_BACKGROUND_COLORS]The backdrop's colours, before scaling.
FIXEDbrightnessThe backdrop's brightness, 16.16, toFIXED(1) full.
Uint16bgThe battle background's id (its first halfword is the battle background passed to the palette fade).
Uint8unusedAfterBg [4]No code names it.
Uint16highlightStepStepped each tick while the units are highlighted.
Uint16highlightModeNonzero while the units are highlighted.
Uint8paddingAfterHighlight [2]Up to the word plan starts on.
BATTLE_PLANplanThe action being carried out, as btActionRunBuild lays it out.
Sint32skipPlaybackNonzero leaves the
BATTLE_PLAYBACK_STATEeventsaction's events unplayed.
Sint32debugValueA value btAdjustDebugValue edits with the d-pad while Start is held.
Sint32counterUnitIdThe unit ready to
Sint32counterTargetIdcounterattack (ABILITY_EFFECT_COUNTER) that was just struck, and the opponent that struck it.
Uint16daedalusFromEnemiesDaedalus strikes again at the end of the turns after it is summoned: each queued strike is a bit, set when an enemy summoned it, and the next turn's queue is gathered while this one's is played.
Uint16nextDaedalusFromEnemies
Uint8daedalusStrikes
Uint8nextDaedalusStrikes
Uint8keepObjectPrioritiesNonzero leaves the battle objects' sprite priorities as they are, while Flora's effect plays.
Uint8keepBackdropPaletteNonzero keeps the backdrop's palette while a summon (Charon, Atalanta, Neptune, Moloch) colours the screen.
Uint8forceFieldPoseidon's force field: 1 when the formation's last enemy is one of ENEMY_POSEIDON to ENEMY_POSEIDON_3, outside FLAG_MONSTER_BATTLE; until the Trident lands, MsgFieldProtects turns abilities away.
Uint8actingAnimationThe animation the acting unit takes as it calls up its Psynergy; 3 as its action starts.
Uint8paddingAfterActingAnimation [2]Up to the word aiStates starts on.
BATTLE_AI_STATEaiStates [4]The action choice's memory for the enemies that act more than once a turn.

Description

The battle's own state: its enemies, units and their objects, the turn's actions, the background palette and the events.

struct BATTLE_STATE

Referenced by btAbilityApplyToTarget(), btActionRunBuild(), btAdjustDebugValue(), btAIChooseAction(), btAIChooseRandomTarget(), btAIChooseTarget(), btAppendLinkedActions(), btBackgroundLoad(), btBackgroundSetMode(), btBackgroundSetPaletteLevel(), btBackgroundStepHighlightBlend(), btBuildEnemyActions(), btChangeEnemyForm(), btEffectDarkenBackgroundStep(), btEffectDimBackgroundStep(), btEffectEndCanvasLayer(), btEffectHideBg1AndRestoreBackdrop(), btEffectOpenCanvasLayer(), btEffectRunAzul(), btEffectRunBackgroundFadeIn(), btEffectRunBackstab(), btEffectRunCanvasBurst(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunCruelRuin(), btEffectRunDaedalus(), btEffectRunEclipse(), btEffectRunGeode(), btEffectRunHaures(), btEffectRunIris(), btEffectRunShatteringOpening(), btEffectRunUlysses(), btEffectRunZagan(), btEffectSetupBlendedDisplay(), btEffectSetupCanvasTileMap(), btEffectStartCanvasLayer(), btEffectStartElementStreaks(), btElementGlowPlay(), btEnemyClaimNameLetter(), btEnemyHasSpriteRoom(), btEnemyRecordDefeat(), btEnemyReleaseNameLetter(), btEnemySpriteLoadIntoSlots(), btFindUnitPlace(), btFleeCheckSuccess(), btFormationBuildEnemyList(), btGatherActions(), btGetUnitAtPlace(), btHighlightSetModes(), btIntroAnnounceEncounter() and 38 more.

Definition at line 81 of file battle_state.h.

Fields in detail

formation

Sint32 formation

The encounter's enemy formation.

spriteSlots

Sint16 spriteSlots[6]

The unit in each enemy sprite slot, 0 when free.

enemyKinds

Uint16 enemyKinds[5]

The kinds of enemy in the formation, for the letters that tell two of a kind apart: five at most, where The Broken Seal keeps six.

kindsEnd

Uint16 kindsEnd

Read only by the defeat search, as a sixth kind.

nameLetterMasks

Uint32 nameLetterMasks[6]

For each kind, the name letters already given.

lastNameLetter

Sint8 lastNameLetter[6]

For each kind, the last name letter given.

unusedAfterNameLetters

Uint8 unusedAfterNameLetters[2]

No code names it.

firstDefeated

Uint16 firstDefeated

The earliest kind in enemyKinds that fell, which the victory message names; ENEMY_BATTLE_SIZE until one falls.

defeatState

Uint16 defeatState

DEFEAT_ONE, DEFEAT_SEVERAL or DEFEAT_BY_PARTY_MEMBER.

enemyKindCount

Uint8 enemyKindCount

Kinds of enemy listed, at most 5.

partyStatus

Uint8 partyStatus

How the party status window draws.

layout

Uint8 layout

The formation's layout: 0 or 1 lists the enemies in the order they were drawn.

challengeFlag

Uint8 challengeFlag

bits: 1 a party unit was challenged

Uint8 isLink

1 in a link battle.

firstStrike

Uint8 firstStrike

Who strikes first: 1 the party, 2 the enemies.

fleeFailures

Uint8 fleeFailures

Failed tries to flee this battle; each adds 2000 to the chance (btFleeCheckSuccess).

ceaseFire

Uint8 ceaseFire

Set by Lull with MsgAllResting, "Everybody is resting!".

opponentSlots

Uint8 opponentSlots[8]

For each party unit, its slot as a link opponent's enemy, minus 128; OPPONENT_SLOT_NONE for none.

linkSide

Uint8 linkSide

This console's multiplayer id.

linkMisses

Uint8 linkMisses

Ticks the link has been down.

linkPaused

Uint8 linkPaused

Set when the link drops.

Uint8 paddingAfterLink

Up to the word arrowTiles starts on.

arrowTiles

Sint32 arrowTiles

Resource entry of the advance arrow's tiles; -1 for none.

partyUnits

Sint16 partyUnits[7]

Ends with BATTLE_UNIT_LIST_END.

enemyIds

Sint16 enemyIds[7]

Ends with BATTLE_UNIT_LIST_END.

placement

Uint8 placement[16]

Each unit's index in slots,

slots

BATTLE_OBJECT slots[14]

party ids 0 to 7 then the enemies; 255 for none (BATTLE_OBJECT_NONE).

actions

BATTLE_ACTION_RECORD actions[BATTLE_ACTION_CAPACITY]

The actions chosen for the turn.

unusedAfterActions

Uint8 unusedAfterActions[292]

No code names it.

spoils

BATTLE_SPOILS spoils

What the battle has won so far.

palette

Uint16 palette[BATTLE_BACKGROUND_COLORS]

The backdrop's colours, before scaling.

brightness

FIXED brightness

The backdrop's brightness, 16.16, toFIXED(1) full.

bg

Uint16 bg

The battle background's id (its first halfword is the battle background passed to the palette fade).

unusedAfterBg

Uint8 unusedAfterBg[4]

No code names it.

highlightStep

Uint16 highlightStep

Stepped each tick while the units are highlighted.

highlightMode

Uint16 highlightMode

Nonzero while the units are highlighted.

paddingAfterHighlight

Uint8 paddingAfterHighlight[2]

Up to the word plan starts on.

plan

BATTLE_PLAN plan

The action being carried out, as btActionRunBuild lays it out.

skipPlayback

Sint32 skipPlayback

Nonzero leaves the

events

BATTLE_PLAYBACK_STATE events

action's events unplayed.

debugValue

Sint32 debugValue

A value btAdjustDebugValue edits with the d-pad while Start is held.

counterUnitId

Sint32 counterUnitId

The unit ready to

counterTargetId

Sint32 counterTargetId

counterattack (ABILITY_EFFECT_COUNTER) that was just struck, and the opponent that struck it.

daedalusFromEnemies

Uint16 daedalusFromEnemies

Daedalus strikes again at the end of the turns after it is summoned: each queued strike is a bit, set when an enemy summoned it, and the next turn's queue is gathered while this one's is played.

nextDaedalusFromEnemies

Uint16 nextDaedalusFromEnemies

daedalusStrikes

Uint8 daedalusStrikes

nextDaedalusStrikes

Uint8 nextDaedalusStrikes

keepObjectPriorities

Uint8 keepObjectPriorities

Nonzero leaves the battle objects' sprite priorities as they are, while Flora's effect plays.

keepBackdropPalette

Uint8 keepBackdropPalette

Nonzero keeps the backdrop's palette while a summon (Charon, Atalanta, Neptune, Moloch) colours the screen.

forceField

Uint8 forceField

Poseidon's force field: 1 when the formation's last enemy is one of ENEMY_POSEIDON to ENEMY_POSEIDON_3, outside FLAG_MONSTER_BATTLE; until the Trident lands, MsgFieldProtects turns abilities away.

actingAnimation

Uint8 actingAnimation

The animation the acting unit takes as it calls up its Psynergy; 3 as its action starts.

paddingAfterActingAnimation

Uint8 paddingAfterActingAnimation[2]

Up to the word aiStates starts on.

aiStates

BATTLE_AI_STATE aiStates[4]

The action choice's memory for the enemies that act more than once a turn.