An ability applied to one target, BattleTargetExec: damage, healing and its added effect. More...
Go to the source code of this file.
Macros | |
| #define | STAT_STAGE_MIN -4 |
| A stat stage changes the stat by an eighth of it (UnitCalc), from half at the lowest to one and a half at the highest. | |
| #define | STAT_STAGE_MAX 4 |
| #define | AGILITY_STAGE_DOUBLED 8 |
| Zephyr's Agility stage, beyond the usual highest: twice the Agility. | |
| #define | RESISTANCE_PER_STAGE 20 |
| A Resistance stage adds 20 to the resistance to every element (UnitCalc). | |
| #define | STAT_CHANGE_TURNS 7 |
| #define | AGILITY_CHANGE_TURNS 5 |
| #define | STATUS_TURNS 7 |
| #define | CURSE_TURNS 7 |
| The Grim Reaper's countdown. | |
| #define | PSY_SEAL_BIND 7 |
| BattleUnit.psySeal: Bind's seal counts its seven turns in the low three bits, and may end sooner; Luff's counts down 8 a turn, two turns that never end early (Battle_AdvanceCounterAndCheckChance). | |
| #define | PSY_SEAL_LUFF 16 |
| #define | FULL_RATE 256 |
| The rate BattlePowerCalc and BattleRecoveryCalc scale by: 256 is 1. | |
| #define | MESSAGE_NONE -1 |
| A message operand that shows nothing: the event only waits for the player. | |
| #define | IS_PARTY_UNIT(unitId) |
| Unit ids 0 to 7 are the party's; enemy units start at FIRST_ENEMY_UNIT. | |
| #define | CLAMP_STAT_STAGE(stage) |
| Holds a stat stage within STAT_STAGE_MIN to STAT_STAGE_MAX. | |
| #define | PUSH_SIDE_MESSAGE(unitId, partyMessage, enemyMessage) |
| Pushes one message for a unit of the party and another for an enemy. | |
| #define | REDUCE_BY_GUARD(damage, unit) |
| A guarding unit takes half the damage, or a tenth behind Total Defense. | |
| #define | ABILITY_PSY_DRAIN 126 |
| The ability Psy Drain, Psynergy that costs no PP. | |
Functions | |
| s32 | BattleEffectDeadCheck (s32 effect) |
| Returns 1 for an effect that still applies when the ability's damage has just knocked its target out: the drains, which give the damage they dealt back to the actor. | |
| s32 | BattleTargetExec (struct BattlePlan *plan, s32 slot) |
| Applies the planned ability to one of its targets: first its damage or healing, then its added effect (a status, a stat change, a revival...). | |
| u32 | Ability_IsPsynergy (s32 abilityId) |
| Returns 1 for an ability that costs PP, and for Psy Drain, which costs none. | |
An ability applied to one target, BattleTargetExec: damage, healing and its added effect.
Part of battle.c, the battle object, compiled only through it.
Definition in file target_exec.c.
| #define STAT_STAGE_MIN -4 |
A stat stage changes the stat by an eighth of it (UnitCalc), from half at the lowest to one and a half at the highest.
Definition at line 28 of file target_exec.c.
Referenced by BattleTargetExec().
| #define STAT_STAGE_MAX 4 |
Definition at line 29 of file target_exec.c.
| #define AGILITY_STAGE_DOUBLED 8 |
Zephyr's Agility stage, beyond the usual highest: twice the Agility.
Definition at line 31 of file target_exec.c.
Referenced by BattleTargetExec().
| #define RESISTANCE_PER_STAGE 20 |
A Resistance stage adds 20 to the resistance to every element (UnitCalc).
Definition at line 33 of file target_exec.c.
Referenced by BattleTargetExec().
| #define STAT_CHANGE_TURNS 7 |
Definition at line 37 of file target_exec.c.
Referenced by BattleTargetExec().
| #define AGILITY_CHANGE_TURNS 5 |
Definition at line 38 of file target_exec.c.
Referenced by BattleTargetExec().
| #define STATUS_TURNS 7 |
Definition at line 39 of file target_exec.c.
Referenced by BattleTargetExec().
| #define CURSE_TURNS 7 |
The Grim Reaper's countdown.
Definition at line 41 of file target_exec.c.
Referenced by BattleTargetExec().
| #define PSY_SEAL_BIND 7 |
BattleUnit.psySeal: Bind's seal counts its seven turns in the low three bits, and may end sooner; Luff's counts down 8 a turn, two turns that never end early (Battle_AdvanceCounterAndCheckChance).
Definition at line 46 of file target_exec.c.
Referenced by BattleTargetExec().
| #define PSY_SEAL_LUFF 16 |
Definition at line 47 of file target_exec.c.
Referenced by BattleTargetExec().
| #define FULL_RATE 256 |
The rate BattlePowerCalc and BattleRecoveryCalc scale by: 256 is 1.
Definition at line 50 of file target_exec.c.
Referenced by BattleTargetExec().
| #define MESSAGE_NONE -1 |
A message operand that shows nothing: the event only waits for the player.
Definition at line 53 of file target_exec.c.
Referenced by BattleTargetExec().
| #define IS_PARTY_UNIT | ( | unitId | ) |
Unit ids 0 to 7 are the party's; enemy units start at FIRST_ENEMY_UNIT.
Definition at line 56 of file target_exec.c.
Referenced by BattleTargetExec().
| #define CLAMP_STAT_STAGE | ( | stage | ) |
Holds a stat stage within STAT_STAGE_MIN to STAT_STAGE_MAX.
Definition at line 62 of file target_exec.c.
Referenced by BattleTargetExec().
| #define PUSH_SIDE_MESSAGE | ( | unitId, | |
| partyMessage, | |||
| enemyMessage ) |
Pushes one message for a unit of the party and another for an enemy.
Definition at line 71 of file target_exec.c.
Referenced by BattleTargetExec().
| #define REDUCE_BY_GUARD | ( | damage, | |
| unit ) |
A guarding unit takes half the damage, or a tenth behind Total Defense.
Definition at line 80 of file target_exec.c.
Referenced by BattleTargetExec().
| #define ABILITY_PSY_DRAIN 126 |
The ability Psy Drain, Psynergy that costs no PP.
Definition at line 1312 of file target_exec.c.
Referenced by Ability_IsPsynergy().
Returns 1 for an effect that still applies when the ability's damage has just knocked its target out: the drains, which give the damage they dealt back to the actor.
Called by BattleTargetExec before the added effect. effect : the ability's effect (enum AbilityEffect)
Definition at line 13 of file target_exec.c.
Referenced by BattleEffectDeadCheck(), and BattleTargetExec().
| s32 BattleTargetExec | ( | struct BattlePlan * | plan, |
| s32 | slot ) |
Applies the planned ability to one of its targets: first its damage or healing, then its added effect (a status, a stat change, a revival...).
Nothing is shown here: each step queues battle events (the names and numbers a message needs, the message, the target's reactions) that BattleEvent_Playback then plays in order. The units themselves change at once: UnitCalcFar recalculates a unit's stats from its stages, and UnitRatioFar its HP and PP gauges after either changes.
Called for each target in turn by BattleEvent_Playback (an action with an effect) and BattlePres_RunActorEntries (one without). Changes the target's HP, PP, statuses, stat stages and turns, and its guard; the actor's HP or PP for a drain, and plan->hauntDamage; adds an enemy to gBattleWork->enemyIds when one is called; sets gBattleWork->challengeFlag bit 1 when the party is challenged; queues the events that show it all. It takes BattleRandomFar rolls, and borrows a heap block for the target's copy.
It runs in phases, each marked in the body:
plan : the action under way: the actor, the ability, its element and its targets, each with its distance from the aimed position, damage multiplier, critical hit and any hit roll made in advance. slot : which of the plan's targets (0 to plan->targetCount - 1).
Definition at line 132 of file target_exec.c.
Referenced by BattleEvent_Playback(), BattlePres_RunActorEntries(), and BattleTargetExec().
Returns 1 for an ability that costs PP, and for Psy Drain, which costs none.
Called by BattleCommand_BuildPlan (a cast's staging) and BattleCommand_SelectAutomatic (an enemy's PP and seal checks).
Definition at line 1318 of file target_exec.c.
Referenced by Ability_IsPsynergy(), BattleCommand_BuildPlan(), and BattleCommand_SelectAutomatic().