Skip to Content
The Alchemy Project

include/battle/battle_unit.h

Unit, a party member's or enemy's battle state, with the elements, abilities and actions it uses.

Included by battle_effect_internal.h, screen_tables.c, battle_action_run.h, debug_parameter_set.h, character.h, game.h and main_routine_state.h.

Structures

NameDescription
structPSYNERGY_ENTRYAn entry in a unit's action list: the action's id (PSYNERGY_ABILITY_MASK) and marks for an action its class or an equipped item gave.
structBATTLE_ELEMENT_STATSA unit's elemental power and resistance in one element.
structABILITY_DEFINITIONAn ability's definition, a row of AbilityDefinitions: its targeting, ability kind, element, effect, range, PP cost and power.
structBATTLE_AI_STATEAn enemy's memory of its action choice (btAIChooseAction).
structUNITA unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and statuses.

Macros

NameDescription
#defineABILITY_RANGE_ALL 255ABILITY_DEFINITION.range of an ability that reaches every unit on the side, each as if aimed at.
#defineRANGE_ICON_ALL 11The range icon the Psynergy lists draw for ABILITY_RANGE_ALL, the last of the twelve; range n takes icon n - 1.
#defineABILITY_FORMULA_MASK 15The low four bits of ABILITY_DEFINITION.flags: the ability kind (enum ABILITY_FORMULA).
#defineCLASS_NONE 0UNIT.classId of an enemy, which has no class of its own.
#defineFIRST_ENEMY_UNIT 128Unit ids from 128 are the enemies'.
#defineALLY_MAX 7The last party unit id: ids 0 to 7, one for each character, ISAAC to PIERS.
#definePARTY_UNIT_COUNT (ALLY_MAX + 1)
#definePARTY_BATTLE_SIZE 4The party fights four at a time, three in a link battle; six enemies at most, three in a link battle.
#defineENEMY_BATTLE_SIZE 6
#defineUNIT_MAX (PARTY_UNIT_COUNT + ENEMY_BATTLE_SIZE)The most units in a battle, every party unit and the most enemies: the length of a unit list such as btUnitListIds fills.
#defineUNIT_GAUGE_SHIFT 14A full HP or PP gauge (UNIT.hpGauge, UNIT.ppGauge): the gauge is the current value over the maximum in 2.14 fixed point, as gmUnitCalculate multiplies a maximum by it and divides by this, and the cap gmUnitClampGauge puts on hp / hpMax shifted up UNIT_GAUGE_SHIFT bits.
#defineUNIT_GAUGE_FULL (1 << UNIT_GAUGE_SHIFT)
#defineUNIT_ACTION_COUNT_MASK 0xfThe bits of UNIT.baseActionCount that count the unit's actions a turn.
#defineRESISTANCE_PER_STAGE 20What a Resistance stage adds to the resistance to every element (gmUnitCalculate).
#definePOISON_NORMAL 1UNIT.poison: the poison takes a tenth of the maximum HP at the end of each of the unit's actions, deadly poison a fifth.
#definePOISON_VENOM 2
#defineDEFEND_NORMAL 1UNIT.defendLevel, 0 for no Defend: Defend and Granite halve the damage, Total Defense and Flash cut it to a tenth (REDUCE_BY_GUARD, battle_ability.c).
#defineDEFEND_TOTAL 2
#defineUNIT_LEVEL_MAX 99The caps on a unit's level and stats.
#defineUNIT_HP_MAX 9999Maximum HP and PP, an enemy's.
#defineUNIT_CHARACTER_HP_MAX 1999Maximum HP and PP, a character's.
#defineUNIT_STAT_MAX 999Attack, Defense and Agility.
#defineUNIT_LUCK_MAX 99
#defineUNIT_ELEMENT_MAX 200Elemental power and resistance.
#defineUNIT_HP_REGEN_MAX 10000
#defineUNIT_PP_REGEN_MAX 200
#definePSYNERGY_SLOTS 32How many actions a unit's list holds (UNIT.psynergy).
#defineUNIT_NAME_SIZE 15A unit's name buffer: 14 characters and the 0 that ends them.
#defineUNIT_UPDATE_GAUGES (unit)Recalculates HP and PP gauges, keeping at least one when any points remain.

