Skip to Content
The Alchemy Project

include/battle/battle_unit.h

UNIT, a party member's or an enemy's stats and statuses in battle, with the elements, abilities and actions it uses.

Included by battle_internal.h, scripted_battle_units.c, battle_effect_internal.h, level.c, field_engine_internal.h, main_routine.c, menu_internal.h, shop_internal.h, window_internal.h, battle_action_run.h, battle_effect.h, character.h and game.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, 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.
structBATTLE_BASE_STATSA unit's base stats from UNIT.baseHp on, as one block: an enemy's level or strength change keeps a copy to hold each new stat to 70 percent of the old (btEnemyAdjustLevel, btUnitStrengthen), and the Clear Data password writes its members' stats through it.

Macros

NameDescription
#defineNAME_LETTER_ALPHABET 26The letters A to Z, which the Japanese edition gives enemies as name suffixes.
#defineNAME_SUFFIX_COUNT JAPANESE_OR(NAME_LETTER_ALPHABET, 9)The name suffixes that tell enemies of one kind apart, one more character after the name (gmBattleUnitSet): the alphabet in Japanese, the digits 1 to 9 elsewhere, as btStringFindFirstDigit reads them back.
#defineABILITY_RANGE_ALL 255ABILITY_DEFINITION.range of an ability that reaches every unit on the side, each as if aimed at.
#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.
#defineALLY_MAX 7The last party unit id: ids 0 to 7, one for each character, ISAAC to PIERS.
#definePARTY_UNIT_COUNT (ALLY_MAX + 1)How many party units there are, one for each character.
#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.
#definePOISON_NORMAL 1UNIT.poison: poisoned, or deadly poisoned.
#definePOISON_VENOM 2
#defineDEFEND_NORMAL 1UNIT.defendLevel, 0 for no guard: each guard effect raises it to its own level and no lower (btAbilityApplyToTarget).
#defineDEFEND_SHIELD 2
#defineDEFEND_TOTAL 3
#defineDEFEND_VANISHED 4
#defineFIRST_ENEMY_UNIT 128Unit ids from 128 are the enemies'.
#defineUNIT_ID_ENEMY_BIT FIRST_ENEMY_UNITThe bit set in every enemy's unit id (FIRST_ENEMY_UNIT and up), and so the side a unit fights on.
#definePSYNERGY_SLOTS 32How many actions a unit's list holds (UNIT.psynergy).
#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, 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.
#defineUNIT_NAME_SIZE 15A unit's name buffer: 14 characters and the 0 that ends them.
#defineRESISTANCE_PER_STAGE 20The Resistance each of a unit's battle Resistance stages (UNIT.resistanceStage) adds to every element's.
#definePSY_SEAL_BIND_MASK 7UNIT.psySeal's layout: its low three bits Bind's turns left, the seal Bind casts (seven turns, which may end sooner); above them Luff's, cast as PSY_SEAL_LUFF and losing PSY_SEAL_LUFF_TURN a turn, so it lasts two and never ends early.
#definePSY_SEAL_BIND 7
#definePSY_SEAL_LUFF 16
#definePSY_SEAL_LUFF_TURN 8
#defineUNIT_UPDATE_GAUGES (unit)Recalculates HP and PP gauges, keeping at least one when any points remain.

Enumerations

NameDescription
enumanonymous enum { BATTLE_UNIT_SIZE }Bytes in a UNIT, which the code clears and copies whole: the size the STATIC_ASSERTs below hold it to.
enumanonymous enum { PSYNERGY_ABILITY_MASK, PSYNERGY_FROM_ITEM, PSYNERGY_FROM_CLA … }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; ABILITY_FORMULA_BLANK, ABILITY_FORMULA_EFFECT_ONLY and ABILITY_FORMULA_NO_POWER apply none.
enumABILITY_USE { ABILITY_USABLE_IN_FIELD, ABILITY_USABLE_IN_BATTLE }ABILITY_DEFINITION.flags: where an ability can be used.
enumABILITY_TARGET { ABILITY_TARGET_ONE, ABILITY_TARGET_FOES, ABILITY_TARGET_ALLI … }ABILITY_DEFINITION.targetMode: whom an ability may target, from its user's view.
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.
enumCURSE_FLAG { CURSE_BOUND, CURSE_ITEM, CURSE_KEEP_BOUND, CURSE_REMOVABLE }The curse bits of UNIT.curse (updated by gmUnitCalculate).

