Skip to Content
The Alchemy Project

src/battle

Guide: Battle Engine

Files

FileDescription
ability_staging.cHow each ability is staged in battle: the outcome staging btActionRunBuild gives it and the effect it plays, by ability id, and the effect chance it rolls ahead.
action_weights.cThe enemies' action weights.
battle.cThe battle object: a battle from its opening transition to its spoils.
battle_ability.cApplying an ability to each of its targets: damage, healing, statuses, stat changes, Djinn and special effects.
battle_action.cAn action announced and built for its targets, btActionRunBuild, with whether a unit is in its side's list and how many Djinn a side has on standby.
battle_auto_battle.cAuto battle: the actions it builds and plays without the command menu, the shoulder-key camera and the escape.
battle_background.cThe battle background, its palette and modes, the camera's zoom and the units' highlights.
battle_debug.cDebug: the unit snapshot, the parameter sets and the battle test menu.
battle_element_glow.cA unit's element glow: the star field of a cast, the streaks, the pillar and the burst, and restoring the background palette.
battle_enemy_ai.c
battle_formation.cEnemy formations: choosing, levelling and building a formation's enemies and assigning their name suffixes.
battle_internal.hWhat every part of the battle object shares: its includes, in their original order, and the names two or more parts use.
battle_link.cLink battles: the parties and Djinn exchanged, and the turn handshake.
battle_motion.cThe units' movements: returning to their spots, running and leaping, and their positions on the screen.
battle_objects.cEach tick's sprite priorities, the status icons, the poses and the sprites of the battle objects, and the camera they are projected through.
battle_placement.cBattle objects made and placed on the battlefield.
battle_playback.cBattle playback: starting it, scheduling its phases, resetting it and waiting until it is ready.
battle_playback_queue.cThe battle playback queue: clearing statuses, waiting for the player to advance messages, and queuing and running playback events.
battle_run.cA battle from its setup to its end (btRun), the party's reserves stepping in for the fallen, the Doom Dragon's change of form, and the lists of the units that fight.
battle_setup.cThe battle camera each tick, the opening announcement, the unit lists, the tile pattern, and the party's battle state and Djinn as a battle starts.
battle_spoils.cThe spoils: coins, experience, items and level ups.
battle_sprite.cEach enemy's battle sprite, palette, size, attack effect, hop, impact, defeat sound and effect height getters.
battle_sprite_slots.cBattle sprites: every unit's sprite placed, enemy sprite slots and the party's weapon sprites.
battle_sprites.cThe battle sprite rows, by unit id: the eight characters', then the enemies'.
battle_staging.cPlaying one action of a turn: the staging its ability calls for (an attack, a cast, a summon over a faded field, an item, a flight), the extra strikes that Daedalus, Megaera and Iris add, and a unit's motion graphics.
battle_tables.cThe battle's small tables: where a formation's enemies stand, the party's weapon sprites, the camera's command matrix, how an ability weakens with distance, and the forms Dullahan takes.
battle_targeting.cHow an enemy, or a confused unit, picks whom to aim at: a random living target, the strongest ally, or one its ability would affect, the enemies with a strategy favouring those with the most HP.
battle_transition.cHow the screen goes into a battle: the mosaic fade to black, then the curtain that opens from the middle of the screen as the camera swings round to the party, or the Doom Dragon's shattering opening; and the zoomed background's maps and HBlank scroll they show.
battle_turn.cA turn's actions: the party's commands, the enemies' or the link opponent's, and their action order.
battle_turn_end.cThe end of a turn and of each action: the Djinn recovering and set again, each unit's regeneration, stat changes and statuses counted down with a message for each that ends, the Djinn an enemy drains, and what follows a unit's own action (its summon's power boost, the haunt, poison and the Grim Reaper).
battle_unit_tables.cWhat every battle unit starts with: its actor script, and the kind of weapon each item is.
color_scale_kernel.cThe BGR555 palette scaling kernel, compiled as ARM code: btColorBufferScale (color_scale.s) copies it to the stack and runs it there, entered in Thumb through ColorBufferScaleKernelCode.
debug_parameter_sets.cThe debug parameter sets: runs of party members, each run ended by DEBUG_PARAMETER_SET_END, that btDebugParamSetLoad gives the party when the man hidden below the Battle lobby is given the run's number.
element_glow_tables.cWhere the element glow's sparks and rings sit on their sprite sheet.
formations.cThe 660 enemy formations, by formation id, each run of them headed by the battle or place it is for, and the enemies a Battle Arena monster battle never picks.
highlight_tables.cThe highlighted units' lightening.
knockback_tables.cHow far, how fast and how high each knockback sends a unit, by variant (BATTLE_KNOCKBACK).
scripted_battle_units.cThe units Karst and Agatio's battle carries over between its parts.
turn_end_tables.cThe order the two sides take their turn-end effects in, and two tables after it that no code names.
unused_portrait_pairs.cUnused: a copy of the speakers' portrait maps, linked among the battle code and read by nothing.

On this page