Enumerations

NameDescription
enumanonymous enum { ABILITY_DEFINITION_SIZE, BATTLE_UNIT_SIZE, PSYNERGY_ABILITY_ … }The sizes the STATIC_ASSERTs below hold the structs to, and the action id's bits in an action list entry.
enumELEMENT { ELEMENT_VENUS, ELEMENT_MERCURY, ELEMENT_MARS, ELEMENT_JUPITE … }The elements, in the order of every table kept per element: a unit's element stats, the Djinn and the summons.
enumABILITY_FORMULA { ABILITY_FORMULA_BLANK, ABILITY_FORMULA_HEAL_HP, ABILITY_FORM … }An ability kind picks what the ability's power does to each target: the formula btAbilityApplyToTarget puts it through.
enumABILITY_EFFECT { ABILITY_EFFECT_NONE, ABILITY_EFFECT_RESTORE_HP, ABILITY_EFFE … }ABILITY_DEFINITION.effect: what an ability does besides its damage or healing, applied by btAbilityApplyToTarget unless noted.
enumABILITY_TARGET { ABILITY_TARGET_ONE, ABILITY_TARGET_FOES, ABILITY_TARGET_ALLI … }ABILITY_DEFINITION.targetMode: whom an ability may target, from its user's view.
enumCURSE_FLAG { CURSE_BOUND, CURSE_ITEM, CURSE_KEEP_BOUND, CURSE_REMOVABLE }UNIT.curse bits, the curse.
enumABILITY_USE { ABILITY_USABLE_IN_FIELD, ABILITY_USABLE_IN_BATTLE }ABILITY_DEFINITION.flags: where an ability, or the ability an item calls, can be used, as the Status screen's Psynergy list says ("Can be used in Towns/Dungeons", "Can be used in Battle").

Functions

NameDescription
static __inline__ Sint32gmUnitClampGauge (Sint32 ratio)Clamps a gauge ratio to 0..UNIT_GAUGE_FULL.

Description

Unit, a party member's or enemy's battle state, with the elements, abilities and actions it uses.

Macros in detail

ABILITY_RANGE_ALL

#define ABILITY_RANGE_ALL 255

ABILITY_DEFINITION.range of an ability that reaches every unit on the side, each as if aimed at.

Referenced by AbilityDefinitions, btAbilityApplyToTarget(), mnAbilityApplyToTargets(), mnBattleDjinnMenuShowChangePreview(), mnBattlePsynergyMenuRun(), mnBattleTargetRunSelection(), mnItemClassifyUseMode(), mnPsynergyMenuClassifySelectedPsynergy() and mnStatusScreenDrawPsynergyPage().

Definition at line 53 of file battle_unit.h.

RANGE_ICON_ALL

#define RANGE_ICON_ALL 11

The range icon the Psynergy lists draw for ABILITY_RANGE_ALL, the last of the twelve; range n takes icon n - 1.

Referenced by mnBattleDjinnMenuShowChangePreview(), mnBattlePsynergyMenuRun() and mnStatusScreenDrawPsynergyPage().

Definition at line 56 of file battle_unit.h.

ABILITY_FORMULA_MASK

#define ABILITY_FORMULA_MASK 15

The low four bits of ABILITY_DEFINITION.flags: the ability kind (enum ABILITY_FORMULA).

Referenced by btAbilityApplyToTarget(), btActionRunBuild(), btAIChooseTarget(), mnAbilityApplyToTargets(), mnAbilityPlayUseSound() and mnBattleClassifyEntryKind().

Definition at line 60 of file battle_unit.h.

CLASS_NONE

#define CLASS_NONE 0

UNIT.classId of an enemy, which has no class of its own.