Functions

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

Variables

NameDescription
extern UNITCharacterUnits [PARTY_UNIT_COUNT]The eight characters' units, ISAAC to PIERS, kept in the save.

Description

UNIT, a party member's or an enemy's stats and statuses in battle, with the elements, abilities and actions it uses.

Macros in detail

NAME_LETTER_ALPHABET

#define NAME_LETTER_ALPHABET 26

The letters A to Z, which the Japanese edition gives enemies as name suffixes.

Definition at line 13 of file battle_unit.h.

NAME_SUFFIX_COUNT

#define NAME_SUFFIX_COUNT JAPANESE_OR(NAME_LETTER_ALPHABET, 9)

The name suffixes that tell enemies of one kind apart, one more character after the name (gmBattleUnitSet): the alphabet in Japanese, the digits 1 to 9 elsewhere, as btStringFindFirstDigit reads them back.

Referenced by btEnemyClaimNameLetter() and gmBattleUnitSet().

Definition at line 17 of file battle_unit.h.

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(), btRun(), mnAbilityApplyToTargets(), mnBattleDjinnMenuShowChangePreview(), mnBattlePsynergyMenuRun(), mnBattleStatusScreenRun(), mnBattleTargetRunSelection(), mnItemClassifyUseMode(), mnPsynergyMenuClassifySelectedPsynergy() and mnStatusScreenDrawPsynergyPage().

Definition at line 70 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 74 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(), btEffectRunTwistingColumn(), btEnemyRecordDefeat(), btEnemyReleaseNameLetter(), btEnemySpriteLoadIntoSlots(), btObjectMake(), btStagingDispatchAction(), gmBattleAbilityIsWeakToEffect(), gmBattleRollEffectSuccess(), gmBattleUnitSet(), gmEquipmentRollUnleash(), gmUnitCalculate(), gmUnitCalculateBaseElements(), gmUnitGetAttackElement(), gmUnitGetExperienceForLevel() and gmUnitRebuildPsynergyList().

Definition at line 282 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(), btEffectRunAttackSlash(), btEffectRunCriticalHit(), btEnemyRecordDefeat(), btFindUnitPlace(), btMotionCallBeast(), btMotionDestroyAllSlotObjects(), btObjectFindSlot(), btObjectGet(), btObjectIsValidId(), btObjectMake(), btObjectSpawnObjectsForList(), btPlacementContainsId(), btRun(), btStagingDispatchAction(), btStagingPlanAuroraField(), btStagingPlanDaedalus(), btStagingPlanHighImpact(), btStagingRunAttack(), btStagingRunFlee(), btStagingRunFullScreen(), btStagingRunItem(), btStagingRunPsynergyCast(), btUnitDrainDjinn(), btUnitFindStrongestAlly(), btUnitIsListed(), btUnitProcessActionEnd(), fdPartyCheckShortcut(), fdUsePsynergy(), gmPartyInitCharacters(), mnBattleDjinnMenuRun(), mnBattleStatusScreenRun(), mnBattleTargetRunSelection() and scLinkLobbySendPartyRecords().

Definition at line 285 of file battle_unit.h.

PARTY_UNIT_COUNT

#define PARTY_UNIT_COUNT (ALLY_MAX + 1)

How many party units there are, one for each character.

Referenced by btMotionDestroyAllSlotObjects(), btObjectFindSlot(), btObjectGet(), btObjectSpawnObjectsForList(), btPlacementContainsId(), CharacterUnits, dbShopTestEditPartyNames(), scInit(), scLinkLobbyExplainPartyOrder() and scLinkLobbySendPartyRecords().

Definition at line 288 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(), btPartyPrepareMembers(), btPartyPrepareReserveOwners(), fdPartyIsInFrontRow() and scLinkLobbyPartyContains().

