Alchemy
Loading...
Searching...
No Matches

plan.c File Reference

An action announced and planned, BattleCommand_BuildPlan. More...

Go to the source code of this file.

Macros

#define DJINN_ELEMENT(v)
#define DJINN_INDEX(v)
#define TARGET_MAX   14
 The most targets a plan holds (BATTLE_TARGET_CAPACITY).
#define DJINN_FIRST_ABILITY   300
 The first Djinni's ability id: each element's 20 follow, Venus first.
#define ABILITY_ANNIHILATION   178
 The ability Annihilation, which rolls its hit as it is planned.

Functions

u32 BattleParty_IsUnitListed (u32 unitId)
 Returns one when the unit is in its side's formation.
s32 BattleParty_CountStandbyDjinn (u32 unitId, u8 *counts)
 Counts the standby Djinn whose owners fight on unitId's side, from that side's Djinn recovery list.
s32 BattleCommand_BuildPlan (struct BattleActionRecord *request, struct BattlePlan *plan)
 Announces the action and plans its targets and effects.

Detailed Description

An action announced and planned, BattleCommand_BuildPlan.

Part of battle.c, the battle object, compiled only through it.

Definition in file plan.c.

Macro Definition Documentation

◆ DJINN_ELEMENT

#define DJINN_ELEMENT ( v)
Value:
(((v) >> 8) & 15)

Definition at line 85 of file plan.c.

Referenced by BattleCommand_BuildPlan(), and DjinnMenu_SelectDjinn().

◆ DJINN_INDEX

#define DJINN_INDEX ( v)
Value:
((v) & 255)

Definition at line 86 of file plan.c.

Referenced by BattleCommand_BuildPlan().

◆ TARGET_MAX

#define TARGET_MAX   14

The most targets a plan holds (BATTLE_TARGET_CAPACITY).

Definition at line 88 of file plan.c.

Referenced by BattleCommand_BuildPlan().

◆ DJINN_FIRST_ABILITY

#define DJINN_FIRST_ABILITY   300

The first Djinni's ability id: each element's 20 follow, Venus first.

Definition at line 90 of file plan.c.

Referenced by BattleCommand_BuildPlan().

◆ ABILITY_ANNIHILATION

#define ABILITY_ANNIHILATION   178

The ability Annihilation, which rolls its hit as it is planned.

Definition at line 92 of file plan.c.

Referenced by BattleCommand_BuildPlan().

Function Documentation

◆ BattleParty_IsUnitListed()

u32 BattleParty_IsUnitListed ( u32 unitId)

Returns one when the unit is in its side's formation.

Called by BattleCommand_BuildPlan, for the owners of the standby Djinn a summon uses. unitId : 0 to 7 a party member, any other an enemy

Definition at line 11 of file plan.c.

Referenced by BattleCommand_BuildPlan(), and BattleParty_IsUnitListed().

◆ BattleParty_CountStandbyDjinn()

s32 BattleParty_CountStandbyDjinn ( u32 unitId,
u8 * counts )

Counts the standby Djinn whose owners fight on unitId's side, from that side's Djinn recovery list.

Called by BattleCommand_BuildPlan for a summon, and through BattleParty_CountStandbyDjinnFar by the command menu (Menu_RunCommandRow, Battle_CollectPartyCommands, PartyStatusDraw). unitId : 0 to 7 the party's side, any other the enemies' counts : if not null, receives the count for each of the four elements

Definition at line 37 of file plan.c.

Referenced by BattleCommand_BuildPlan(), and BattleParty_CountStandbyDjinn().

◆ BattleCommand_BuildPlan()

s32 BattleCommand_BuildPlan ( struct BattleActionRecord * request,
struct BattlePlan * plan )

Announces the action and plans its targets and effects.

Returns zero to execute, -1 on failure (already reported), or -2 for no action. Called by BattlePresentation_DispatchAction for each action of the round. Fills plan (its actor, targets, hit and critical rolls, ability, element, outcome, presentation flags and failure), resets the battle events and shows the announcing message. The command's costs are paid here: a caster's PP, a Djinni set or put on standby (with its own effect), the standby Djinn a summon uses (turns -2). A unit that cannot act, or finds no target, may be set to guard (guardLevel).

The phases: the debug defeat; what stops the actor; the announcement and the ability id, by command; the rolls of a plain attack, or an ability's extra blows, critical hit or advance hit roll; then how it is staged.

Fills the plan's targets: the aimed unit, or for a range the places within range - 1 of the aimed place on its side, standing units only unless the ability revives. With none, the actor defends ("defends") and it returns -1. Called by BattleCommand_BuildPlan once the command gives its ability id.

Definition at line 108 of file plan.c.

Referenced by BattleCommand_BuildPlan(), and BattlePresentation_DispatchAction().