Referenced by btActionRunBuild(), btAIChooseAction(), btEnemyRecordDefeat(), btEnemyReleaseNameLetter(), btEnemySpriteLoadIntoSlots(), btObjectMake(), btStagingDispatchAction(), gmBattleAbilityIsWeakToEffect(), gmBattleUnitSet(), gmClassDetermine(), gmEquipmentRollUnleash(), gmUnitCalculate(), gmUnitCalculateBaseElements(), gmUnitGetAttackElement(), gmUnitGetExperienceForLevel() and gmUnitRefreshPsynergy().

Definition at line 288 of file battle_unit.h.

FIRST_ENEMY_UNIT

#define FIRST_ENEMY_UNIT 128

Unit ids from 128 are the enemies'.

Referenced by btAbilityReplaceDefeated(), btAppendLinkedActions(), btAutoBattleBuildActions(), btAutoBattleRunAttackOrItem(), btAutoBattleRunPsynergy(), btEffectReadKeysForEnemyTarget(), btEffectRunFlare(), btEffectShowLivingTargets(), btEnemyGetFreeUnitId(), btEnemyLetterFirstOfKind(), btEnemyList(), btFormationBuildEnemyList(), btLinkBattleReceiveParty(), btLinkBattleSendParty(), btObjectDestroyAll(), btObjectGet(), btObjectIsValidId(), btObjectSpawnObjectsForList(), btPartyAssignOpponentSlots(), btPlacementContainsId(), btRun(), btTransitionRun(), btUnitListLiving(), gmBattleUnitSet(), gmUnitGet(), scBattleArenaReceivePartyRecords() and scBattleArenaSendPartyRecords().

Definition at line 291 of file battle_unit.h.

ALLY_MAX

#define ALLY_MAX 7

The last party unit id: ids 0 to 7, one for each character, ISAAC to PIERS.

Referenced by btActionRunBuild(), btAIChooseAction(), btAIChooseTarget(), btAutoBattleApplyDamage(), btAutoBattleRunApproachAttack(), btAutoBattleRunAttackOrItem(), btAutoBattleRunPsynergy(), btDjinnCountStandby(), btDjinnRecoveryReconcile(), btEnemyRecordDefeat(), btFindUnitPlace(), btObjectDestroyAll(), btObjectGet(), btObjectIsValidId(), btObjectMake(), btObjectSpawnObjectsForList(), btPlacementContainsId(), btRun(), btStagingRunAttack(), btStagingRunFlee(), btStagingRunFullScreen(), btStagingRunItem(), btStagingRunPlainAttack(), btStagingRunPsynergyCast(), btTransitionRun(), btUnitIsListed(), btUnitProcessActionEnd(), fdExamineMetatile(), fdPartyCheckShortcut(), fdUsePsynergy(), gmPartyInitCharacters(), mnBattleDjinnMenuRun() and mnBattleTargetRunSelection().

Definition at line 294 of file battle_unit.h.

PARTY_UNIT_COUNT

#define PARTY_UNIT_COUNT (ALLY_MAX + 1)

Referenced by btEffectShowLivingTargets(), btLinkBattleSendParty(), btObjectDestroyAll(), btObjectGet(), btObjectSpawnObjectsForList(), btPlacementContainsId(), btTransitionRun() and gmItemCanUnitEquip().

Definition at line 295 of file battle_unit.h.

PARTY_BATTLE_SIZE

#define PARTY_BATTLE_SIZE 4

The party fights four at a time, three in a link battle; six enemies at most, three in a link battle.

Referenced by btAutoBattleBuildActions() and btPartyPrepareMembers().

Definition at line 299 of file battle_unit.h.

ENEMY_BATTLE_SIZE

#define ENEMY_BATTLE_SIZE 6

Referenced by btAbilityApplyToTarget(), btEffectRunAtalanta(), btEffectShowLivingTargets(), btEnemyGetFreeUnitId(), btEnemyLetterFirstOfKind(), btEnemyList(), btEnemyRecordDefeat(), btFormationBuildEnemyList(), btObjectIsValidId(), btPlacementRelayoutEnemies(), btUnitListLiving(), btUnitRefreshPlacement(), gmBattleUnitSet() and gmUnitGet().

