src/battle/battle_turn_end.c
The 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). More…
Included by battle.c.
Macros
| Name | Description | |
|---|---|---|
#define | WAKES_MESSAGE ((Sint32)&MsgResNormal - 3) | ねむりからさめた! |
#define | AGI_NORMAL_MESSAGE ((Sint32)&MsgDefNormal + 1) | すばやさが もどった! |
#define | CONSCIOUS_MESSAGE ((Sint32)&MsgDefNormal + 2) | われにかえった! |
#define | CURE_DELUSION_MESSAGE ((Sint32)&MsgCharmConscious - 3) | まぼろしを うちやぶった! |
#define | CURE_SEAL_MESSAGE ((Sint32)&MsgCharmConscious - 2) | エナジーふうじがとけた! |
#define | CURE_STUN_MESSAGE ((Sint32)&MsgCharmConscious - 1) | しびれがきえた! |
#define | REFLECT_END_MESSAGE ((Sint32)&MsgRefrainEnd + 1) | リフレクトのこうかがきえた! |
#define | ANNOUNCE_END (test, message) | When test finds the unit's status over, shows its end, message, with the unit's name, and waits for the player. |
#define | ANNOUNCE_END_POSE (test, message) | As ANNOUNCE_END, turning the unit back to its usual pose before the message. |
#define | BOSS_REGEN_MULTIPLE 10 | The bosses whose regeneration is multiplied, the Serpents and Dullahan, regenerate BOSS_REGEN_MULTIPLE times their hpRegen each turn. |
#define | QUEUE_SUMMONED_DJINN (pending, each) | Gives the Djinn a summon used (DJINN_RECOVERY_SUMMONED) their turns to recover, owner by owner: each one turn after the last of its owner's already recovering, and never sooner than turn 2. |
#define | DRAIN_CANDIDATE_MAX 10 | The most Djinn btUnitDrainDjinn gathers to choose from. |
Enumerations
| Name | Description | |
|---|---|---|
enum | EARLY_END_BIAS { EARLY_END_ATTACK_DOWN, EARLY_END_DEFENSE_DOWN, EARLY_END_RES … } | How much likelier, in percent, each lowered stat and status is to end early (btUnitRollCounterEarlyEnd's bias). |
Functions
| Name | Description | |
|---|---|---|
Bool | btUnitRollCounterEarlyEnd (Sint32 unitId, Sint32 turns, Sint32 bias) | Rolls whether a stat change or status with five turns or fewer left ends early, at luck * 3 - turns * 5 + bias percent, and returns 1 when it does. |
Bool | btUnitCountDownAttackStage (Sint32 unitId) | Counts down an Attack change and returns 1 when it ends; a lowered Attack may recover early. |
Bool | btUnitCountDownDefenseStage (Sint32 unitId) | Counts down a Defense change and returns 1 when it ends; a lowered Defense may recover early. |
Bool | btUnitCountDownResistanceStage (Sint32 unitId) | Counts down a Resistance change and returns 1 when it ends; a lowered Resistance may recover early. |
Bool | btUnitCountDownDelusion (Sint32 unitId) | Counts down delusion and returns 1 when it ends, early or not. |
Bool | btUnitCountDownConfusion (Sint32 unitId) | Counts down confusion and returns 1 when it ends, early or not. |
Bool | btUnitCountDownCharm (Sint32 unitId) | Counts down charm and returns 1 when it ends, early or not. |
Bool | btUnitCountDownStun (Sint32 unitId) | Counts down a stun and returns 1 when it ends, early or not. |
Bool | btUnitCountDownSleep (Sint32 unitId) | Counts down sleep and returns 1 when it ends, early or not. |
Bool | btUnitCountDownPsynergySeal (Sint32 unitId) | Counts down both seals in UNIT.psySeal and returns 1 when the last ends; only Bind's, once Luff's is gone, may end early. |
Bool | btUnitCountDownRegenerate (Sint32 unitId) | While Regenerate lasts, heals the unit by a tenth of its max HP for each turn it has left and one more, shown in playback; then counts it down and returns 1 when it runs out. |
Bool | btUnitCountDownReflect (Sint32 unitId) | Counts down Reflect and returns 1 when it runs out; it never ends early. |
Bool | btUnitCountDownAgilityStage (Sint32 unitId) | Counts down an Agility change and returns 1 when it runs out; it never ends early. |
Sint32 | btDjinnRecoveryCountDown (void) | Brings the party's recovering Djinn one turn nearer, setting each that is ready, and returns 1 when any was set. |
Sint32 | btDjinnRecoverAll (void) | Sets every recovering Djinni of a party member with HP at once, as twenty turns of recovery would; those on standby stay so. |
void | btTurnEndNoOperation (void) | Does nothing; btRun calls it at the end of each turn and of the battle. |
Sint32 | btDjinnRecoveryCountDownSide (Sint32 side) | Counts down one side's Djinn recovery at the turn's end, for owners in the battle. |
void | btProcessTurnEnd (void) | Ends a turn: counts down the recovering Djinn and sets those recovered, then gives each unit its regeneration and counts down its stat changes and statuses, showing each that ends. |
void | btUnitDrainDjinn (Sint32 unitId, Sint32 all, Sint32 announce) | Djinnfest, Fugue, Djinn Blast, Djinn Storm and Djinn Stun: puts one of the unit's set Djinn at random on standby (every one, when all is set), or, when none is set, drains one that could be set so it must recover. |
void | btUnitProcessActionEnd (BATTLE_PLAN *plan) | Ends one unit's action: its Djinn on standby are taken off its set, the Djinn a summon used begin to recover, and the unit takes its summon's power boost, the haunt's damage, poison and the Grim Reaper. |
Description
The 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). Part of battle.c.
Macros in detail
WAKES_MESSAGE
#define WAKES_MESSAGE ((Sint32)&MsgResNormal - 3)
#define WAKES_MESSAGE ((Sint32)&MsgWakes)
ねむりからさめた! ("wakes from slumber"), three before MsgResNormal.
Referenced by btProcessTurnEnd().
Definition at lines 467 and 484 of file battle_turn_end.c.
AGI_NORMAL_MESSAGE
#define AGI_NORMAL_MESSAGE ((Sint32)&MsgDefNormal + 1)
#define AGI_NORMAL_MESSAGE ((Sint32)&MsgAgiNormal)
すばやさが もどった! ("Agility returns to normal"), after MsgDefNormal.
Referenced by btProcessTurnEnd().
Definition at lines 469 and 485 of file battle_turn_end.c.
CONSCIOUS_MESSAGE
#define CONSCIOUS_MESSAGE ((Sint32)&MsgDefNormal + 2)
#define CONSCIOUS_MESSAGE ((Sint32)&MsgConfusionConscious)
われにかえった! ("regains consciousness"), two after MsgDefNormal.
Referenced by btProcessTurnEnd().
Definition at lines 471 and 486 of file battle_turn_end.c.
CURE_DELUSION_MESSAGE
#define CURE_DELUSION_MESSAGE ((Sint32)&MsgCharmConscious - 3)
#define CURE_DELUSION_MESSAGE ((Sint32)&MsgCureDelusion)
まぼろしを うちやぶった! ("sees clearly once again"), three before
MsgCharmConscious.
Referenced by btProcessTurnEnd().
Definition at lines 474 and 487 of file battle_turn_end.c.
CURE_SEAL_MESSAGE
#define CURE_SEAL_MESSAGE ((Sint32)&MsgCharmConscious - 2)
#define CURE_SEAL_MESSAGE ((Sint32)&MsgCureSeal)
エナジーふうじがとけた! ("Psynergy seal is gone"), two before
MsgCharmConscious.
Referenced by btProcessTurnEnd().
Definition at lines 477 and 488 of file battle_turn_end.c.
CURE_STUN_MESSAGE
#define CURE_STUN_MESSAGE ((Sint32)&MsgCharmConscious - 1)
#define CURE_STUN_MESSAGE ((Sint32)&MsgCureStun)
しびれがきえた! ("no longer stunned"), the message before MsgCharmConscious.
Referenced by btProcessTurnEnd().
Definition at lines 479 and 489 of file battle_turn_end.c.
REFLECT_END_MESSAGE
#define REFLECT_END_MESSAGE ((Sint32)&MsgRefrainEnd + 1)
#define REFLECT_END_MESSAGE ((Sint32)&MsgReflectEnd)
リフレクトのこうかがきえた! ("Reflect no longer affects"), after
MsgRefrainEnd.
Referenced by btProcessTurnEnd().
Definition at lines 482 and 490 of file battle_turn_end.c.
ANNOUNCE_END
#define ANNOUNCE_END(test, message)
When test finds the unit's status over, shows its end, message, with the
unit's name, and waits for the player.
Referenced by btProcessTurnEnd().
Definition at line 495 of file battle_turn_end.c.
ANNOUNCE_END_POSE
#define ANNOUNCE_END_POSE(test, message)
As ANNOUNCE_END, turning the unit back to its usual pose before the message.
Referenced by btProcessTurnEnd().
Definition at line 505 of file battle_turn_end.c.
BOSS_REGEN_MULTIPLE
#define BOSS_REGEN_MULTIPLE 10
The bosses whose regeneration is multiplied, the Serpents and Dullahan,
regenerate BOSS_REGEN_MULTIPLE times their hpRegen each turn.
Referenced by btProcessTurnEnd().
Definition at line 517 of file battle_turn_end.c.
QUEUE_SUMMONED_DJINN
#define QUEUE_SUMMONED_DJINN(pending, each)
Gives the Djinn a summon used (DJINN_RECOVERY_SUMMONED) their turns to
recover, owner by owner: each one turn after the last of its owner's already
recovering, and never sooner than turn 2. each runs for every Djinni given
its turn, with i its entry. Uses the caller's i, owner and recoveryTurn.
Referenced by btUnitDrainDjinn() and btUnitProcessActionEnd().
Definition at line 730 of file battle_turn_end.c.
DRAIN_CANDIDATE_MAX
#define DRAIN_CANDIDATE_MAX 10
The most Djinn btUnitDrainDjinn gathers to choose from.
Referenced by btUnitDrainDjinn().
Definition at line 767 of file battle_turn_end.c.
Enumerations in detail
EARLY_END_BIAS
enum EARLY_END_BIAS
How much likelier, in percent, each lowered stat and status is to end early
(btUnitRollCounterEarlyEnd's bias).
| Enumerator | Value | Description |
|---|---|---|
EARLY_END_ATTACK_DOWN | 30 | |
EARLY_END_DEFENSE_DOWN | 20 | |
EARLY_END_RESISTANCE_DOWN | 20 | |
EARLY_END_DELUSION | 30 | |
EARLY_END_CONFUSION | 60 | |
EARLY_END_CHARM | 70 | |
EARLY_END_STUN | 40 | |
EARLY_END_SLEEP | 50 | |
EARLY_END_BIND | 30 | Bind's seal, once Luff's is gone |
Definition at line 9 of file battle_turn_end.c.
Functions in detail
btUnitRollCounterEarlyEnd
Bool btUnitRollCounterEarlyEnd(Sint32 unitId, Sint32 turns, Sint32 bias)
Rolls whether a stat change or status with five turns or fewer left ends
early, at luck * 3 - turns * 5 + bias percent, and returns 1 when it does.
References gmBattleRandomStub(), gmUnitGet() and Sint32.
Referenced by btUnitCountDownAttackStage(), btUnitCountDownCharm(), btUnitCountDownConfusion(), btUnitCountDownDefenseStage(), btUnitCountDownDelusion(), btUnitCountDownPsynergySeal(), btUnitCountDownResistanceStage(), btUnitCountDownSleep() and btUnitCountDownStun().
Definition at line 24 of file battle_turn_end.c.
btUnitCountDownAttackStage
Bool btUnitCountDownAttackStage(Sint32 unitId)
Counts down an Attack change and returns 1 when it ends; a lowered Attack may recover early.
References btUnitRollCounterEarlyEnd(), gmUnitGet() and Sint32.
Referenced by btProcessTurnEnd().
Definition at line 42 of file battle_turn_end.c.
btUnitCountDownDefenseStage
Bool btUnitCountDownDefenseStage(Sint32 unitId)
Counts down a Defense change and returns 1 when it ends; a lowered Defense may recover early.
References btUnitRollCounterEarlyEnd(), gmUnitGet() and Sint32.
Referenced by btProcessTurnEnd().
Definition at line 71 of file battle_turn_end.c.
btUnitCountDownResistanceStage
Bool btUnitCountDownResistanceStage(Sint32 unitId)
Counts down a Resistance change and returns 1 when it ends; a lowered Resistance may recover early.
References btUnitRollCounterEarlyEnd(), gmUnitGet() and Sint32.
Referenced by btProcessTurnEnd().
Definition at line 98 of file battle_turn_end.c.
btUnitCountDownDelusion
Bool btUnitCountDownDelusion(Sint32 unitId)
Counts down delusion and returns 1 when it ends, early or not.
References btUnitRollCounterEarlyEnd(), gmUnitGet() and Sint32.
Referenced by btProcessTurnEnd().
Definition at line 124 of file battle_turn_end.c.
btUnitCountDownConfusion
Bool btUnitCountDownConfusion(Sint32 unitId)
Counts down confusion and returns 1 when it ends, early or not.
References btUnitRollCounterEarlyEnd(), gmUnitGet() and Sint32.
Referenced by btProcessTurnEnd().
Definition at line 144 of file battle_turn_end.c.
btUnitCountDownCharm
Bool btUnitCountDownCharm(Sint32 unitId)
Counts down charm and returns 1 when it ends, early or not.
References btUnitRollCounterEarlyEnd(), gmUnitGet() and Sint32.
Referenced by btProcessTurnEnd().
Definition at line 164 of file battle_turn_end.c.
btUnitCountDownStun
Bool btUnitCountDownStun(Sint32 unitId)
Counts down a stun and returns 1 when it ends, early or not.
References btUnitRollCounterEarlyEnd(), gmUnitGet() and Sint32.
Referenced by btProcessTurnEnd().
Definition at line 183 of file battle_turn_end.c.
btUnitCountDownSleep
Bool btUnitCountDownSleep(Sint32 unitId)
Counts down sleep and returns 1 when it ends, early or not.
References btUnitRollCounterEarlyEnd(), gmUnitGet() and Sint32.
Referenced by btProcessTurnEnd().
Definition at line 201 of file battle_turn_end.c.
btUnitCountDownPsynergySeal
Bool btUnitCountDownPsynergySeal(Sint32 unitId)
Counts down both seals in UNIT.psySeal and returns 1 when the last ends; only
Bind's, once Luff's is gone, may end early.
References btUnitRollCounterEarlyEnd(), gmUnitGet() and Sint32.
Referenced by btProcessTurnEnd().
Definition at line 221 of file battle_turn_end.c.
btUnitCountDownRegenerate
Bool btUnitCountDownRegenerate(Sint32 unitId)
While Regenerate lasts, heals the unit by a tenth of its max HP for each turn it has left and one more, shown in playback; then counts it down and returns 1 when it runs out.
References btPlaybackPush(), btPlaybackReset(), btPlaybackRunAll(), gmUnitGet(), gmUnitRecalculateGaugesStub() and Sint32.
Referenced by btProcessTurnEnd().
Definition at line 247 of file battle_turn_end.c.
btUnitCountDownReflect
Bool btUnitCountDownReflect(Sint32 unitId)
Counts down Reflect and returns 1 when it runs out; it never ends early.
References gmUnitGet() and Sint32.
Referenced by btProcessTurnEnd().
Definition at line 290 of file battle_turn_end.c.
btUnitCountDownAgilityStage
Bool btUnitCountDownAgilityStage(Sint32 unitId)
Counts down an Agility change and returns 1 when it runs out; it never ends early.
References gmUnitGet() and Sint32.
Referenced by btProcessTurnEnd().
Definition at line 306 of file battle_turn_end.c.
btDjinnRecoveryCountDown
Sint32 btDjinnRecoveryCountDown(void)
Brings the party's recovering Djinn one turn nearer, setting each that is ready, and returns 1 when any was set.
References gmDjinnGetRecoveryTableStub(), gmDjinnRecoveryRemoveStub(), gmDjinnSetStub(), gmUnitCalculateStub(), gmUnitGet() and Sint32.
Referenced by btDjinnRecoverAll() and btRun().
Definition at line 324 of file battle_turn_end.c.
btDjinnRecoverAll
Sint32 btDjinnRecoverAll(void)
Sets every recovering Djinni of a party member with HP at once, as twenty turns of recovery would; those on standby stay so. Returns 0.
References btDjinnRecoveryCountDown() and Sint32.
Referenced by scInit().
Definition at line 363 of file battle_turn_end.c.
btTurnEndNoOperation
void btTurnEndNoOperation(void)
Does nothing; btRun calls it at the end of each turn and of the battle.
Referenced by btRun().
Definition at line 373 of file battle_turn_end.c.
btDjinnRecoveryCountDownSide
Sint32 btDjinnRecoveryCountDownSide(Sint32 side)
Counts down one side's Djinn recovery at the turn's end, for owners in the battle. Each Djinni that comes back is shown as it is set: its owner raises a hand and glows in its element to a high note, with "... is set to ...!" Returns 1 when a count fell, 2 when a Djinni was set, else 0.
References btElementGlowPlay(), btObjectGet(), btPlaybackPush(), btPlaybackReset(), btPlaybackSchedulePhase(), btPlaybackWaitForReady(), btUnitIsListed(), fdActorSelectAnimationStub(), fdActorSetAnimationSpeedStub(), gmDjinnGetRecoveryTableStub(), gmDjinnRecoveryRemoveStub(), gmDjinnSetStub(), gmUnitCalculateStub(), gmUnitGet(), result and Sint32.
Referenced by btStagingDispatchAction().
Definition at line 381 of file battle_turn_end.c.
btProcessTurnEnd
void btProcessTurnEnd(void)
Ends a turn: counts down the recovering Djinn and sets those recovered, then gives each unit its regeneration and counts down its stat changes and statuses, showing each that ends.
References BattleTurnEndSideOrder, btBackgroundSetMode(), btElementGlowPlay(), btMessageWaitForAdvance(), btObjectGet(), btPartyPrepareReserveOwners(), btPlaybackPush(), btPlaybackReset(), btPlaybackSchedulePhase(), btPlaybackWaitForReady(), btUnitCountDownAgilityStage(), btUnitCountDownAttackStage(), btUnitCountDownCharm(), btUnitCountDownConfusion(), btUnitCountDownDefenseStage(), btUnitCountDownDelusion(), btUnitCountDownPsynergySeal(), btUnitCountDownReflect(), btUnitCountDownRegenerate(), btUnitCountDownResistanceStage(), btUnitCountDownSleep(), btUnitCountDownStun(), btUnitIsListed(), btUnitListIds(), fdActorSelectAnimationStub(), fdActorSetAnimationSpeedStub(), gmDjinnGetRecoveryTableStub(), gmDjinnRecoveryRemoveStub(), gmDjinnSetStub(), gmUnitAddHpStub(), gmUnitAddPpStub(), gmUnitCalculateStub(), gmUnitGet(), mnBattleMessageShowAndWaitStub(), mnMessageArgumentPushStub(), Sint32 and sySoundPlayStub().
Referenced by btRun().
Definition at line 522 of file battle_turn_end.c.
btUnitDrainDjinn
void btUnitDrainDjinn(Sint32 unitId, Sint32 all, Sint32 announce)
Djinnfest, Fugue, Djinn Blast, Djinn Storm and Djinn Stun: puts one of the
unit's set Djinn at random on standby (every one, when all is set), or, when
none is set, drains one that could be set so it must recover. Djinn Stun's
announce shows MsgDjinnOnStandby; the others show MsgDjinnDrained or
MsgAllDjinnDrained.
References btPlaybackPush(), gmBattleRandomStub(), gmDjinnCanSetStub(), gmDjinnGetRecoveryTableStub(), gmDjinnIsSetStub(), gmDjinnPutOnStandbyStub(), gmDjinnRecoveryAddStandbyStub() and Sint32.
Referenced by btAbilityApplyToTarget().
Definition at line 774 of file battle_turn_end.c.
btUnitProcessActionEnd
void btUnitProcessActionEnd(BATTLE_PLAN *plan)
Ends one unit's action: its Djinn on standby are taken off its set, the Djinn a summon used begin to recover, and the unit takes its summon's power boost, the haunt's damage, poison and the Grim Reaper.
References btElementGlowPlay(), btObjectGet(), btPlaybackPush(), btPlaybackReset(), btPlaybackRunAll(), btPlaybackSchedulePhase(), btPlaybackWaitForReady(), btUnitKeepsOneHp(), btUnitListLiving(), fdActorSelectAnimationStub(), fdActorSetAnimationSpeedStub(), gmDjinnGetRecoveryTableStub(), gmDjinnPutOnStandbyStub(), gmUnitAddHpStub(), gmUnitCalculateStub(), gmUnitGet(), Sint32, syHeapAllocateEWRAM(), syHeapRelease() and sySoundPlayStub().
Referenced by btStagingDispatchAction().
Definition at line 894 of file battle_turn_end.c.