src/battle/battle_auto_battle.c
Auto battle: the actions it builds and plays without the command menu, the shoulder-key camera and the escape. More…
Included by battle.c.
Macros
| Name | Description | |
|---|---|---|
#define | TARGET_SIDE_DEFEATED 256 | btAbilityReplaceDefeated's result when the target's side is all down, which the battle's end comes before. |
Functions
| Name | Description | |
|---|---|---|
Sint32 | btAutoBattleBuildActions (BATTLE_ACTION_RECORD *entries) | Auto battle: gives every living unit a plain attack and sorts them into action order. |
void | btCameraAdjustByShoulderKeys (void) | Unused: turns the battle camera while L or R is held, a 128th of a turn each tick, and redraws the zoomed background unless a background holds it. |
Sint32 | btAutoBattleRunAction (BATTLE_ACTION_RECORD *action) | Auto battle: plays one action, a defeated target replaced by a living unit of its side. |
Sint32 | btObjectIsValidId (Uint32 unitId) | Returns 0 for a party member's or an enemy's unit id, -1 for any other. |
Bool | btFleePlayRun (BATTLE_ACTION_RECORD *action) | Auto battle: the party tries to run, and gets away 15 times in 16. |
Sint32 | btAutoBattleShowDefend (Sint16 *action) | Auto battle: shows that a standing unit is defending, "<unit> is defending!". |
Sint32 | btAutoBattleRunPsynergy (BATTLE_ACTION_RECORD *action) | Auto battle: casts Psynergy, the caster's side fading out while its effect plays on the target side. |
Sint32 | btAutoBattleRunApproachAttack (BATTLE_ACTION_RECORD *action) | Unused auto battle attack: "<unit> attacks!", the attacker leaps up to its target, the blow, and both return. |
Sint32 | btAutoBattleRunAttackOrItem (BATTLE_ACTION_RECORD *action) | Auto battle: an attack or an item, played on the first living unit of the target's side as each element's pillar in turn. |
void | btAutoBattleApplyDamage (Uint32 unitId, Sint32 damage, Sint32 showMsg, Uint8 *context) | Unused auto battle damage: takes damage HP from a unit and shows it, with "A bitter blow!" or "A critical hit!" first when showMsg is set. |
void | btMotionPlayFall (Sint32 unitId) | Unused, as its one caller, btAutoBattleApplyDamage, is: for a unit whose HP has run out, plays its falling effect to the last tick and marks its battle object for release (btObjectMarkForRelease). |
Sint32 | btAbilityReplaceDefeated (const BATTLE_ACTION_RECORD *action) | Returns the action's target, or a random living unit of its side when the target is down; TARGET_SIDE_DEFEATED when none is left. |
Description
Auto battle: the actions it builds and plays without the command menu, the
shoulder-key camera and the escape. Part of battle.c.
Macros in detail
TARGET_SIDE_DEFEATED
#define TARGET_SIDE_DEFEATED 256
btAbilityReplaceDefeated's result when the target's side is all down, which
the battle's end comes before.
Referenced by btAbilityReplaceDefeated().
Definition at line 576 of file battle_auto_battle.c.
Functions in detail
btAutoBattleBuildActions
Sint32 btAutoBattleBuildActions(BATTLE_ACTION_RECORD *entries)
Auto battle: gives every living unit a plain attack and sorts them into action order. Returns how many actions there are.
References btUnitListLiving(), gmUnitGet(), Sint32, syDMAXCopy() and syRandom().
Referenced by btRun().
Definition at line 6 of file battle_auto_battle.c.
btCameraAdjustByShoulderKeys
void btCameraAdjustByShoulderKeys(void)
Unused: turns the battle camera while L or R is held, a 128th of a turn each tick, and redraws the zoomed background unless a background holds it.
References btCameraSetRange() and PerWork.
Definition at line 86 of file battle_auto_battle.c.
btAutoBattleRunAction
Sint32 btAutoBattleRunAction(BATTLE_ACTION_RECORD *action)
Auto battle: plays one action, a defeated target replaced by a living unit of its side. Returns 1 when the party got away, -1 when the unit is down.
References btAbilityReplaceDefeated(), btAutoBattleRunAttackOrItem(), btAutoBattleRunPsynergy(), btAutoBattleShowDefend(), btFleePlayRun(), gmUnitGet(), mnBattleMessageShowAndWaitStub(), mnMessageArgumentClearAllStub(), mnMessageResetIdleStub(), Sint32 and sySynch().
Referenced by btRun().
Definition at line 107 of file battle_auto_battle.c.
btObjectIsValidId
Sint32 btObjectIsValidId(Uint32 unitId)
Returns 0 for a party member's or an enemy's unit id, -1 for any other.
References Sint32.
Referenced by btAutoBattleRunApproachAttack(), btAutoBattleRunAttackOrItem(), btAutoBattleRunPsynergy() and btAutoBattleShowDefend().
Definition at line 163 of file battle_auto_battle.c.
btFleePlayRun
Bool btFleePlayRun(BATTLE_ACTION_RECORD *action)
Auto battle: the party tries to run, and gets away 15 times in 16. Returns 1 when it got away.
References btMotionSetupEscapeObject(), btUnitListLiving(), mnBattleMessageShowAndWaitStub(), Sint32 and sySynch().
Referenced by btAutoBattleRunAction().
Definition at line 178 of file battle_auto_battle.c.
btAutoBattleShowDefend
Sint32 btAutoBattleShowDefend(Sint16 *action)
Auto battle: shows that a standing unit is defending, "<unit> is defending!".
action is the action record, read for its unit id. Returns -1 for an
invalid unit id, 0 otherwise.
References btObjectIsValidId(), gmUnitGet(), mnBattleMessageShowAndWaitStub(), mnMessageArgumentClearAllStub(), mnMessageArgumentPushStub(), result and Sint32.
Referenced by btAutoBattleRunAction().
Definition at line 204 of file battle_auto_battle.c.
btAutoBattleRunPsynergy
Sint32 btAutoBattleRunPsynergy(BATTLE_ACTION_RECORD *action)
Auto battle: casts Psynergy, the caster's side fading out while its effect plays on the target side. Returns -1 for an invalid unit or target.
References btActorSpawnObjectsForList(), btCameraSetView(), btEffectRunSummonStub(), btHighlightSetSpriteMode(), btObjectGet(), btObjectIsValidId(), btObjectPut(), btUnitListLiving(), fdActorSelectAnimationStub(), gmUnitGet(), mnPartyStatusDrawStub(), Sint32, syRandom() and sySynch().
Referenced by btAutoBattleRunAction().
Definition at line 229 of file battle_auto_battle.c.
btAutoBattleRunApproachAttack
Sint32 btAutoBattleRunApproachAttack(BATTLE_ACTION_RECORD *action)
Unused auto battle attack: "<unit> attacks!", the attacker leaps up to its target, the blow, and both return. Returns -1 when either id is not a battle object.
References btEffectRunByIdRangeStub(), btMotionApproachTarget(), btMotionReturnToSpot(), btObjectGet(), btObjectIsValidId(), fdActorSetAnimationSpeedStub(), gmUnitGet(), mnBattleMessageShowAndWaitStub(), mnMessageArgumentPushStub(), Sint32, syRandom() and sySynch().
Definition at line 349 of file battle_auto_battle.c.
btAutoBattleRunAttackOrItem
Sint32 btAutoBattleRunAttackOrItem(BATTLE_ACTION_RECORD *action)
Auto battle: an attack or an item, played on the first living unit of the target's side as each element's pillar in turn. Returns -1 for an invalid unit.
References btEffectRunElementPillarStub(), btMotionReturnToSpot(), btObjectGet(), btObjectIsValidId(), btUnitListLiving(), fdActorSelectAnimationStub(), fdActorSetAnimationSpeedStub(), mnPartyStatusDrawStub(), Sint32 and sySynch().
Referenced by btAutoBattleRunAction().
Definition at line 402 of file battle_auto_battle.c.
btAutoBattleApplyDamage
void btAutoBattleApplyDamage(Uint32 unitId, Sint32 damage, Sint32 showMsg, Uint8 *context)
Unused auto battle damage: takes damage HP from a unit and shows it, with "A bitter blow!" or "A critical hit!" first when showMsg is set.
References btMotionPlayFall(), btObjectGet(), fdActorSelectAnimationStub(), gmUnitGet(), mnBattleMessageShowAndWaitStub(), mnMessageArgumentClearAllStub(), mnMessageArgumentPushStub(), mnPartyStatusDrawStub() and Sint32.
Definition at line 488 of file battle_auto_battle.c.
btMotionPlayFall
void btMotionPlayFall(Sint32 unitId)
Unused, as its one caller, btAutoBattleApplyDamage, is: for a unit whose HP
has run out, plays its falling effect to the last tick and marks its battle
object for release (btObjectMarkForRelease).
References btObjectGet(), btObjectMarkForRelease(), fdSpriteDissolveRunStub(), fdSpriteStartAnimationStub(), gmUnitGet(), Sint32 and sySynch().
Referenced by btAutoBattleApplyDamage().
Definition at line 556 of file battle_auto_battle.c.
btAbilityReplaceDefeated
Sint32 btAbilityReplaceDefeated(const BATTLE_ACTION_RECORD *action)
Returns the action's target, or a random living unit of its side when the
target is down; TARGET_SIDE_DEFEATED when none is left.
References btUnitListLiving(), gmUnitGet(), Sint32 and syRandom().
Referenced by btAutoBattleRunAction().
Definition at line 580 of file battle_auto_battle.c.