Definition at line 300 of file battle_unit.h.

UNIT_MAX

#define UNIT_MAX (PARTY_UNIT_COUNT + ENEMY_BATTLE_SIZE)

The most units in a battle, every party unit and the most enemies: the length of a unit list such as btUnitListIds fills.

Referenced by btAbilityReplaceDefeated(), btAutoBattleBuildActions(), btAutoBattleRunPsynergy(), btBuildEnemyActions(), btEffectShowLivingTargets(), btFleeCheckSuccess(), btFleePlayRun(), btFormationBuildEnemyList(), btHighlightClearAllSpriteModes(), btHighlightSetModes(), btHighlightSetOtherSpriteModes(), btObjectDestroyAll(), btObjectPut(), btObjectPutKeepingPoses(), btObjectSpawnObjectsForList(), btObjectUpdateSpritePriorities(), btPlacementContainsId(), btPlacementRelayoutEnemies(), btProcessTurnEnd(), btStagingDispatchAction(), btStagingRunFlee(), btStagingRunFullScreen(), btTransitionRun(), btUnitCollect(), btUnitRefreshPlacement(), btUnitResetGuardLevels(), fdActorUpdateAllMotion() and mnBattleTargetRunSelection().

Definition at line 304 of file battle_unit.h.

UNIT_GAUGE_SHIFT

#define UNIT_GAUGE_SHIFT 14

A full HP or PP gauge (UNIT.hpGauge, UNIT.ppGauge): the gauge is the current value over the maximum in 2.14 fixed point, as gmUnitCalculate multiplies a maximum by it and divides by this, and the cap gmUnitClampGauge puts on hp / hpMax shifted up UNIT_GAUGE_SHIFT bits.

Definition at line 310 of file battle_unit.h.

UNIT_GAUGE_FULL

#define UNIT_GAUGE_FULL (1 << UNIT_GAUGE_SHIFT)

Referenced by gmBattleUnitSet(), gmPartyInitCharacters(), gmUnitCalculate() and gmUnitClampGauge().

Definition at line 311 of file battle_unit.h.

UNIT_ACTION_COUNT_MASK

#define UNIT_ACTION_COUNT_MASK 0xf

The bits of UNIT.baseActionCount that count the unit's actions a turn.

Referenced by gmUnitCalculate().

Definition at line 314 of file battle_unit.h.

RESISTANCE_PER_STAGE

#define RESISTANCE_PER_STAGE 20

What a Resistance stage adds to the resistance to every element (gmUnitCalculate).

Referenced by btAbilityApplyToTarget(), gmUnitCalculate() and mnBattleStatusScreenRun().

Definition at line 318 of file battle_unit.h.

POISON_NORMAL

#define POISON_NORMAL 1

UNIT.poison: the poison takes a tenth of the maximum HP at the end of each of the unit's actions, deadly poison a fifth.

Referenced by btAbilityApplyToTarget(), btUnitBuildStatusFlags(), dbMenuTestDamageAndAfflictParty(), fdPartyApplyPoisonDamage() and mnShopOpenDebugShop().

Definition at line 322 of file battle_unit.h.

POISON_VENOM

#define POISON_VENOM 2

Referenced by btAbilityApplyToTarget(), btUnitBuildStatusFlags(), dbMenuTestDamageAndAfflictParty() and fdPartyApplyPoisonDamage().

Definition at line 323 of file battle_unit.h.

DEFEND_NORMAL

#define DEFEND_NORMAL 1

UNIT.defendLevel, 0 for no Defend: Defend and Granite halve the damage, Total Defense and Flash cut it to a tenth (REDUCE_BY_GUARD, battle_ability.c). It lasts the turn: btUnitResetGuardLevels clears it as the next one's commands are gathered.

Referenced by btAbilityApplyToTarget(), btActionRunBuild() and btGatherActions().

Definition at line 329 of file battle_unit.h.

DEFEND_TOTAL

#define DEFEND_TOTAL 2

