Skip to Content
The Alchemy Project

include/battle/battle_side.h

The two sides of a battle, their unit lists, and the Djinn each side has on standby or recovering.

Included by battle_internal.h, turn_end_tables.c, window_internal.h and character.h.

Structures

NameDescription
structBATTLE_SIDE_ORDERThe order the two sides take their turn-end effects in.
structDJINN_RECOVERY_ENTRYA Djinni on standby or recovering: its element and index, its owner, and the turns until it is set again.
structDJINN_RECOVERY_LISTOne side's Djinn recovery list: up to 72 entries and their count.
structDJINN_RECOVERY_TABLEOne side's Djinn recovery table, as gmDjinnGetRecoveryTable returns it: the party's inside MainRoutineStateWork from summonMask on, the link opponent's in the fourth enemy unit (FIRST_ENEMY_UNIT + 3), which an opponent of three never fills.

Macros

NameDescription
#defineDJINN_RECOVERY_PARTY 0The Djinn recovery list's two tables (gmDjinnGetRecoveryTableStub): the party's and the link opponent's.
#defineDJINN_RECOVERY_OPPONENT 1
#defineDJINN_RECOVERY_AFTER_BATTLE -1DJINN_RECOVERY_ENTRY.turns of a Djinni on standby.
#defineDJINN_RECOVERY_SUMMONED -2DJINN_RECOVERY_ENTRY.turns of a standby Djinni a summon has just used, until the summoner's action ends and sets its count of turns to recover.

Enumerations

NameDescription
enumBATTLE_SIDE { BATTLE_SIDE_NONE, BATTLE_SIDE_ENEMY, BATTLE_SIDE_PARTY }UNIT.side: which side a unit fights on, if it is in the battle.
enumBATTLE_UNIT_LIST_MARK { BATTLE_UNIT_REMOVED, BATTLE_UNIT_LIST_END }Marks in a list of unit ids, such as BATTLE_STATE.partyUnits and enemyIds.
enumBATTLE_SIDE_MASK { BATTLE_SIDE_MASK_PARTY, BATTLE_SIDE_MASK_ENEMIES, BATTLE_SID … }Which sides a unit list takes.

Functions

NameDescription
Sint32btEnemyList (Sint16 *unitIds)Lists the enemy units present and returns how many, 0 when unitIds is null.
Sint32btPartyAssignOpponentSlots (void)Records the unit id the link opponent knows each party member by: an enemy's, FIRST_ENEMY_UNIT on from the first member, as memberSlot - FIRST_ENEMY_UNIT comes out in the byte it is stored in.
BoolbtUnitRollCounterEarlyEnd (Sint32 unitId, Sint32 turns, Sint32 bias)Rolls whether a stat change or status with five turns or fewer left ends early, at luck * 3 - turns * 5 + bias percent, and returns 1 when it does.
BoolbtUnitCountDownAttackStage (Sint32 unitId)Counts down an Attack change and returns 1 when it ends; a lowered Attack may recover early.
BoolbtUnitCountDownDefenseStage (Sint32 unitId)Counts down a Defense change and returns 1 when it ends; a lowered Defense may recover early.
BoolbtUnitCountDownResistanceStage (Sint32 unitId)Counts down a Resistance change and returns 1 when it ends; a lowered Resistance may recover early.
BoolbtUnitCountDownDelusion (Sint32 unitId)Counts down delusion and returns 1 when it ends, early or not.
BoolbtUnitCountDownConfusion (Sint32 unitId)Counts down confusion and returns 1 when it ends, early or not.
BoolbtUnitCountDownCharm (Sint32 unitId)Counts down charm and returns 1 when it ends, early or not.
BoolbtUnitCountDownStun (Sint32 unitId)Counts down a stun and returns 1 when it ends, early or not.
BoolbtUnitCountDownSleep (Sint32 unitId)Counts down sleep and returns 1 when it ends, early or not.
BoolbtUnitCountDownPsynergySeal (Sint32 unitId)Counts down both seals in UNIT.psySeal and returns 1 when the last ends; only Bind's, once Luff's is gone, may end early.
BoolbtUnitCountDownReflect (Sint32 unitId)Counts down Reflect and returns 1 when it runs out; it never ends early.
BoolbtUnitCountDownAgilityStage (Sint32 unitId)Counts down an Agility change and returns 1 when it runs out; it never ends early.

Description

The two sides of a battle, their unit lists, and the Djinn each side has on standby or recovering.

Macros in detail

DJINN_RECOVERY_PARTY

#define DJINN_RECOVERY_PARTY 0

The Djinn recovery list's two tables (gmDjinnGetRecoveryTableStub): the party's and the link opponent's.

Referenced by btActionRunBuild(), btDebugParamSetLoad(), btDjinnCountStandby(), btDjinnRecoveryCountDown(), btLinkBattleSendParty(), btRun(), btSummonUpdateAvailability(), gmDjinnRecoveryCountStandby(), gmSummonLearn() and gmSummonListLearned().

Definition at line 41 of file battle_side.h.

DJINN_RECOVERY_OPPONENT

#define DJINN_RECOVERY_OPPONENT 1

Referenced by btActionRunBuild(), btDjinnCountStandby() and btLinkBattleReceiveParty().

Definition at line 42 of file battle_side.h.

DJINN_RECOVERY_AFTER_BATTLE

#define DJINN_RECOVERY_AFTER_BATTLE -1

DJINN_RECOVERY_ENTRY.turns of a Djinni on standby. In battle it stays so until a Djinn command sets it again or a summon uses it (DJINN_RECOVERY_SUMMONED), both in btActionRunBuild.

Referenced by btActionRunBuild(), btDjinnCountStandby(), btUnitDrainDjinn(), btUnitProcessActionEnd(), gmDjinnRecoveryAddStandby() and gmDjinnRecoveryCountStandby().

Definition at line 47 of file battle_side.h.

DJINN_RECOVERY_SUMMONED

#define DJINN_RECOVERY_SUMMONED -2

DJINN_RECOVERY_ENTRY.turns of a standby Djinni a summon has just used, until the summoner's action ends and sets its count of turns to recover.

Referenced by btActionRunBuild(), btUnitDrainDjinn() and gmDjinnCanSet().

Definition at line 51 of file battle_side.h.

Enumerations in detail

BATTLE_SIDE

enum BATTLE_SIDE

UNIT.side: which side a unit fights on, if it is in the battle.

EnumeratorValueDescription
BATTLE_SIDE_NONE0
BATTLE_SIDE_ENEMY1
BATTLE_SIDE_PARTY2

Definition at line 11 of file battle_side.h.

BATTLE_UNIT_LIST_MARK

enum BATTLE_UNIT_LIST_MARK

Marks in a list of unit ids, such as BATTLE_STATE.partyUnits and enemyIds.

EnumeratorValueDescription
BATTLE_UNIT_REMOVED254a place whose unit has left the battle
BATTLE_UNIT_LIST_END255ends the list

Definition at line 19 of file battle_side.h.

BATTLE_SIDE_MASK

enum BATTLE_SIDE_MASK

Which sides a unit list takes.

EnumeratorValueDescription
BATTLE_SIDE_MASK_PARTY1
BATTLE_SIDE_MASK_ENEMIES2
BATTLE_SIDE_MASK_BOTHBATTLE_SIDE_MASK_PARTY | BATTLE_SIDE_MASK_ENEMIES

Definition at line 26 of file battle_side.h.