The targets an enemy's or a confused unit's ability picks. More...
Go to the source code of this file.
Data Structures | |
| struct | SlotArray |
| BattleWork's unit lists, read as one array of halfwords. More... | |
Macros | |
| #define | PLACE_PARTY 0x100 |
| The list place codes the target pickers return: the party's places 0x100 | place, the enemies' 0x180 | place (Battle_FindTaggedSlotByValue). | |
| #define | PLACE_ENEMY 0x180 |
| #define | COUNT_PARTIAL_CURES(unit, count) |
| Counts the ailments of unit that a partial cure removes (delusion, confusion, charm, sleep, Psynergy seal, the Grim Reaper's curse). | |
| #define | COUNT_ALL_CURES(unit, count) |
| Counts the ailments a full cure removes: those, haunting and poison. | |
| #define | COUNT_POSITIVE_MODIFIERS(unit, count) |
| Counts unit's raised stats: Attack, Defense, Resistance and each element. | |
| #define | CHECK_EFFECT_TARGET(unit, action, applies, kindIndex) |
| How worthwhile an enemy's ability is against unit, in applies (0 for pointless): a stat change that can still move (one more when it is about to wear off), a cure or a heal the unit needs, an ailment it lacks, a revival of a downed unit (100). | |
| #define | STRATEGY_MOST_HP 0 |
| #define | STRATEGY_MOST_MAX_HP 1 |
| #define | STRATEGY_RANDOM 2 |
Functions | |
| s32 | BattleTarget_SelectRandomPosition (s32 requireLivingUnit) |
| Picks a random place: with requireLivingUnit, a party member still standing; otherwise any enemy place in use. | |
| s32 | BattleTarget_SelectForAction (s32 actorId, struct BattleAct *action) |
| Picks the target of an enemy's ability (or a confused unit's), as a place code: among the units of the side it may target, those it would affect (CHECK_EFFECT_TARGET), at random; a single-target attack by an enemy with a strategy favours the strongest, the first of the sorted targets 6 times in 11, 15 or 18, the next 5 times, and so on. | |
The targets an enemy's or a confused unit's ability picks.
Part of battle.c, the battle object, compiled only through it.
Definition in file targeting.c.
| #define PLACE_PARTY 0x100 |
The list place codes the target pickers return: the party's places 0x100 | place, the enemies' 0x180 | place (Battle_FindTaggedSlotByValue).
Definition at line 17 of file targeting.c.
Referenced by BattleTarget_SelectForAction(), and BattleTarget_SelectRandomPosition().
| #define PLACE_ENEMY 0x180 |
Definition at line 18 of file targeting.c.
Referenced by BattleTarget_SelectForAction(), and BattleTarget_SelectRandomPosition().
| #define COUNT_PARTIAL_CURES | ( | unit, | |
| count ) |
Counts the ailments of unit that a partial cure removes (delusion, confusion, charm, sleep, Psynergy seal, the Grim Reaper's curse).
Definition at line 117 of file targeting.c.
| #define COUNT_ALL_CURES | ( | unit, | |
| count ) |
Counts the ailments a full cure removes: those, haunting and poison.
Definition at line 134 of file targeting.c.
| #define COUNT_POSITIVE_MODIFIERS | ( | unit, | |
| count ) |
Counts unit's raised stats: Attack, Defense, Resistance and each element.
Definition at line 144 of file targeting.c.
| #define CHECK_EFFECT_TARGET | ( | unit, | |
| action, | |||
| applies, | |||
| kindIndex ) |
How worthwhile an enemy's ability is against unit, in applies (0 for pointless): a stat change that can still move (one more when it is about to wear off), a cure or a heal the unit needs, an ailment it lacks, a revival of a downed unit (100).
Failing its added effect, the ability's damage or healing must have something to work on. kindIndex receives the ability's kind less one.
Definition at line 168 of file targeting.c.
Referenced by BattleTarget_SelectForAction().
| #define STRATEGY_MOST_HP 0 |
Definition at line 305 of file targeting.c.
Referenced by BattleTarget_SelectForAction().
| #define STRATEGY_MOST_MAX_HP 1 |
Definition at line 306 of file targeting.c.
| #define STRATEGY_RANDOM 2 |
Definition at line 307 of file targeting.c.
Referenced by BattleTarget_SelectForAction().
Picks a random place: with requireLivingUnit, a party member still standing; otherwise any enemy place in use.
Returns its place code, or 0 when there is none. Called by BattleCommand_SelectAutomatic when BattleTarget_SelectForAction finds no one listed on the side (-2). Takes one Random16 roll when any position qualifies.
Definition at line 26 of file targeting.c.
Referenced by BattleCommand_SelectAutomatic(), and BattleTarget_SelectRandomPosition().
Picks the target of an enemy's ability (or a confused unit's), as a place code: among the units of the side it may target, those it would affect (CHECK_EFFECT_TARGET), at random; a single-target attack by an enemy with a strategy favours the strongest, the first of the sorted targets 6 times in 11, 15 or 18, the next 5 times, and so on.
Returns -2 when the side has no one, -1 when the ability would affect no one. Called by BattleCommand_SelectAutomatic for an ability aimed at allies, the user or foes. Takes Random16 rolls to choose among eligible targets.
Definition at line 317 of file targeting.c.
Referenced by BattleCommand_SelectAutomatic(), and BattleTarget_SelectForAction().