Referenced by btAbilityApplyToTarget() and btGatherActions().

Definition at line 330 of file battle_unit.h.

UNIT_LEVEL_MAX

#define UNIT_LEVEL_MAX 99

The caps on a unit's level and stats.

Referenced by btFormationSelectLevelMatchedCandidate(), gmUnitGetExperienceForLevel(), gmUnitLevelUp(), mnBattleStatusScreenRun(), mnStatusScreenShowMemberProgressMessage() and scFileScreenPackPasswordData().

Definition at line 333 of file battle_unit.h.

UNIT_HP_MAX

#define UNIT_HP_MAX 9999

Maximum HP and PP, an enemy's.

Referenced by btEnemyAdjustLevel() and gmUnitCalculate().

Definition at line 335 of file battle_unit.h.

UNIT_CHARACTER_HP_MAX

#define UNIT_CHARACTER_HP_MAX 1999

Maximum HP and PP, a character's.

Referenced by gmUnitCalculate() and scFileScreenPackPasswordData().

Definition at line 337 of file battle_unit.h.

UNIT_STAT_MAX

#define UNIT_STAT_MAX 999

Attack, Defense and Agility.

Referenced by btEnemyAdjustLevel(), gmUnitCalculate() and scFileScreenPackPasswordData().

Definition at line 339 of file battle_unit.h.

UNIT_LUCK_MAX

#define UNIT_LUCK_MAX 99

Referenced by gmUnitCalculate() and scFileScreenPackPasswordData().

Definition at line 340 of file battle_unit.h.

UNIT_ELEMENT_MAX

#define UNIT_ELEMENT_MAX 200

Elemental power and resistance.

Referenced by btEnemyAdjustLevel() and gmUnitCalculate().

Definition at line 342 of file battle_unit.h.

UNIT_HP_REGEN_MAX

#define UNIT_HP_REGEN_MAX 10000

Referenced by gmUnitCalculate().

Definition at line 343 of file battle_unit.h.

UNIT_PP_REGEN_MAX

#define UNIT_PP_REGEN_MAX 200

Referenced by gmUnitCalculate().

Definition at line 344 of file battle_unit.h.

PSYNERGY_SLOTS

#define PSYNERGY_SLOTS 32

How many actions a unit's list holds (UNIT.psynergy).

Referenced by btAwardSpoils(), btDebugParamSetLoad(), gmUnitKnowsPsynergy(), gmUnitLearnPsynergy(), gmUnitRefreshPsynergy(), mnBattleCollectPartyCommands(), mnBattleDjinnMenuListChangedAbilities(), mnPsynergyListDifference(), mnPsynergyMenuCollectActions(), mnPsynergyMenuDrawPsynergyIcons() and mnStatusPanelDraw().

Definition at line 347 of file battle_unit.h.

UNIT_NAME_SIZE

#define UNIT_NAME_SIZE 15

A unit's name buffer: 14 characters and the 0 that ends them.

Referenced by btEnemyLetterFirstOfKind(), btEnemyReleaseNameLetter(), gmBattleUnitSet(), gmPartyInitCharacters(), mnBattleTargetRunSelection() and scBattleArenaReceivePartyRecords().

Definition at line 359 of file battle_unit.h.

UNIT_UPDATE_GAUGES

#define UNIT_UPDATE_GAUGES(unit)

Recalculates HP and PP gauges, keeping at least one when any points remain.

Referenced by fdEngineRun(), fdPartyRemoveMemberRestored(), gmPartyEndChildhood(), gmPartyRestoreHpPp(), gmPartyRestorePpInLighthouse(), gmReturnFromEngine(), gmUnitRecalculateGauges() and scColossoControlCharacterAlone().

Definition at line 615 of file battle_unit.h.

Enumerations in detail

anonymous enum

enum { ABILITY_DEFINITION_SIZE, BATTLE_UNIT_SIZE, PSYNERGY_ABILITY_MASK }

The sizes the STATIC_ASSERTs below hold the structs to, and the action id's bits in an action list entry.

