Alchemy

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.

FieldDeclared as
unk00u8 unk00[0x50]Twenty words in chars.tsv; not named by any TBS code.
hps16 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). @{
pps16 pp[6]
atku16 atk[6]
defu16 def[6]
agiu16 agi[6]
lucku8 luck[6]
elementBonusu8 elementBonus[4]@} Added to ten times the Djinn set in each element to give the character's element levels (Unit_GetElementLevels).
startingLevelu8 startingLevelthe level a new game raises the character to
unk097u8 unk097Padding in chars.tsv.
itemsu16 items[13]The starting items, each added and equipped at a new game; the low nine bits are the item.
unk0b2u8 unk0b2[2]Padding in chars.tsv.

Used by gCharacter_DefinitionTable.

Line 17

ClassAbility

struct ClassAbility

An ability a class teaches, and the level it is learned at.

FieldDeclared as
abilityu8 abilitythe action taught, 0 for none
levelu8 levelthe level it is taught at
unk02u8 unk02[2]Padding in classes.tsv.

Line 42

ClassDefinition

struct ClassDefinition

A class: its series, the element levels it needs, its stat multipliers and the abilities it teaches.

FieldDeclared as
serieslong seriesThe series the class belongs to; Class_Determine picks the series from the character's two strongest elements.
requiredu8 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.
hpu8 hptenths of the base stat
ppu8 pptenths of the base stat
atku8 atktenths of the base stat
defu8 deftenths of the base stat
agiu8 agitenths of the base stat
lucku8 lucktenths of the base stat
unk0eu8 unk0e[2]Padding in classes.tsv.
abilitiesstruct ClassAbility abilities[16]the Psynergy the class teaches
unk50u8 unk50[4][0] to [2]: the ability effects the class is weak to (BattleTarget_IsWeakToEffect); [3] is not read there.

Used by gClass_DefinitionTable.

Line 50

DjinnDefinition

struct DjinnDefinition

A Djinni: its ability and the stat bonuses it gives while set.

FieldDeclared as
abilityIdu16 abilityIdthe action the Djinni unleashes
unk02u8 unk02[2]Reserved in djinn.tsv; not named by any TBS code.
hps8 hpAdded to the base stats while the Djinni is set (UnitCalc), before the class multiplies them. @{
pps8 pp
atks8 atk
defs8 def
agis8 agi
lucks8 luck
unk0au8 unk0a[2]@} Reserved in djinn.tsv.

Used by Djinn_GetDefinition, gDjinn_DefinitionTable.

Line 71

EnemyDefinition

struct EnemyDefinition

An enemy's definition: its level and stats, items, element preset, the actions it chooses from and its rewards.

FieldDeclared as
unk00u8 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.
levelu8 level
hpu16 hpThe base stats BattleUnitSet copies into the unit. @{
ppu16 pp
atku16 atk
defu16 def
agiu16 agi
lucku8 luck
turnsu8 turnsactions a round (BattleUnit.baseActionCount)
hpRegenu8 hpRegen
ppRegenu8 ppRegen
unk1eu8 unk1e[2]@} Reserved in enemies.tsv: 0 in every row.
rewardsu32 rewards0 in every row; copied to BattleUnit.rewards
unk24u8 unk24[4]Reserved in enemies.tsv: 0 in every row.
itemsu16 items[4]items the enemy carries, 0 for none
countsu8 counts[4]how many of each item it carries
elementPresetu8 elementPresetrow of gEnemy_ElementPresetTable, 0 to 43
targetStrategys8 targetStrategyWhom 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.
actionStrategys8 actionStrategyHow 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).
itemActionsu8 itemActionsone bit per place in actions: use an item held instead
actionsu16 actions[8]the abilities the enemy chooses from
unk48u8 unk48[4][0] to [2]: the ability effects the enemy is weak to (BattleTarget_IsWeakToEffect); [3] is 0 in every row.
coinsu16 coinscoins won
items16 itemthe item it may leave, 0 for none
itemChances16 itemChanceThe chance of the item: 1 in 2 to the power itemChance - 1, two powers better with BattleEnemy_RecordDefeat's Djinn bonus; 0 for none.
experienceu16 experienceexperience won

Used by BattleEnemy_RecordDefeat, BattleFormation_AverageLevel, BattleTarget_SelectForAction, BattleUnitSet, Enemy_GetAttackElement, Unit_GetElementLevels, gEnemy_Definitions.

Line 89

LevelUpResult

struct LevelUpResult

A level up's result: the level reached, an ability learned and the gain in each stat.

FieldDeclared as
levels16 level
abilityu16 ability
hpu16 hp
ppu16 pp
atku16 atk
defu16 def
agiu16 agi
lucku16 luck

Used by Battle_AwardSpoils.

Line 136

Globals, without a comment: gCharacter_DefinitionTable, gClass_DefinitionTable.

On this page