Alchemy

party_commands.c

Collecting the party's battle commands.

games/tbs/src/window/battle_command/party_commands.c on GitHub

Collecting the party's battle commands. Part of battle_command.c, the menu object, compiled only through it.

Functions

Battle_ClassifyEntryKind

s32 Battle_ClassifyEntryKind(const struct BattleAct *act)

Classifies ability act for the target selection (the kind of BattleTarget_RunSelection), which shows what it would do on a party member and, for kinds 3 to 6, starts on one who needs it: 0 none of these, 1 heals HP, 2 restores PP, 3 cures poison (ABILITY_EFFECT_CURE_POISON), 4 cures what Restore cures (ABILITY_EFFECT_RESTORE), 5 revives (Battle_IsReviveEffectFar), 6 cures every ailment (ABILITY_EFFECT_CURE_ALL). A later test wins: an effect over the kind, revival over all.

Used by Battle_CollectPartyCommands.

Line 15

Battle_CollectPartyCommands

s32 Battle_CollectPartyCommands(struct BattleActionRecord *commands, u16 *actors, s32 commandCount)

Collects the party's commands for a round into commands, one for each of the commandCount units in actors (a member with two actions is listed twice), and returns how many it wrote: commandCount, 1 when the party flees (CMD_FLEE for the first actor), or -1 when the link fails. Each record gets its command (CMD_), parameter (the ability, the summon, the Djinni entry or the inventory place), target (BattleTarget_RunSelection's code), range and priority: the unit's Agility plus up to a sixteenth more at random, halved for its second action in a row. Attack keeps the parameter, and Defend the parameter and target, that the command chosen before it left (0 and 256 at first).

It runs the party's row (Fight, Flee, Status), then each member's row and the menus its command opens; B in a menu goes back a step, B on a member's row to the member before, and from the first back to the party's row. In a link battle both consoles first wait for each other ("VSST" in the link signature), publish "EDVS" when done, and wait for the partner to finish ("Waiting for opponent's input."). Its work, BattleMenuWork (gLinkCountdownWork), lives in heap slot 57 until it returns. BattlePres_BuildUnitEntries calls it (battle/battle/round.c).

Line 59

On this page