Definition at line 292 of file battle_unit.h.

ENEMY_BATTLE_SIZE

#define ENEMY_BATTLE_SIZE 6

Referenced by btAbilityApplyToTarget(), btEnemyGetFreeUnitId(), btEnemyLetterFirstOfKind(), btEnemyList(), btEnemyRecordDefeat(), btFormationBuildEnemyList(), btObjectIsValidId(), btPlacementRelayoutEnemies(), btUnitListLiving(), btUnitListLivingWithReserve(), btUnitRefreshPlacement(), gmUnitGet() and scLinkLobbyEnterBattle().

Definition at line 293 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(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunCoatlicue(), btEffectRunDaedalus(), btEffectRunEclipse(), btEffectRunMegiddo(), btEffectRunOdyssey(), btEffectShowLivingTargets(), btFleeCheckSuccess(), btFleePlayRun(), btFormationBuildEnemyList(), btHighlightClearAllSpriteModes(), btHighlightSetModes(), btHighlightSetOtherSpriteModes(), btIrisChangeBackdrop(), btMotionCallBeast(), btMotionDestroyAllSlotObjects(), btMotionDismissBeast(), btObjectPut(), btObjectPutKeepingPoses(), btObjectSpawnObjectsForList(), btObjectUpdateSpritePriorities(), btPartyReturnAllToSpots(), btPlacementContainsId(), btPlacementRelayoutEnemies(), btStagingRunFlee(), btStagingRunFullScreen(), btTransitionRun(), btUnitCollect(), btUnitRefreshPlacement(), btUnitResetGuardLevels() and mnBattleTargetRunSelection().

Definition at line 297 of file battle_unit.h.

POISON_NORMAL

#define POISON_NORMAL 1

UNIT.poison: poisoned, or deadly poisoned.

Referenced by btAbilityApplyToTarget(), btUnitBuildStatusFlags(), dbPsynergyTestDamageAndAfflictParty(), dbShopTestDamageAndAfflictParty(), fdPartyApplyPoisonDamage(), mnBattleStatusScreenRun() and mnShopOpenDebugShop().

Definition at line 300 of file battle_unit.h.

POISON_VENOM

#define POISON_VENOM 2

Referenced by btAbilityApplyToTarget(), btUnitBuildStatusFlags(), dbPsynergyTestDamageAndAfflictParty(), dbShopTestDamageAndAfflictParty(), fdPartyApplyPoisonDamage() and mnBattleStatusScreenRun().

Definition at line 301 of file battle_unit.h.

DEFEND_NORMAL

#define DEFEND_NORMAL 1

UNIT.defendLevel, 0 for no guard: each guard effect raises it to its own level and no lower (btAbilityApplyToTarget). Defend and Granite halve the damage, Shade cuts it to two fifths, Total Defense, Flash and Guard Aura to a tenth (REDUCE_BY_GUARD), and Haze leaves the unit untouched.

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

Definition at line 307 of file battle_unit.h.

DEFEND_SHIELD

#define DEFEND_SHIELD 2

Referenced by btAbilityApplyToTarget().

Definition at line 308 of file battle_unit.h.

DEFEND_TOTAL

#define DEFEND_TOTAL 3

Referenced by btAbilityApplyToTarget() and btGatherActions().

Definition at line 309 of file battle_unit.h.

DEFEND_VANISHED

#define DEFEND_VANISHED 4

Referenced by btAbilityApplyToTarget() and btObjectUpdateSpritePriorities().

Definition at line 310 of file battle_unit.h.

FIRST_ENEMY_UNIT

#define FIRST_ENEMY_UNIT 128

Unit ids from 128 are the enemies'.

Referenced by btAbilityReplaceDefeated(), btAIChooseAction(), btAutoBattleBuildActions(), btAutoBattleRunAttackOrItem(), btAutoBattleRunPsynergy(), btChangeEnemyForm(), btEffectReadKeysForEnemyTarget(), btEffectRunFlare(), btEnemyGetFreeUnitId(), btEnemyLetterFirstOfKind(), btEnemyList(), btFormationBuildEnemyList(), btLinkBattleReceiveParty(), btLinkBattleSendParty(), btMotionDestroyAllSlotObjects(), btObjectFindSlot(), btObjectGet(), btObjectIsValidId(), btObjectSpawnObjectsForList(), btPartyAssignOpponentSlots(), btPartyInsertUnitCentered(), btPlacementContainsId(), btPlayFormChange(), btRun(), btUnitListLiving(), btUnitListLivingWithReserve(), gmBattleUnitSet(), gmDjinnGetRecoveryTable(), gmUnitGet(), scLinkLobbyReceivePartyRecords(), scLinkLobbySendPartyRecords() and ScriptedBattleUnits.

Definition at line 313 of file battle_unit.h.

UNIT_ID_ENEMY_BIT

#define UNIT_ID_ENEMY_BIT FIRST_ENEMY_UNIT

The bit set in every enemy's unit id (FIRST_ENEMY_UNIT and up), and so the side a unit fights on.

Referenced by btMotionCallBeast() and btStagingRunAttack().

Definition at line 316 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(), gmUnitRebuildPsynergyList(), mnBattleCollectPartyCommands(), mnBattleDjinnMenuListChangedPsynergy(), mnBattleStatusScreenRun(), mnPsynergyListDifference(), mnPsynergyMenuCollectActions(), mnPsynergyMenuDrawPsynergyIcons() and mnStatusPanelDraw().

Definition at line 319 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, and the cap gmUnitClampGauge puts on hp / hpMax shifted up UNIT_GAUGE_SHIFT bits.

Referenced by scJupiterLighthouseKarstAndAgatioRetreat().

Definition at line 335 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 336 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 339 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(), btStringFindFirstDigit(), gmBattleUnitSet(), gmPartyInitCharacters(), mnBattleTargetRunSelection(), mnMessageDecode(), mnNameEntryEditMemberName(), scGabombaStatueGetPuzzleSeed(), scLinkLobbyReceivePartyRecords() and scPrepareMap().

Definition at line 342 of file battle_unit.h.

RESISTANCE_PER_STAGE

#define RESISTANCE_PER_STAGE 20

The Resistance each of a unit's battle Resistance stages (UNIT.resistanceStage) adds to every element's.

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

Definition at line 345 of file battle_unit.h.

PSY_SEAL_BIND_MASK

#define PSY_SEAL_BIND_MASK 7

UNIT.psySeal's layout: its low three bits Bind's turns left, the seal Bind casts (seven turns, which may end sooner); above them Luff's, cast as PSY_SEAL_LUFF and losing PSY_SEAL_LUFF_TURN a turn, so it lasts two and never ends early.

Referenced by btUnitCountDownPsynergySeal().

Definition at line 351 of file battle_unit.h.

PSY_SEAL_BIND

#define PSY_SEAL_BIND 7

Referenced by btAbilityApplyToTarget().

Definition at line 352 of file battle_unit.h.

PSY_SEAL_LUFF

#define PSY_SEAL_LUFF 16

Referenced by btAbilityApplyToTarget().

Definition at line 353 of file battle_unit.h.

PSY_SEAL_LUFF_TURN

#define PSY_SEAL_LUFF_TURN 8

Referenced by btUnitCountDownPsynergySeal().

Definition at line 354 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(), gmPartyRestoreHpPp(), gmPartyRestorePpInLighthouse(), gmReturnFromEngine(), gmUnitRecalculateGauges() and scKibomboInitCeremony().

Definition at line 565 of file battle_unit.h.

Enumerations in detail

anonymous enum

enum { BATTLE_UNIT_SIZE }

Bytes in a UNIT, which the code clears and copies whole: the size the STATIC_ASSERTs below hold it to.

EnumeratorValueDescription
BATTLE_UNIT_SIZE332

Definition at line 21 of file battle_unit.h.

anonymous enum

enum { PSYNERGY_ABILITY_MASK, PSYNERGY_FROM_ITEM, PSYNERGY_FROM_CLASS, PSYNERGY_FROM_CLASS_SHIFT }

The action id's bits in an action list entry.

EnumeratorValueDescription
PSYNERGY_ABILITY_MASK0x3fffPSYNERGY_ENTRY.encodedAction's action id
PSYNERGY_FROM_ITEM0x4000PSYNERGY_ENTRY.encodedAction's marks: the action comes from an equipped item, or from the class (its top bit, PSYNERGY_FROM_CLASS_SHIFT).
PSYNERGY_FROM_CLASS0x8000
PSYNERGY_FROM_CLASS_SHIFT15

Definition at line 27 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 58 of file battle_unit.h.

ABILITY_FORMULA

enum ABILITY_FORMULA

An ability kind picks what the ability's power does to each target; ABILITY_FORMULA_BLANK, ABILITY_FORMULA_EFFECT_ONLY and ABILITY_FORMULA_NO_POWER apply none.

EnumeratorValueDescription
ABILITY_FORMULA_BLANK0no ability
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_DAMAGE6enemy HP damage (<unit> unleashes <ability>!)
ABILITY_FORMULA_EFFECT_ONLY7Granite, Flash and Kite (effect
ABILITY_FORMULA_SUMMON8only)
ABILITY_FORMULA_NO_POWER9field Psynergy, Defend, Flee,
ABILITY_FORMULA_PP_DAMAGE10enemies' commands
ABILITY_FORMULA_HEAL_PP11

Definition at line 79 of file battle_unit.h.

ABILITY_USE

enum ABILITY_USE

ABILITY_DEFINITION.flags: where an ability can be used.

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

Definition at line 100 of file battle_unit.h.

ABILITY_TARGET

enum ABILITY_TARGET

ABILITY_DEFINITION.targetMode: whom an ability may target, from its user's view.

EnumeratorValueDescription
ABILITY_TARGET_ONE0the aimed unit alone, whatever its range
ABILITY_TARGET_FOES1the other side
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).
ABILITY_TARGET_SELF4the user alone, whatever the range

