A whole battle, Battle_RunEncounter, and the lists of the units in it. More...
Go to the source code of this file.
Macros | |
| #define | PARTY_STATUS_NO_SUMMONS 1 |
| BattleWork.partyStatus: how the party status window draws, with the Summon command offered or not. | |
| #define | PARTY_STATUS_SUMMONS 3 |
| #define | ENCOUNTER_PARTY_LOST -1 |
| Battle_RunEncounter's results besides the number of enemies defeated. | |
| #define | ENCOUNTER_FLED 999 |
| #define | DEFEAT_ONE 0 |
| #define | DEFEAT_SEVERAL 1 |
| #define | DEFEAT_BY_PARTY_MEMBER 3 |
| #define | LINK_OWNER_STATES_SIZE 0x7c8 |
| The size of the block a link battle copies its field state into. | |
Functions | |
| s32 | Battle_RunEncounter (s32 enemyGroup) |
| Fights the battle against the enemy formation enemyGroup, from the opening transition to the end, and returns how it ended: the number of enemies defeated when the party won (or the link broke), ENCOUNTER_FLED when the party ran, or ENCOUNTER_PARTY_LOST. | |
| s32 | BattleParty_PrepareActiveOwners (u16 *owners) |
| Lists the party members who fight (the first four of the party, three in a link battle) and marks each unit as a party member. | |
| s32 | BattleEnemyList (s16 *unitIds) |
| Lists the enemy units present, ended by BATTLE_UNIT_LIST_END, and returns how many there are (0 when unitIds is null). | |
| s32 | BattleParty_ListLivingUnits (s32 sideMask, u16 *unitIds) |
| Lists the units still standing (HP above 0) on the sides in sideMask (BATTLE_SIDE_PARTY, BATTLE_SIDE_ENEMIES or both), party first. | |
| s32 | BattleParty_ListActorIds (s32 sideMask, u16 *unitIds) |
| Lists the units in the battle's unit lists on the sides in sideMask, party first, skipping those removed from the battle. | |
A whole battle, Battle_RunEncounter, and the lists of the units in it.
Part of battle.c, the battle object, compiled only through it.
Definition in file encounter.c.
| #define PARTY_STATUS_NO_SUMMONS 1 |
BattleWork.partyStatus: how the party status window draws, with the Summon command offered or not.
Definition at line 9 of file encounter.c.
Referenced by Battle_RunEncounter().
| #define PARTY_STATUS_SUMMONS 3 |
Definition at line 10 of file encounter.c.
Referenced by Battle_RunEncounter().
| #define ENCOUNTER_PARTY_LOST -1 |
Battle_RunEncounter's results besides the number of enemies defeated.
Definition at line 13 of file encounter.c.
Referenced by Battle_RunEncounter().
| #define ENCOUNTER_FLED 999 |
Definition at line 14 of file encounter.c.
Referenced by Battle_RunEncounter().
| #define DEFEAT_ONE 0 |
Definition at line 19 of file encounter.c.
| #define DEFEAT_SEVERAL 1 |
Definition at line 20 of file encounter.c.
Referenced by Battle_RunEncounter().
| #define DEFEAT_BY_PARTY_MEMBER 3 |
Definition at line 21 of file encounter.c.
Referenced by Battle_RunEncounter().
| #define LINK_OWNER_STATES_SIZE 0x7c8 |
The size of the block a link battle copies its field state into.
Definition at line 24 of file encounter.c.
Referenced by Battle_RunEncounter().
Fights the battle against the enemy formation enemyGroup, from the opening transition to the end, and returns how it ended: the number of enemies defeated when the party won (or the link broke), ENCOUNTER_FLED when the party ran, or ENCOUNTER_PARTY_LOST.
Each round, the party's commands are chosen (or chosen automatically under FLAG_AUTO_BATTLE), every unit acts in turn order, and the round ends with the turn-end effects; the Djinn tutorial adds its two messages after each round.
Reached through its far stub from Game_ResetForNewGame's scene switch (SCENE_BATTLE, with the entrance as enemyGroup), and from DebugBattle_RunMenu. Allocates the battle's work slots (the camera, gBattleWork, the link copy, the background transition, the display and others), sets FLAG_IN_BATTLE, and on its way out resets the party's battle state, sets gGameState.battleStart back to 0 and releases heap block 10. A broken link also sets flag 0x3e8, which the link lobby reads (LinkLobby_RunRoundResult).
Definition at line 44 of file encounter.c.
Referenced by Battle_RunEncounter(), and DebugBattle_RunMenu().
Lists the party members who fight (the first four of the party, three in a link battle) and marks each unit as a party member.
owners, if not null, receives their ids ended by BATTLE_UNIT_LIST_END. Returns how many fight. Called across the battle parts whenever they need the party, and through its far stub by the party status window (party_status.c). Sets each fighting member's side to BATTLE_UNIT_PARTY.
Definition at line 371 of file encounter.c.
Referenced by Battle_RunEncounter(), BattleFormation_SelectLevelMatchedCandidate(), BattleParty_AssignMemberSlots(), BattleParty_CollectUnitList(), BattleParty_ListLivingUnits(), BattleParty_PrepareActiveOwners(), BattleParty_ReconcileDjinnRecovery(), BattleParty_ResetActiveRuntimeFields(), BattleSummon_UpdateAvailability(), BattleUnit_RefreshPlacement(), and LinkBattle_SendParty().
Lists the enemy units present, ended by BATTLE_UNIT_LIST_END, and returns how many there are (0 when unitIds is null).
A link battle looks only at the opponent's three places. Called by BattleIntro_AnnounceEncounter, BattleParty_CollectUnitList and BattleTargetExec.
Definition at line 401 of file encounter.c.
Referenced by BattleEnemyList(), BattleIntro_AnnounceEncounter(), BattleParty_CollectUnitList(), and BattleTargetExec().
Lists the units still standing (HP above 0) on the sides in sideMask (BATTLE_SIDE_PARTY, BATTLE_SIDE_ENEMIES or both), party first.
unitIds, if not null, receives them ended by BATTLE_UNIT_LIST_END. Returns how many there are. Called across the battle parts (the round, staging, auto battle, turn end and spoils) to test whether a side still stands and to pick targets.
Definition at line 437 of file encounter.c.
Referenced by Battle_AwardSpoils(), Battle_RunEncounter(), BattleEscape_CheckSuccess(), BattleEscape_PlayRun(), BattleParty_ListLivingUnits(), BattlePres_BuildOpponentEntries(), BattlePres_BuildUnitEntries(), BattlePres_RunEscape(), BattlePres_RunUnitAction(), BattlePresentation_BuildSortedUnitEntries(), BattlePresentation_RunPairedUnitTransition(), BattleTarget_ReplaceDefeated(), and BattleUnit_ProcessTurnEnd().
Lists the units in the battle's unit lists on the sides in sideMask, party first, skipping those removed from the battle.
unitIds, if not null, receives them ended by BATTLE_UNIT_LIST_END. Returns how many there are. Unlike BattleParty_ListLivingUnits, it does not test HP. Called across the battle parts that draw or target units, and through its far stub by the command windows (command_row.c, party_commands.c).
Definition at line 510 of file encounter.c.
Referenced by Battle_ProcessRoundEnd(), BattleActor_UpdateSpritePriorities(), BattleObjPut(), BattleParty_CountStandbyDjinn(), BattleParty_IsUnitListed(), BattleParty_ListActorIds(), BattleParty_ListAllUnitsAndSubmit(), BattlePres_ClearAllActorRecordModes(), BattlePres_RunEntryTransition(), BattlePres_SetActorModes(), BattlePres_SetOtherActorRecordModes(), BattlePresentation_DispatchAction(), BattlePresentation_RunUnitTransition(), and BattleUnit_ResetGuardLevels().