src/game/game_classes.c
A unit's level in each element, the elemental power and resistance those levels give it, and the class a character's Djinn and items make it. More…
Included by game.c.
Macros
| Name | Description | |
|---|---|---|
#define | ELEMENT_LEVEL_SCALE 10 | Element levels are counted in tenths: a Djinni set adds a whole level. |
#define | ELEMENT_LEVEL_MAX 15 | The highest whole element level, the last row of ElementPowerResistByLevel. |
Functions
| Name | Description | |
|---|---|---|
Sint32 | gmUnitGetElementLevels (Sint32 characterOrEnemy, const Uint8 *djinn, Sint32 output[ELEMENT_COUNT]) | Writes each element level in tenths (ELEMENT_LEVEL_SCALE) for a character or an enemy, by its id: an enemy's from its preset, a character's from the Djinn set on it plus its own bonus. |
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. |
Sint32 | gmEnemyGetAttackElement (UNIT *unit) | Returns the element an enemy attacks with, from its element preset; an id past the table's end reads the first preset. |
void | gmUnitCalculateBaseElements (Sint32 unitId, BATTLE_ELEMENT_STATS *dest) | Writes a unit's base power and resistance in each element: an enemy's from its preset, a character's from its element levels. |
Sint32 | gmClassDetermine (Sint32 character, Uint32 *djinn, Sint32 item) | Returns the class a character has with these Djinn: the series of its two strongest elements, or the one its class-changing item (Mysterious Card, Trainer's Whip, Tomegathericon) picks, and the last class of that series whose element 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. |
void | gmUnitUpdateClass (Sint32 unitId) | Works out a character's class again after its Djinn or its class-changing item change, then its Psynergy list and its base elements. |
void | gmUnitRefreshPsynergy (Sint32 unitId) | Works out a character's class, Psynergy and base elements again. |
Description
A unit's level in each element, the elemental power and resistance those
levels give it, and the class a character's Djinn and items make it. 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 6 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 8 of file game_classes.c.
Functions in detail
gmUnitGetElementLevels
Sint32 gmUnitGetElementLevels(Sint32 characterOrEnemy, const Uint8 *djinn, Sint32 output[ELEMENT_COUNT])
Writes each element level in tenths (ELEMENT_LEVEL_SCALE) for a character or
an enemy, by its id: an enemy's from its preset, a character's from the Djinn
set on it plus its own bonus. djinn points at the unit's Djinn bits
(djinnHeld); the counts of set Djinn by element follow them in the unit.
References EnemyElementPresetTable, gmCharacterGetDefinition(), gmEnemyGetDefinition() and Sint32.
Referenced by gmClassDetermine(), gmUnitCalculateBaseElements() and gmUnitGetElementLevel().
Definition at line 14 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(), result and Sint32.
Referenced by gmBattleRollEffectSuccess().
Definition at line 55 of file game_classes.c.
gmEnemyGetAttackElement
Sint32 gmEnemyGetAttackElement(UNIT *unit)
Returns the element an enemy attacks with, from its element preset; an id past the table's end reads the first preset.
References EnemyElementPresetTable, gmEnemyGetDefinition() and Sint32.
Referenced by gmUnitGetAttackElement().
Definition at line 72 of file game_classes.c.
gmUnitCalculateBaseElements
void gmUnitCalculateBaseElements(Sint32 unitId, BATTLE_ELEMENT_STATS *dest)
Writes a unit's base power and resistance in each element: an enemy's from its preset, a character's from its element levels.
References ElementPowerResistByLevel, EnemyElementPresetTable, gmEnemyGetDefinition(), gmUnitGet(), gmUnitGetElementLevels(), Sint32 and syMathUnsignedMultiplyHigh().
Referenced by gmBattleUnitSet() and gmUnitUpdateClass().
Definition at line 83 of file game_classes.c.
gmClassDetermine
Sint32 gmClassDetermine(Sint32 character, Uint32 *djinn, Sint32 item)
Returns the class a character has with these Djinn: the series of its two strongest elements, or the one its class-changing item (Mysterious Card, Trainer's Whip, Tomegathericon) picks, and the last class of that series whose element requirements it meets.
References ClassDefinitionTable, ClassSeriesByElements, gmUnitGetElementLevels(), result and Sint32.
Referenced by gmUnitUpdateClass().
Definition at line 148 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 gmUnitRebuildPsynergyList().
Definition at line 232 of file game_classes.c.
gmUnitUpdateClass
void gmUnitUpdateClass(Sint32 unitId)
Works out a character's class again after its Djinn or its class-changing item change, then its Psynergy list and its base elements.
References gmClassDetermine(), gmInventoryGetEquippedItem(), gmUnitCalculateBaseElements(), gmUnitGet(), gmUnitRebuildPsynergyList() and Sint32.
Referenced by gmDjinnPutOnStandby(), gmDjinnSet(), gmInventorySnapshotRestore(), gmInventorySnapshotSave(), gmPartyInitCharacters(), gmUnitRefreshPsynergy() and scClearApplyImportedData().
Definition at line 239 of file game_classes.c.
gmUnitRefreshPsynergy
void gmUnitRefreshPsynergy(Sint32 unitId)
Works out a character's class, Psynergy and base elements again.
References gmUnitUpdateClass() and Sint32.
Referenced by gmInventoryEquip(), gmUnitLearnPsynergy(), gmUnitLevelUp() and scDailaRoomsGiveItem().
Definition at line 252 of file game_classes.c.