Alchemy
Loading...
Searching...
No Matches

EnemyDefinition Struct Reference

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

#include <character.h>

Data Fields

u8 unk00 [15]
 The enemy's name: enemies.tsv's name column, 15 bytes, blank in every row.
u8 level
u8 unk1e [2]
 Reserved in enemies.tsv: 0 in every row.
u32 rewards
 0 in every row; copied to BattleUnit.rewards
u8 unk24 [4]
 Reserved in enemies.tsv: 0 in every row.
u16 items [4]
 items the enemy carries, 0 for none
u8 counts [4]
 how many of each item it carries
u8 elementPreset
 row of gEnemy_ElementPresetTable, 0 to 43
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).
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).
u8 itemActions
 one bit per place in actions: use an item held instead
u16 actions [8]
 the abilities the enemy chooses from
u8 unk48 [4]
 [0] to [2]: the ability effects the enemy is weak to (BattleTarget_IsWeakToEffect); [3] is 0 in every row.
u16 coins
 coins won
s16 item
 the item it may leave, 0 for none
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.
u16 experience
 experience won
u16 hp
 The base stats BattleUnitSet copies into the unit.
u16 pp
u16 atk
u16 def
u16 agi
u8 luck
u8 turns
 actions a round (BattleUnit.baseActionCount)
u8 hpRegen
u8 ppRegen

Detailed Description

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

Definition at line 89 of file character.h.

Field Documentation

◆ unk00

u8 EnemyDefinition::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.

Definition at line 92 of file character.h.

◆ level

u8 EnemyDefinition::level

Definition at line 93 of file character.h.

Referenced by BattleFormation_AverageLevel(), and BattleUnitSet().

◆ hp

u16 EnemyDefinition::hp

The base stats BattleUnitSet copies into the unit.

Definition at line 96 of file character.h.

Referenced by BattleUnitSet().

◆ pp

u16 EnemyDefinition::pp

Definition at line 97 of file character.h.

Referenced by BattleUnitSet().

◆ atk

u16 EnemyDefinition::atk

Definition at line 98 of file character.h.

Referenced by BattleUnitSet().

◆ def

u16 EnemyDefinition::def

Definition at line 99 of file character.h.

Referenced by BattleUnitSet().

◆ agi

u16 EnemyDefinition::agi

Definition at line 100 of file character.h.

Referenced by BattleUnitSet().

◆ luck

u8 EnemyDefinition::luck

Definition at line 101 of file character.h.

Referenced by BattleUnitSet().

◆ turns

u8 EnemyDefinition::turns

actions a round (BattleUnit.baseActionCount)

Definition at line 102 of file character.h.

Referenced by BattleUnitSet().

◆ hpRegen

u8 EnemyDefinition::hpRegen

Definition at line 103 of file character.h.

Referenced by BattleUnitSet().

◆ ppRegen

u8 EnemyDefinition::ppRegen

Definition at line 104 of file character.h.

Referenced by BattleUnitSet().

◆ unk1e

u8 EnemyDefinition::unk1e[2]

Reserved in enemies.tsv: 0 in every row.

Definition at line 106 of file character.h.

◆ rewards

u32 EnemyDefinition::rewards

0 in every row; copied to BattleUnit.rewards

Definition at line 107 of file character.h.

Referenced by BattleUnitSet().

◆ unk24

u8 EnemyDefinition::unk24[4]

Reserved in enemies.tsv: 0 in every row.

Definition at line 108 of file character.h.

◆ items

u16 EnemyDefinition::items[4]

items the enemy carries, 0 for none

Definition at line 109 of file character.h.

Referenced by BattleUnitSet().

◆ counts

u8 EnemyDefinition::counts[4]

how many of each item it carries

Definition at line 110 of file character.h.

Referenced by BattleUnitSet().

◆ elementPreset

u8 EnemyDefinition::elementPreset

row of gEnemy_ElementPresetTable, 0 to 43

Definition at line 111 of file character.h.

Referenced by Enemy_GetAttackElement(), Unit_CalcBaseElements(), and Unit_GetElementLevels().

◆ targetStrategy

s8 EnemyDefinition::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.

Definition at line 116 of file character.h.

Referenced by BattleCommand_SelectAutomatic().

◆ actionStrategy

s8 EnemyDefinition::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).

Definition at line 120 of file character.h.

Referenced by BattleCommand_SelectAutomatic().

◆ itemActions

u8 EnemyDefinition::itemActions

one bit per place in actions: use an item held instead

Definition at line 121 of file character.h.

Referenced by BattleCommand_SelectAutomatic().

◆ actions

u16 EnemyDefinition::actions[8]

the abilities the enemy chooses from

Definition at line 122 of file character.h.

Referenced by BattleCommand_SelectAutomatic().

◆ unk48

u8 EnemyDefinition::unk48[4]

[0] to [2]: the ability effects the enemy is weak to (BattleTarget_IsWeakToEffect); [3] is 0 in every row.

Definition at line 125 of file character.h.

◆ coins

u16 EnemyDefinition::coins

coins won

Definition at line 126 of file character.h.

Referenced by BattleEnemy_RecordDefeat().

◆ item

s16 EnemyDefinition::item

the item it may leave, 0 for none

Definition at line 127 of file character.h.

Referenced by BattleEnemy_RecordDefeat().

◆ itemChance

s16 EnemyDefinition::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.

Definition at line 130 of file character.h.

Referenced by BattleEnemy_RecordDefeat().

◆ experience

u16 EnemyDefinition::experience

experience won

Definition at line 131 of file character.h.

Referenced by BattleEnemy_RecordDefeat().