EnumeratorValueDescription
ABILITY_DEFINITION_SIZE16bytes in an ABILITY_DEFINITION
BATTLE_UNIT_SIZE332Bytes in a UNIT, which the code clears and copies whole
PSYNERGY_ABILITY_MASK0x3fffPSYNERGY_ENTRY.encodedAction's action id

Definition at line 13 of file battle_unit.h.

ELEMENT

enum ELEMENT

The elements, in the order of every table kept per element: a unit's element stats, the Djinn and the summons. ELEMENT_NONE marks an ability or a weapon that has no element.

EnumeratorValueDescription
ELEMENT_VENUS
ELEMENT_MERCURY
ELEMENT_MARS
ELEMENT_JUPITER
ELEMENT_NONE
ELEMENT_COUNTELEMENT_NONE

Definition at line 41 of file battle_unit.h.

ABILITY_FORMULA

enum ABILITY_FORMULA

An ability kind picks what the ability's power does to each target: the formula btAbilityApplyToTarget puts it through. ABILITY_FORMULA_BLANK, ABILITY_FORMULA_EFFECT_ONLY and ABILITY_FORMULA_NO_POWER apply no power. No row has a kind above ABILITY_FORMULA_HEAL_PP, which would apply none either.

EnumeratorValueDescription
ABILITY_FORMULA_BLANK0Only the blank rows no table uses.
ABILITY_FORMULA_HEAL_HP1Cure, Fizz, healing items.
ABILITY_FORMULA_EFFECT2Damage only if the effect lands.
ABILITY_FORMULA_ATTACK3Attack vs Defense, plus the power.
ABILITY_FORMULA_ATTACK_MULTIPLIED4That attack times power / 10.
ABILITY_FORMULA_DAMAGE5HP damage from the power (Psynergy).
ABILITY_FORMULA_ENEMY_DAMAGE6HP damage from enemies' moves such as Fire Blessing and Deadly Gas, falling off faster than Psynergy's (RangeFalloffEnemyDamage). Unless the move has wording of its own, it's announced as <unit> unleashes <ability>!. A weapon's unleash is something else: ABILITY_FORMULA_ATTACK, or for Rapid Smash ABILITY_FORMULA_ATTACK_MULTIPLIED.
ABILITY_FORMULA_EFFECT_ONLY7Granite, Flash and Kite, whose effect is all they do.
ABILITY_FORMULA_SUMMON8Summon damage falls off faster than Psynergy's (RangeFalloffSummonDamage). Called with the Summon command, a summon also adds 3% of the target's maximum HP to its power for each Djinni it spends; the Fusion Dragon's Outer Space and Dragon Driver go without that bonus.
ABILITY_FORMULA_NO_POWER9The field Psynergy (Move, Catch...), the field-only stat items (Apple, Power Bread...), Defend, Flee and the enemies' commands (Threaten, Ally Search...). The enemies' targeting check (CHECK_EFFECT_TARGET) treats it as a summon: worth it on a living unit only when the power is nonzero.
ABILITY_FORMULA_PP_DAMAGE10Crazy Voice, and Psy Drain when it lands.
ABILITY_FORMULA_HEAL_PP11Ember, Psy Crystal, Adept Ring.

Definition at line 66 of file battle_unit.h.

ABILITY_EFFECT

enum ABILITY_EFFECT

ABILITY_DEFINITION.effect: what an ability does besides its damage or healing, applied by btAbilityApplyToTarget unless noted. Each is named for the abilities that have it (ability_table.c, with their English names and descriptions). ABILITY_EFFECT_SIDESTEP and ABILITY_EFFECT_CRAZY_VOICE are read by no code here, and no row has ABILITY_EFFECT_RESTORE_HP or ABILITY_EFFECT_RESTORE_PP. A stat change whose name ends in _SHARPLY moves its stat two stages, one without moves it one.

ABILITY_EFFECT_CRITICAL_1_IN_* are chances of an ability's critical hit, rolled by btActionRunBuild at the odds each name gives. Only an attack (ABILITY_FORMULA_ATTACK or ABILITY_FORMULA_ATTACK_MULTIPLIED) applies it, and no ability has one.

