Alchemy
Loading...
Searching...
No Matches

battle_type.h

Go to the documentation of this file.
1#ifndef ALCHEMY_BATTLE_TYPE_H
2#define ALCHEMY_BATTLE_TYPE_H
3
4/// @file
5/// BattlePlan, an action planned for its targets: the hits, criticals and
6/// multipliers rolled.
7
8#include "static_assert.h"
9#include "battle_unit.h"
10
12
13/// BattlePlan.targetCritical: the critical hit rolled for each target.
16 CRITICAL_HIT, ///< an attack's: a quarter more damage
17 CRITICAL_STRONG ///< an ability's (effects 36 to 40): half as much again
18};
19
20/// BattlePlan.targetHit while the hit is still to be rolled, as the ability
21/// lands; BattleCommand_BuildPlan rolls it ahead only for Annihilation.
22#define HIT_NOT_ROLLED -1
23
24/// One action, as BattleCommand_BuildPlan lays it out for BattleTargetExec to
25/// apply target by target.
26struct BattlePlan {
27 u8 actorId; ///< the acting unit
28 s8 targetCount; ///< targets in targetIds
29 u8 targetIds[BATTLE_TARGET_CAPACITY]; ///< in battlefield order
30 /// Each target's place relative to the aimed one: negative to one side.
32 /// The damage multiplier: 0 a miss, 1 a blow, 2 or 3 a double or triple.
34 s8 targetCritical[BATTLE_TARGET_CAPACITY]; ///< enum BattleCritical
35 s8 targetHit[BATTLE_TARGET_CAPACITY]; ///< 1, 0 or HIT_NOT_ROLLED
36 s16 command; ///< enum BattleCommand
37 u8 unk4a[2]; ///< not named by TBS code
39 s32 element; ///< enum Element
40 s32 outcome; ///< enum BattlePlanStaging: how the action is shown
41 /// How the effect is staged (STAGING_ in battle_internal.h).
42 /// bits: 19 view reversed | 18 view across | 17 other side | 16 on downed |
43 /// 15 scene | 14 by id range | 13..12 variant | 11..0 effect kind
45 s32 failure; ///< 0 cast; 1 the Psynergy is sealed, 2 too little PP
46 /// The damage the evil spirit deals a haunted actor at the end of its turn.
48};
49
51STATIC_ASSERT(offsetof(struct BattlePlan, targetIds) == 0x02);
52STATIC_ASSERT(offsetof(struct BattlePlan, targetMultiplier) == 0x1e);
53STATIC_ASSERT(offsetof(struct BattlePlan, abilityId) == 0x4c);
54STATIC_ASSERT(offsetof(struct BattlePlan, hauntDamage) == 0x60);
55
56#endif
@ BATTLE_TARGET_CAPACITY
Definition battle_type.h:11
@ BATTLE_PLAN_SIZE
Definition battle_type.h:11
BattleCritical
BattlePlan.targetCritical: the critical hit rolled for each target.
Definition battle_type.h:14
@ CRITICAL_STRONG
an ability's (effects 36 to 40): half as much again
Definition battle_type.h:17
@ CRITICAL_NONE
Definition battle_type.h:15
@ CRITICAL_HIT
an attack's: a quarter more damage
Definition battle_type.h:16
BattleUnit, a party member's or enemy's battle state, with the elements, abilities and actions it use...
STATIC_ASSERT, a compile-time check that emits nothing.
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
Definition stddef.h:19
One action, as BattleCommand_BuildPlan lays it out for BattleTargetExec to apply target by target.
Definition battle_type.h:26
s32 outcome
enum BattlePlanStaging: how the action is shown
Definition battle_type.h:40
u32 presentationFlags
How the effect is staged (STAGING_ in battle_internal.h).
Definition battle_type.h:44
u32 hauntDamage
The damage the evil spirit deals a haunted actor at the end of its turn.
Definition battle_type.h:47
s8 targetCount
targets in targetIds
Definition battle_type.h:28
u8 actorId
the acting unit
Definition battle_type.h:27
u8 targetIds[BATTLE_TARGET_CAPACITY]
in battlefield order
Definition battle_type.h:29
s8 targetHit[BATTLE_TARGET_CAPACITY]
1, 0 or HIT_NOT_ROLLED
Definition battle_type.h:35
s8 targetOffset[BATTLE_TARGET_CAPACITY]
Each target's place relative to the aimed one: negative to one side.
Definition battle_type.h:31
s8 targetCritical[BATTLE_TARGET_CAPACITY]
enum BattleCritical
Definition battle_type.h:34
s16 command
enum BattleCommand
Definition battle_type.h:36
s32 failure
0 cast; 1 the Psynergy is sealed, 2 too little PP
Definition battle_type.h:45
s32 element
enum Element
Definition battle_type.h:39
s8 targetMultiplier[BATTLE_TARGET_CAPACITY]
The damage multiplier: 0 a miss, 1 a blow, 2 or 3 a double or triple.
Definition battle_type.h:33
u8 unk4a[2]
not named by TBS code
Definition battle_type.h:37
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
signed char s8
Definition types.h:10
signed short s16
Definition types.h:12
unsigned char u8
Definition types.h:11