Skip to Content
The Alchemy Project

src/game/game_classes.c

Element levels and classes. More…

Included by game.c.

Macros

NameDescription
#defineELEMENT_LEVEL_SCALE 10Element levels are counted in tenths: a Djinni set adds a whole level.
#defineELEMENT_LEVEL_MAX 15The highest whole element level, the last row of ElementPowerResistByLevel.

Functions

NameDescription
Sint32gmClassGetSeries (Sint32 primaryElement, Sint32 secondaryElement)Returns the class series of a character whose strongest element is primaryElement and second secondaryElement, from the ELEMENT_COUNT by ELEMENT_COUNT table.
Sint32gmUnitGetElementLevels (Sint32 unitId, const Uint8 *djinnHeld, Sint32 output[4])Writes each element level in tenths (ELEMENT_LEVEL_SCALE): an enemy's from its preset, a character's from the Djinn set on it plus its own bonus.
Sint32gmUnitGetElementLevel (Sint32 unitId, Sint32 element)Returns how strongly a unit is attuned to element, its whole element level (a tenth of what gmUnitGetElementLevels counts), and 0 for ELEMENT_NONE.
Sint32gmEnemyGetAttackElement (UNIT *unit)Returns the element an enemy attacks with, from its element preset.
UNREAD_RESULTgmUnitCalculateBaseElements (Sint32 unitId, BATTLE_ELEMENT_STATS *dest)Writes a unit's base Power and Resist in each element, from its element levels.
Sint32gmClassDetermine (Sint32 character, const Uint8 *djinn)Returns the class a character has with these Djinn (UNIT.djinnHeld): the series of its two strongest elements, and the last class of it whose requirements it meets.
CLASS_DEFINITION *gmClassGetDefinition (Sint32 classId)Returns class classId's definition: its series, element requirements, stat multipliers and the Psynergy it teaches by level.
voidgmUnitUpdateClass (Sint32 unitId)Works out a character's class again after its Djinn change, then its Psynergy list and its base elements.

Description

Element levels and classes. Part of game.c.

Macros in detail

ELEMENT_LEVEL_SCALE

#define ELEMENT_LEVEL_SCALE 10

Element levels are counted in tenths: a Djinni set adds a whole level.

Referenced by gmClassDetermine(), gmUnitCalculateBaseElements(), gmUnitGetElementLevel() and gmUnitGetElementLevels().

Definition at line 4 of file game_classes.c.

ELEMENT_LEVEL_MAX

#define ELEMENT_LEVEL_MAX 15

The highest whole element level, the last row of ElementPowerResistByLevel.

Referenced by gmUnitCalculateBaseElements().

Definition at line 6 of file game_classes.c.

Functions in detail

gmClassGetSeries

Sint32 gmClassGetSeries(Sint32 primaryElement, Sint32 secondaryElement)

Returns the class series of a character whose strongest element is primaryElement and second secondaryElement, from the ELEMENT_COUNT by ELEMENT_COUNT table.

References ClassSeriesByElements and Sint32.

Referenced by gmClassDetermine().

Definition at line 11 of file game_classes.c.

gmUnitGetElementLevels

Sint32 gmUnitGetElementLevels(Sint32 unitId, const Uint8 *djinnHeld, Sint32 output[4])

Writes each element level in tenths (ELEMENT_LEVEL_SCALE): an enemy's from its preset, a character's from the Djinn set on it plus its own bonus. djinnHeld is the unit's Djinn (UNIT.djinnHeld).

References EnemyElementPresetTable, gmCharacterGetDefinition(), gmEnemyGetDefinition() and Sint32.

Referenced by gmClassDetermine(), gmUnitCalculateBaseElements() and gmUnitGetElementLevel().

Definition at line 20 of file game_classes.c.

gmUnitGetElementLevel

Sint32 gmUnitGetElementLevel(Sint32 unitId, Sint32 element)

Returns how strongly a unit is attuned to element, its whole element level (a tenth of what gmUnitGetElementLevels counts), and 0 for ELEMENT_NONE.

References gmUnitGet(), gmUnitGetElementLevels() and Sint32.

Referenced by gmBattleRollEffectSuccess().

Definition at line 67 of file game_classes.c.

gmEnemyGetAttackElement

Sint32 gmEnemyGetAttackElement(UNIT *unit)

Returns the element an enemy attacks with, from its element preset.

References EnemyElementPresetTable, gmEnemyGetDefinition() and Sint32.

Referenced by gmUnitGetAttackElement().

Definition at line 82 of file game_classes.c.

gmUnitCalculateBaseElements

UNREAD_RESULT gmUnitCalculateBaseElements(Sint32 unitId, BATTLE_ELEMENT_STATS *dest)

Writes a unit's base Power and Resist in each element, from its element levels.

References ElementPowerResistByLevel, EnemyElementPresetTable, gmEnemyGetDefinition(), gmUnitGet(), gmUnitGetElementLevels() and Sint32.

Referenced by gmBattleUnitSet() and gmUnitUpdateClass().

Definition at line 94 of file game_classes.c.

gmClassDetermine

Sint32 gmClassDetermine(Sint32 character, const Uint8 *djinn)

Returns the class a character has with these Djinn (UNIT.djinnHeld): the series of its two strongest elements, and the last class of it whose requirements it meets.

References ClassDefinitionTable, gmClassGetSeries(), gmFlagGet(), gmUnitGetElementLevels() and Sint32.

Referenced by gmUnitUpdateClass().

Definition at line 140 of file game_classes.c.

gmClassGetDefinition

CLASS_DEFINITION *gmClassGetDefinition(Sint32 classId)

Returns class classId's definition: its series, element requirements, stat multipliers and the Psynergy it teaches by level.

References ClassDefinitionTable and Sint32.

Referenced by gmBattleAbilityIsWeakToEffect(), gmUnitCalculate() and gmUnitRefreshPsynergy().

Definition at line 213 of file game_classes.c.

gmUnitUpdateClass

void gmUnitUpdateClass(Sint32 unitId)

Works out a character's class again after its Djinn change, then its Psynergy list and its base elements.

References gmClassDetermine(), gmUnitCalculateBaseElements(), gmUnitGet(), gmUnitRefreshPsynergy() and Sint32.

Referenced by gmDjinnPutOnStandby(), gmDjinnSet(), gmInventorySnapshotRestore(), gmInventorySnapshotSave(), gmPartyEndChildhood(), gmPartyInitCharacters() and gmPartyStartChildhood().

Definition at line 220 of file game_classes.c.