ABILITY_EFFECT_DOUBLE_BLOW_* and ABILITY_EFFECT_TRIPLE_BLOW_* are chances of a double or triple blow, rolled by btActionRunBuild: the plain one 1 in 4, the rare one (which no ability has) 1 in 8, and the likely one 153 in 256.

EnumeratorValueDescription
ABILITY_EFFECT_NONE0
ABILITY_EFFECT_RESTORE_HP1restores HP (the item menu's use)
ABILITY_EFFECT_RESTORE_PP2restores PP (the item menu's use)
ABILITY_EFFECT_CURE_POISON3Cure Poison, Antidote
ABILITY_EFFECT_RESTORE4Restore, Elixir
ABILITY_EFFECT_REVIVE5Revive, Water of Life: full HP
ABILITY_EFFECT_ATTACK_UP_SHARPLY6Impact
ABILITY_EFFECT_ATTACK_UP7High Impact
ABILITY_EFFECT_ATTACK_DOWN_SHARPLY8Dull
ABILITY_EFFECT_ATTACK_DOWN9Blunt
ABILITY_EFFECT_DEFENSE_UP_SHARPLY10Guard
ABILITY_EFFECT_DEFENSE_UP11Protect
ABILITY_EFFECT_DEFENSE_DOWN_SHARPLY12Impair
ABILITY_EFFECT_DEFENSE_DOWN13Debilitate
ABILITY_EFFECT_RESISTANCE_UP_SHARPLY14Ward
ABILITY_EFFECT_RESISTANCE_UP15Resist
ABILITY_EFFECT_RESISTANCE_DOWN_SHARPLY16Weaken
ABILITY_EFFECT_RESISTANCE_DOWN17Enfeeble
ABILITY_EFFECT_POISON18Taint
ABILITY_EFFECT_VENOM19Poison
ABILITY_EFFECT_DELUSION20Delude
ABILITY_EFFECT_CONFUSION21Confuse
ABILITY_EFFECT_CHARM22
ABILITY_EFFECT_STUN23Paralyze
ABILITY_EFFECT_SLEEP24
ABILITY_EFFECT_SEAL25Bind: Psynergy sealed
ABILITY_EFFECT_HAUNT26
ABILITY_EFFECT_INSTANT_DEATH27Condemn
ABILITY_EFFECT_CURSE28Curse: the Grim Reaper's
ABILITY_EFFECT_REGENERATE29countdown
ABILITY_EFFECT_REFLECT30
ABILITY_EFFECT_DRAIN_HP31
ABILITY_EFFECT_DRAIN_PP32Psy Drain
ABILITY_EFFECT_BREAK33Break: raised stats undone
ABILITY_EFFECT_LEAVE_ONE_HP34Severe Blow, Thrash
ABILITY_EFFECT_HALVE_DEFENSE35Torch
ABILITY_EFFECT_CRITICAL_1_IN_6436
ABILITY_EFFECT_CRITICAL_1_IN_3237
ABILITY_EFFECT_CRITICAL_1_IN_1638
ABILITY_EFFECT_CRITICAL_1_IN_839
ABILITY_EFFECT_CRITICAL_1_IN_440
ABILITY_EFFECT_DOUBLE_BLOW_RARE41
ABILITY_EFFECT_DOUBLE_BLOW42Double Fang, Twin Beaks,
ABILITY_EFFECT_TRIPLE_BLOW_RARE43Flying Attack
ABILITY_EFFECT_TRIPLE_BLOW44Swift Strike
ABILITY_EFFECT_THREATEN45Contain, Threaten, Tremble
ABILITY_EFFECT_DEFEND46Defend, Granite
ABILITY_EFFECT_TOTAL_DEFENSE47Total Defense, Flash
ABILITY_EFFECT_SIDESTEP48
ABILITY_EFFECT_FLEE49Flee: an enemy's becomes COMMAND_FLEE
ABILITY_EFFECT_CALL_ALLY50Ally Search, Speed Surge
ABILITY_EFFECT_CALL_HELP51Search for Help
ABILITY_EFFECT_CRAZY_VOICE52
ABILITY_EFFECT_GROUND53Ground, War Cry, Wicked Howl
ABILITY_EFFECT_CHALLENGE54no ability has it
ABILITY_EFFECT_SELF_DESTRUCT55Dynamite, Mortal Blow
ABILITY_EFFECT_REVIVE_HALF56Quartz
ABILITY_EFFECT_DEW57Dew: revives with 80% of max HP
ABILITY_EFFECT_AGILITY_DOWN58Vine
ABILITY_EFFECT_AGILITY_UP59Zephyr
ABILITY_EFFECT_DRAIN_HALF_HP60Sap
ABILITY_EFFECT_FIZZ61Fizz: 60% of max HP
ABILITY_EFFECT_SPRITZ62Spritz: 30% of max HP
ABILITY_EFFECT_EMBER63Ember: 7% of max PP
ABILITY_EFFECT_CURE_ALL64Tonic
ABILITY_EFFECT_DOUBLE_BLOW_LIKELY65Gust, Rapid Smash, Slice
ABILITY_EFFECT_ACT_TWICE66Kite
ABILITY_EFFECT_SEAL_2_TURNS67Luff
ABILITY_EFFECT_TRIPLE_BLOW_LIKELY68Sonic Smash
ABILITY_EFFECT_PSY_LEECH69

Definition at line 129 of file battle_unit.h.

ABILITY_TARGET

enum ABILITY_TARGET

ABILITY_DEFINITION.targetMode: whom an ability may target, from its user's view. The party's cursor (mnBattleTargetRunSelection) shows the enemies for every mode but ABILITY_TARGET_ALLIES and ABILITY_TARGET_SELF. No row of ability_table.c has a mode above ABILITY_TARGET_SELF; btActionRunSetTargets would walk such a mode's range as it does ABILITY_TARGET_FOES'.

EnumeratorValueDescription
ABILITY_TARGET_ONE0The ability takes one target, the aimed unit,
ABILITY_TARGET_FOES1whatever its range (btActionRunSetTargets), and an enemy aims it at itself. The field Psynergy and enemies' commands such as Threaten, Ally Search and Flee have it.
ABILITY_TARGET_ALLIES2The user's side, the user included.
ABILITY_TARGET_UNUSED3Unused: no ability has it. An enemy that draws it aims at itself and picks again (btAIChooseAction); the party's cursor and btActionRunSetTargets take it as ABILITY_TARGET_FOES.
ABILITY_TARGET_SELF4The user alone, whatever the range.

Definition at line 215 of file battle_unit.h.

CURSE_FLAG

enum CURSE_FLAG

UNIT.curse bits, the curse.

EnumeratorValueDescription
CURSE_BOUND0x01The unit is bound.
CURSE_ITEM0x02A cursed item is equipped.
CURSE_KEEP_BOUND0x04Keeps CURSE_BOUND through gmUnitCalculate.
CURSE_REMOVABLE0x08EQUIP_EFFECT_CURSE_REMOVABLE: gmUnitCalculate clears it again with CURSE_BOUND.

Definition at line 234 of file battle_unit.h.

ABILITY_USE

enum ABILITY_USE

ABILITY_DEFINITION.flags: where an ability, or the ability an item calls, can be used, as the Status screen's Psynergy list says ("Can be used in Towns/Dungeons", "Can be used in Battle").

EnumeratorValueDescription
ABILITY_USABLE_IN_FIELD0x40can be used outside battle
ABILITY_USABLE_IN_BATTLE0x80can be used in battle; else greyed there

Definition at line 281 of file battle_unit.h.

Functions in detail

gmUnitClampGauge

static __inline__ Sint32 gmUnitClampGauge(Sint32 ratio)

Clamps a gauge ratio to 0..UNIT_GAUGE_FULL.

References Sint32.

Definition at line 601 of file battle_unit.h.