character.h
games/tbs/include/character.h on GitHub
Structures
CharacterDefinition
struct CharacterDefinition
A character's definition: the growth curves of its stats, its element bonus, starting level and starting equipment.
| Field | Declared as | |
|---|---|---|
unk00 | u8 unk00[0x50] | Twenty words in chars.tsv; not named by any TBS code. |
hp | s16 hp[6] | The growth curves: each stat at levels 0, 20, 40, 60, 80 and 100. A level up adds a twentieth of the step around the new level, with a random part; level 1 adds the first point (Owner_LevelUp). @{ |
pp | s16 pp[6] | |
atk | u16 atk[6] | |
def | u16 def[6] | |
agi | u16 agi[6] | |
luck | u8 luck[6] | |
elementBonus | u8 elementBonus[4] | @} Added to ten times the Djinn set in each element to give the character's element levels (Unit_GetElementLevels). |
startingLevel | u8 startingLevel | the level a new game raises the character to |
unk097 | u8 unk097 | Padding in chars.tsv. |
items | u16 items[13] | The starting items, each added and equipped at a new game; the low nine bits are the item. |
unk0b2 | u8 unk0b2[2] | Padding in chars.tsv. |
Used by gCharacter_DefinitionTable.
ClassAbility
struct ClassAbility
An ability a class teaches, and the level it is learned at.
| Field | Declared as | |
|---|---|---|
ability | u8 ability | the action taught, 0 for none |
level | u8 level | the level it is taught at |
unk02 | u8 unk02[2] | Padding in classes.tsv. |
ClassDefinition
struct ClassDefinition
A class: its series, the element levels it needs, its stat multipliers and the abilities it teaches.
| Field | Declared as | |
|---|---|---|
series | long series | The series the class belongs to; Class_Determine picks the series from the character's two strongest elements. |
required | u8 required[4] | The element levels the class needs, in tens: the last class of the series the character meets in all four is its class. |
hp | u8 hp | tenths of the base stat |
pp | u8 pp | tenths of the base stat |
atk | u8 atk | tenths of the base stat |
def | u8 def | tenths of the base stat |
agi | u8 agi | tenths of the base stat |
luck | u8 luck | tenths of the base stat |
unk0e | u8 unk0e[2] | Padding in classes.tsv. |
abilities | struct ClassAbility abilities[16] | the Psynergy the class teaches |
unk50 | u8 unk50[4] | [0] to [2]: the ability effects the class is weak to (BattleTarget_IsWeakToEffect); [3] is not read there. |
Used by gClass_DefinitionTable.
DjinnDefinition
struct DjinnDefinition
A Djinni: its ability and the stat bonuses it gives while set.
| Field | Declared as | |
|---|---|---|
abilityId | u16 abilityId | the action the Djinni unleashes |
unk02 | u8 unk02[2] | Reserved in djinn.tsv; not named by any TBS code. |
hp | s8 hp | Added to the base stats while the Djinni is set (UnitCalc), before the class multiplies them. @{ |
pp | s8 pp | |
atk | s8 atk | |
def | s8 def | |
agi | s8 agi | |
luck | s8 luck | |
unk0a | u8 unk0a[2] | @} Reserved in djinn.tsv. |
Used by Djinn_GetDefinition, gDjinn_DefinitionTable.
EnemyDefinition
struct EnemyDefinition
An enemy's definition: its level and stats, items, element preset, the actions it chooses from and its rewards.
| Field | Declared as | |
|---|---|---|
unk00 | u8 unk00[15] | The enemy's name: enemies.tsv's name column, 15 bytes, blank in every row. BattleUnitSet takes the name from the messages instead. |
level | u8 level | |
hp | u16 hp | The base stats BattleUnitSet copies into the unit. @{ |
pp | u16 pp | |
atk | u16 atk | |
def | u16 def | |
agi | u16 agi | |
luck | u8 luck | |
turns | u8 turns | actions a round (BattleUnit.baseActionCount) |
hpRegen | u8 hpRegen | |
ppRegen | u8 ppRegen | |
unk1e | u8 unk1e[2] | @} Reserved in enemies.tsv: 0 in every row. |
rewards | u32 rewards | 0 in every row; copied to BattleUnit.rewards |
unk24 | u8 unk24[4] | Reserved in enemies.tsv: 0 in every row. |
items | u16 items[4] | items the enemy carries, 0 for none |
counts | u8 counts[4] | how many of each item it carries |
elementPreset | u8 elementPreset | row of gEnemy_ElementPresetTable, 0 to 43 |
targetStrategy | s8 targetStrategy | Whom a single-target attack favours: the target with the most HP left (0), the most maximum HP (1) or no one (2). The action choice also skips an ability the enemy lacks PP for unless it is 0, and a sealed one when it is 2. |
actionStrategy | s8 actionStrategy | How the action is chosen from actions (BattleCommand_SelectAutomatic): one of three weight tables (0 to 2), a random place then in order (3), in order (4), the next place (5) or the same place (6). |
itemActions | u8 itemActions | one bit per place in actions: use an item held instead |
actions | u16 actions[8] | the abilities the enemy chooses from |
unk48 | u8 unk48[4] | [0] to [2]: the ability effects the enemy is weak to (BattleTarget_IsWeakToEffect); [3] is 0 in every row. |
coins | u16 coins | coins won |
item | s16 item | the item it may leave, 0 for none |
itemChance | s16 itemChance | The chance of the item: 1 in 2 to the power itemChance - 1, two powers better with BattleEnemy_RecordDefeat's Djinn bonus; 0 for none. |
experience | u16 experience | experience won |
Used by BattleEnemy_RecordDefeat, BattleFormation_AverageLevel, BattleTarget_SelectForAction, BattleUnitSet, Enemy_GetAttackElement, Unit_GetElementLevels, gEnemy_Definitions.
LevelUpResult
struct LevelUpResult
A level up's result: the level reached, an ability learned and the gain in each stat.
| Field | Declared as | |
|---|---|---|
level | s16 level | |
ability | u16 ability | |
hp | u16 hp | |
pp | u16 pp | |
atk | u16 atk | |
def | u16 def | |
agi | u16 agi | |
luck | u16 luck |
Used by Battle_AwardSpoils.
Globals, without a comment: gCharacter_DefinitionTable, gClass_DefinitionTable.