9#if (LANGUAGE != LANGUAGE_JAPANESE)
10#define ENEMY_SUFFIX_FIRST '1'
11#define ENEMY_SUFFIX_LAST 8
13#define ENEMY_SUFFIX_FIRST 'A'
14#define ENEMY_SUFFIX_LAST 25
63 for (i = 0; i < 14 && name[i] != 0; i++)
64 unit->
name[i] = name[i];
74 for (i = 0; i < 4; i++) {
75 if (enemy->
items[i] != 0) {
76 for (q = 0; q < enemy->
counts[i]; q++) {
127 }
while (owner <= 7);
141 while (partyIndex < partySize) {
147 return partySize + 1;
160 for (removedIndex = 0; removedIndex < partySize; removedIndex++) {
164 for (partyIndex = removedIndex; partyIndex < partySize - 1; partyIndex++)
176 if (owners !=
NULL) {
185 }
while (index != count);
204 if (value > 999999) {
225#define PARTY_DEFINE_ADJUST(name, field, max) \
226 s32 name(s32 amount) { \
228 struct GameState *progress = &gGameState; \
230 value = progress->field; \
236 progress->field = value; \
252 u8 value = *source++;
254 (1 << value)) != 0) {
258 }
while (source <= end);
271#undef ENEMY_SUFFIX_FIRST
272#undef ENEMY_SUFFIX_LAST
273#undef PARTY_DEFINE_ADJUST
void UiText_DecodeMessageFar(s32 message, u16 *text, s32 capacity)
s32 GameFlag_Test(s32 flag)
Returns 1 when flag is set.
s32 GameFlag_SetBit(s32 flag)
Sets flag and returns its byte number.
void GameFlag_ClearBit(s32 flag)
Clears flag.
u32 Unit_CalcBaseElements(s32 owner, s16 destination[4][2])
const struct SummonDefinition gSummon_DefinitionTable[]
const struct EnemyDefinition gEnemy_Definitions[]
What every part of the game object shares: its includes and the inventory helper two parts use.
struct GameState gGameState
static s32 Iwram_ClearWords(void *destination, s32 size)
s32 BattleUnitSet(s32 unitId, s32 enemyId, s32 suffix)
Fills battle unit unitId (0x80 to 0x86) with enemy enemyId: stats, name with its suffix letter,...
#define ENEMY_SUFFIX_FIRST
s32 Party_AdjustShopCredit(s32 amount)
#define ENEMY_SUFFIX_LAST
s32 Party_CountActiveOwners(void)
Returns the number of party members, counted from game flags 0 to 7.
s32 Party_RemoveActiveOwner(s32 owner)
Takes character owner out of the party: clears its game flag and closes the gap it leaves in gGameSta...
s32 Summon_ListLearned(u8 *output)
Writes the summons whose bit is set in the first word of the party's Djinn table to output,...
const struct SummonDefinition * SummonDefinition_GetNear(u32 summonId)
Returns summon summonId's definition, or NULL past the sixteenth.
s32 Party_AdjustShopGifts(s32 amount)
s32 Party_AdjustCoins(s32 amount)
Adds amount to the party's coins, kept between 0 and 999999, and returns the new total.
#define PARTY_DEFINE_ADJUST(name, field, max)
Each adds amount to a game state counter, kept between 0 and max, and returns the new value.
s32 Party_AddActiveOwner(s32 owner)
Adds character owner to the end of the party: sets its game flag and appends it to gGameState....
s32 Party_ListActiveOwners(s16 *owners)
Writes the party members to owners, ending with 0xff, and returns how many there are.
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u16 baseDefense
before equipment, Djinn, class and stages
u16 baseAttack
before equipment, Djinn, class and stages
u16 baseAgility
before equipment, Djinn, class and stages
u32 rewards
Copied from the enemy's definition, where it is 0 in every row.
u8 side
BATTLE_UNIT_ABSENT (0), BATTLE_UNIT_ENEMY (1) or BATTLE_UNIT_PARTY (2).
s16 maxPp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
s16 hpGauge
hp / maxHp in 0..0x4000; 1 while any HP remains
u8 name[0x0f]
The name, one byte a character, ending in 0.
s16 hp
current HP, 0 when downed
s16 ppGauge
pp / maxPp in 0..0x4000; 1 while any PP remains
u8 baseActionCount
Actions a round before equipment: the low four bits are read.
u8 baseHpRegen
HP regained each turn before equipment; 0 for a character.
u8 baseLuck
before equipment, Djinn and class
u8 classId
Who the unit is: a character's id (ISAAC to JENNA, below 8) or an enemy's id (BattleUnitSet).
struct BattleElementStats baseElement[4]
Power and resistance before equipment and stages: an enemy's from its element preset,...
s16 basePp
before equipment, Djinn and class (UnitCalc)
s16 maxHp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
u8 basePpRegen
PP regained each turn before equipment and lighthouses.
u8 classIndex
The character's class, worked out from its Djinn (Unit_UpdateClass); 0 marks an enemy,...
s16 baseHp
before equipment, Djinn and class (UnitCalc)
u8 level
1 to 99 for a character
u16 inventory[15]
Items held, one entry each: bits 15..11 quantity | 10 broken | 9 equipped | 8..0 item id (INVENTORY_*...
An enemy's definition: its level and stats, items, element preset, the actions it chooses from and it...
u16 items[4]
items the enemy carries, 0 for none
u32 rewards
0 in every row; copied to BattleUnit.rewards
u16 hp
The base stats BattleUnitSet copies into the unit.
u8 counts[4]
how many of each item it carries
u8 turns
actions a round (BattleUnit.baseActionCount)
The game's state: play time, coins, the scene and the leader's position, the active party and the opt...
u8 activeOwners[8]
the party in order
A summon: its name's message and the Djinn of each element it needs.
The party's Djinn recovery table as the summon list reads it: a mask of summons, bit n for summon n.
void UnitCalc(s32 owner)
Recomputes a unit's stats from its base stats, equipment, set Djinn, class and battle stat levels,...
struct BattleUnit * UnitGet(u32 owner)
Returns the unit record of owner: 0 to 7 are the playable characters in the game state,...
void * Djinn_GetRecoveryTable(s32 enemySide)
Returns the party's Djinn recovery bank (the standby Djinn and their turns to recover),...