Definition at line 108 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). Sidestep (48), Crazy Voice (52) and Vengeance (89) have effects no code here reads.

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: two stages.
ABILITY_EFFECT_ATTACK_UP7High Impact: one stage.
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_CHARM22Charm.
ABILITY_EFFECT_STUN23Paralyze.
ABILITY_EFFECT_SLEEP24Sleep.
ABILITY_EFFECT_SEAL25Bind: Psynergy sealed.
ABILITY_EFFECT_HAUNT26Haunt.
ABILITY_EFFECT_INSTANT_DEATH27Condemn.
ABILITY_EFFECT_CURSE28Curse: the Grim Reaper's countdown.
ABILITY_EFFECT_REGENERATE29Regenerate.
ABILITY_EFFECT_REFLECT30Reflect.
ABILITY_EFFECT_DRAIN_HP31Drain.
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_6436A chance of an ability's critical hit on every target, rolled by btActionRunBuild.
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_RARE41A chance of a double or triple blow, rolled by btActionRunBuild.
ABILITY_EFFECT_DOUBLE_BLOW42Double Fang, Twin Beaks.
ABILITY_EFFECT_TRIPLE_BLOW_RARE43
ABILITY_EFFECT_TRIPLE_BLOW44Swift Strike.
ABILITY_EFFECT_THREATEN45Contain, Threaten, Tremble.
ABILITY_EFFECT_DEFEND46Defend, Granite.
ABILITY_EFFECT_TOTAL_DEFENSE47Total Defense, Flash.
ABILITY_EFFECT_SIDESTEP48Sidestep.
ABILITY_EFFECT_FLEE49Flee.
ABILITY_EFFECT_CALL_ALLY50Ally Search, Speed Surge.
ABILITY_EFFECT_CALL_HELP51Search for Help.
ABILITY_EFFECT_CRAZY_VOICE52Crazy Voice.
ABILITY_EFFECT_GROUND53Ground: the target's turn lost.
ABILITY_EFFECT_CHALLENGE54No ability has it.
ABILITY_EFFECT_SELF_DESTRUCT55Dynamite, Mortal Blow.
ABILITY_EFFECT_REVIVE_HALF56Quartz.
ABILITY_EFFECT_DEW57Dew: 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%.
ABILITY_EFFECT_EMBER63Ember: 7% of max PP.
ABILITY_EFFECT_CURE_ALL64Tonic.
ABILITY_EFFECT_DOUBLE_BLOW_LIKELY65Gust, Rapid Smash: 153 in 256.
ABILITY_EFFECT_ACT_TWICE66Kite.
ABILITY_EFFECT_SEAL_2_TURNS67Luff.
ABILITY_EFFECT_TRIPLE_BLOW_LIKELY68Sonic Smash.
ABILITY_EFFECT_PSY_LEECH69Psy Leech.
ABILITY_EFFECT_CRYSTAL70Crystal: half of max HP.
ABILITY_EFFECT_SPRING71Spring.
ABILITY_EFFECT_SHIELD72Shade: DEFEND_SHIELD.
ABILITY_EFFECT_BALM73Balm, Spark: 60% of max HP.
ABILITY_EFFECT_COUNTER74Reflux, Counter-rush.
ABILITY_EFFECT_DAZZLE75Shine: the first target takes the damage, the others are deluded.
ABILITY_EFFECT_BREATH76Breath.
ABILITY_EFFECT_AROMA77Aroma.
ABILITY_EFFECT_ETHER78Ether.
ABILITY_EFFECT_VANISH79Haze: DEFEND_VANISHED.
ABILITY_EFFECT_CURSE_THREE_ROLLS80Gasp: Curse, rolled three times (gmBattleRollEffectSuccess).
ABILITY_EFFECT_CEASE_FIRE81Lull: "Everybody is resting!" (BATTLE_STATE.ceaseFire).
ABILITY_EFFECT_BLOW_AWAY82Gale: an enemy blown out of the battle, as one that flees.
ABILITY_EFFECT_ULYSSES83Ulysses: as Ground.
ABILITY_EFFECT_CATASTROPHE84Catastrophe: the target also loses a tenth of its max PP.
ABILITY_EFFECT_STUN_THREE_ROLLS85Fire Puppet: Paralyze, rolled three times (gmBattleRollEffectSuccess).
ABILITY_EFFECT_CALL_REINFORCEMENT86Clarion Cry, Mystic Call: a Sea Fighter called in, or a Star Magician's ball.
ABILITY_EFFECT_CALL_QUEUED87Regen Dance: the next enemy of BATTLE_STATE.queuedSummons called in.
ABILITY_EFFECT_GUARD_AURA88Guard Aura: as Total Defense.
ABILITY_EFFECT_VENGEANCE89Vengeance.
ABILITY_EFFECT_SLAY_DRAGON90Raiden's Wrath: lands only on a dragon (EnemyDragonIds), and ignores its Defense.
ABILITY_EFFECT_SLAY_SEA_CREATURE91Trident: lands only on a sea creature (EnemySeaCreatureIds), and ignores its Defense.

Definition at line 123 of file battle_unit.h.

CURSE_FLAG

enum CURSE_FLAG

The curse bits of UNIT.curse (updated by gmUnitCalculate).

EnumeratorValueDescription
CURSE_BOUND0x01the unit is bound: one action in four is lost
CURSE_ITEM0x02a cursed item is equipped
CURSE_KEEP_BOUND0x04keeps CURSE_BOUND through gmUnitCalculate
CURSE_REMOVABLE0x08EQUIP_EFFECT_CURSE_REMOVABLE: cleared again with CURSE_BOUND

Definition at line 272 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.

Referenced by scJupiterLighthouseKarstAndAgatioRetreat().

Definition at line 551 of file battle_unit.h.

Variables in detail

CharacterUnits

extern UNIT CharacterUnits[PARTY_UNIT_COUNT]

The eight characters' units, ISAAC to PIERS, kept in the save.

Referenced by gmMainRoutineStateInitDefaults(), gmUnitGet() and scClearReceiveByLink().

Definition at line 579 of file battle_unit.h.