BattleUnit, a party member's or enemy's battle state, with the elements, abilities and actions it uses. More...
Go to the source code of this file.
Data Structures | |
| struct | OwnerActionSlot |
| An entry in a unit's action list: the action's id (OWNER_ACTION_ID_MASK) and marks for an action its class or an equipped item gave. More... | |
| struct | BattleElementStats |
| A unit's elemental power and resistance in one element. More... | |
| struct | BattleAct |
| An ability's definition, a row of gBattleAction_DefinitionTable: its targeting, kind, element, effect, range, PP cost and power. More... | |
| struct | BattleUnit |
| A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments. More... | |
Macros | |
| #define | ABILITY_RANGE_ALL 255 |
| BattleAct.range of an ability that reaches every unit on the side, each as if aimed at. | |
| #define | ABILITY_KIND_MASK 15 |
| The low four bits of BattleAct.flags: how BattleTargetExec applies the ability's power. | |
| #define | Unit_UpdateGauges(unit) |
| Recalculates HP and PP gauges, keeping at least one when any points remain. | |
Functions | |
| STATIC_ASSERT (sizeof(struct BattleAct)==BATTLE_ACTION_SIZE) | |
| STATIC_ASSERT (offsetof(struct BattleAct, effect)==0x03) | |
| STATIC_ASSERT (offsetof(struct BattleAct, power)==0x0a) | |
| STATIC_ASSERT (offsetof(struct BattleAct, type0c)==0x0c) | |
| STATIC_ASSERT (sizeof(struct OwnerActionSlot)==4) | |
| STATIC_ASSERT (sizeof(struct BattleElementStats)==4) | |
| STATIC_ASSERT (sizeof(struct BattleUnit)==BATTLE_UNIT_SIZE) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, baseHp)==0x10) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, baseAttack)==0x18) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, actionSlots)==0x58) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, djinnAvailable)==0xf8) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, djinnActive)==0x108) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, rewards)==0x120) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, hp)==0x038) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, baseElement)==0x024) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, level)==0x00f) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, element)==0x048) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, ready)==0x144) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, inventory)==0x0d8) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, djinnOwnedCounts)==0x118) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, djinnActiveCounts)==0x11c) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, guardLevel)==0x12b) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, charm)==0x13a) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, haunt)==0x140) | |
| STATIC_ASSERT (offsetof(struct BattleUnit, enemyId)==0x14a) | |
| static __inline__ s32 | Vitals_Clamp (s32 ratio) |
| Clamps a gauge ratio to 0..0x4000, where 0x4000 means full. | |
BattleUnit, a party member's or enemy's battle state, with the elements, abilities and actions it uses.
Definition in file battle_unit.h.
| #define ABILITY_RANGE_ALL 255 |
BattleAct.range of an ability that reaches every unit on the side, each as if aimed at.
Definition at line 46 of file battle_unit.h.
Referenced by BattleMenu_RunActionSelection(), BattleTarget_RunSelection(), BattleTargetExec(), and DjinnMenu_ShowChangePreview().
| #define ABILITY_KIND_MASK 15 |
The low four bits of BattleAct.flags: how BattleTargetExec applies the ability's power.
Kinds 0, 7 and 9 apply none: 0 is no ability, 7 is Granite, Flash and Kite, 9 the field Psynergy, Defend, Flee and enemies' commands.
Definition at line 52 of file battle_unit.h.
Referenced by Battle_ClassifyEntryKind(), BattleCommand_BuildPlan(), BattleTarget_SelectForAction(), and BattleTargetExec().
| #define Unit_UpdateGauges | ( | unit | ) |
Recalculates HP and PP gauges, keeping at least one when any points remain.
Definition at line 355 of file battle_unit.h.
Referenced by Field_RunScene(), Party_EndChildhood(), Party_RemoveOwnerRestored(), Party_RestoreHpPp(), Party_RestorePpOfLitElements(), Scene_ReturnFromBattle(), Unit_SetHp(), Unit_SetPp(), and UnitRatio().
| anonymous enum |
| Enumerator | |
|---|---|
| BATTLE_ACTION_SIZE | |
| BATTLE_UNIT_SIZE | |
| OWNER_ACTION_ID_MASK | |
Definition at line 11 of file battle_unit.h.
| enum Element |
The elements, in the order of every table kept per element: a unit's element stats, the Djinn and the summons.
ELEMENT_NONE marks an ability or a weapon that has no element.
| Enumerator | |
|---|---|
| ELEMENT_VENUS | |
| ELEMENT_MERCURY | |
| ELEMENT_MARS | |
| ELEMENT_JUPITER | |
| ELEMENT_NONE | |
| NUM_ELEMENTS | |
Definition at line 35 of file battle_unit.h.
| enum AbilityKind |
The kinds of ability, by the low four bits of BattleAct.flags.
Three kinds have no enumerator, because BattleTargetExec applies no power for them: 0 is no ability; 7 is Granite, Flash and Kite, whose effect is all they do; 9 is the field Psynergy (Move, Catch...), the field-only stat items (Apple, Power Bread...), Defend, Flee and the enemies' commands (Threaten, Ally Search...). The targeting check treats kind 9 as a summon: worth it on a living unit only when the power is nonzero.
| Enumerator | |
|---|---|
| ABILITY_KIND_HEAL_HP | Cure, Fizz, healing items. |
| ABILITY_KIND_EFFECT | damage only if the effect lands |
| ABILITY_KIND_ATTACK | Attack vs Defense, plus the power. |
| ABILITY_KIND_ATTACK_MULTIPLIED | that attack times power / 10 |
| ABILITY_KIND_DAMAGE | HP damage from the power (Psynergy). |
| ABILITY_KIND_UNLEASHED_DAMAGE | an enemy's. Shown as X unleashes Y! |
| ABILITY_KIND_SUMMON | the summons: damage scaled by distance |
| ABILITY_KIND_PP_DAMAGE | Crazy Voice: the target loses PP. |
| ABILITY_KIND_HEAL_PP | Ember, Psy Crystal, Adept Ring. |
Definition at line 61 of file battle_unit.h.
| enum AbilityEffect |
BattleAct.effect: what an ability does besides its damage or healing, applied by BattleTargetExec unless noted.
Each is named for the abilities that have it (actions.tsv, with their English names and descriptions). Sidestep (48) and Crazy Voice (52) have effects no code here reads.
Definition at line 77 of file battle_unit.h.
| enum BattleActionUse |
BattleAct.flags: where an ability can be used.
| Enumerator | |
|---|---|
| ACTION_USABLE_IN_FIELD | can be used outside battle |
| ACTION_USABLE_IN_BATTLE | can be used in battle; else greyed there |
Definition at line 171 of file battle_unit.h.
| STATIC_ASSERT | ( | sizeof(struct BattleAct) | = =BATTLE_ACTION_SIZE | ) |
| STATIC_ASSERT | ( | sizeof(struct OwnerActionSlot) | = =4 | ) |
| STATIC_ASSERT | ( | sizeof(struct BattleElementStats) | = =4 | ) |
| STATIC_ASSERT | ( | sizeof(struct BattleUnit) | = =BATTLE_UNIT_SIZE | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, baseHp) | = =0x10 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, baseAttack) | = =0x18 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, actionSlots) | = =0x58 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, djinnAvailable) | = =0xf8 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, djinnActive) | = =0x108 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, rewards) | = =0x120 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, hp) | = =0x038 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, baseElement) | = =0x024 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, level) | = =0x00f | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, element) | = =0x048 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, ready) | = =0x144 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, inventory) | = =0x0d8 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, djinnOwnedCounts) | = =0x118 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, djinnActiveCounts) | = =0x11c | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, guardLevel) | = =0x12b | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, charm) | = =0x13a | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, haunt) | = =0x140 | ) |
| STATIC_ASSERT | ( | offsetof(struct BattleUnit, enemyId) | = =0x14a | ) |
Clamps a gauge ratio to 0..0x4000, where 0x4000 means full.
Definition at line 339 of file battle_unit.h.
Referenced by Vitals_Clamp().