Skip to Content
The Alchemy Project

src/battle/battle_ability.c

An ability applied to one target, btAbilityApplyToTarget: damage, healing and its added effect. More…

Included by battle.c.

Macros

NameDescription
#defineAGILITY_STAGE_DOUBLED 8Zephyr's Agility stage, beyond the usual highest (STAT_STAGE_MAX, battle_targeting.c): twice the Agility.
#defineSTAT_CHANGE_TURNS 7The turns a stat change or a status lasts; a status or a lowered stat may end sooner.
#defineAGILITY_CHANGE_TURNS 5
#defineSTATUS_TURNS 7
#defineCURSE_TURNS 7The Grim Reaper's countdown.
#defineFULL_RATE 256The rate gmBattleCalculatePsynergyPowerStub and gmBattleCalculateRecoveryStub scale by: 256 is 1.
#defineITEM_ELEMENT_POWER 100The element power an item, or an ability with no element, acts with.
#defineDJINN_BONUS_CHANCE 30An unleashed Djinni gives the Djinn bonus (more coins and experience, and a likelier item, from the enemies that fall) against a target weakest to its element, with a chance in percent of the user's power less the target's resistance, plus this many.
#defineMESSAGE_NONE -1A message operand that shows nothing: the event only waits for the player.
#defineIS_PARTY_UNIT (unitId) ((unitId) >= 0 && (unitId) <= ALLY_MAX)Party unit ids run to ALLY_MAX; enemy units start at FIRST_ENEMY_UNIT.
#defineCLAMP_STAT_STAGE (stage)Holds a stat stage within STAT_STAGE_MIN to STAT_STAGE_MAX.
#definePUSH_SIDE_MESSAGE (unitId, partyMessage, enemyMessage)Pushes one message for a unit of the party and another for an enemy.
#defineREDUCE_BY_GUARD (damage, unit)A guarding unit takes half the damage, or a tenth behind Total Defense.

Functions

NameDescription
BoolbtAbilityEffectAppliesToDowned (Sint32 effect)Returns 1 for an effect that still applies when the damage has just knocked the target out: the drains.
UNREAD_RESULTbtAbilityApplyToTarget (BATTLE_ACTION_RUN *plan, Sint32 slot)Applies the action's ability to one of its targets, slot, in the seven steps README.md lists under "Weapon unleashes and 7-step ability resolution", queueing what playback will show.
Uint32btAbilityIsPsynergy (Sint32 abilityId)Returns 1 for an ability that costs PP, and for Psy Drain, which costs none.

Description

An ability applied to one target, btAbilityApplyToTarget: damage, healing and its added effect. Part of battle.c.

Macros in detail

AGILITY_STAGE_DOUBLED

#define AGILITY_STAGE_DOUBLED 8

Zephyr's Agility stage, beyond the usual highest (STAT_STAGE_MAX, battle_targeting.c): twice the Agility.

Referenced by btAbilityApplyToTarget().

Definition at line 24 of file battle_ability.c.

STAT_CHANGE_TURNS

#define STAT_CHANGE_TURNS 7

The turns a stat change or a status lasts; a status or a lowered stat may end sooner.

Referenced by btAbilityApplyToTarget().

Definition at line 28 of file battle_ability.c.

AGILITY_CHANGE_TURNS

#define AGILITY_CHANGE_TURNS 5

Referenced by btAbilityApplyToTarget().

Definition at line 29 of file battle_ability.c.

STATUS_TURNS

#define STATUS_TURNS 7

Referenced by btAbilityApplyToTarget().

Definition at line 30 of file battle_ability.c.

CURSE_TURNS

#define CURSE_TURNS 7

The Grim Reaper's countdown.

Referenced by btAbilityApplyToTarget().

Definition at line 32 of file battle_ability.c.

FULL_RATE

#define FULL_RATE 256

The rate gmBattleCalculatePsynergyPowerStub and gmBattleCalculateRecoveryStub scale by: 256 is 1.

Referenced by btAbilityApplyToTarget().

Definition at line 36 of file battle_ability.c.

ITEM_ELEMENT_POWER

#define ITEM_ELEMENT_POWER 100

The element power an item, or an ability with no element, acts with.

Referenced by btAbilityApplyToTarget().

Definition at line 39 of file battle_ability.c.

DJINN_BONUS_CHANCE

#define DJINN_BONUS_CHANCE 30

An unleashed Djinni gives the Djinn bonus (more coins and experience, and a likelier item, from the enemies that fall) against a target weakest to its element, with a chance in percent of the user's power less the target's resistance, plus this many.

Referenced by btAbilityApplyToTarget().

Definition at line 45 of file battle_ability.c.

MESSAGE_NONE

#define MESSAGE_NONE -1

A message operand that shows nothing: the event only waits for the player.

Referenced by btAbilityApplyToTarget().

Definition at line 48 of file battle_ability.c.

IS_PARTY_UNIT

#define IS_PARTY_UNIT(unitId) ((unitId) >= 0 && (unitId) <= ALLY_MAX)

Party unit ids run to ALLY_MAX; enemy units start at FIRST_ENEMY_UNIT.

Referenced by btAbilityApplyToTarget().

Definition at line 51 of file battle_ability.c.

CLAMP_STAT_STAGE

#define CLAMP_STAT_STAGE(stage)

Holds a stat stage within STAT_STAGE_MIN to STAT_STAGE_MAX.

Referenced by btAbilityApplyToTarget().

Definition at line 54 of file battle_ability.c.

PUSH_SIDE_MESSAGE

#define PUSH_SIDE_MESSAGE(unitId, partyMessage, enemyMessage)

Pushes one message for a unit of the party and another for an enemy.

Referenced by btAbilityApplyToTarget().

Definition at line 63 of file battle_ability.c.

REDUCE_BY_GUARD

#define REDUCE_BY_GUARD(damage, unit)

A guarding unit takes half the damage, or a tenth behind Total Defense.

Referenced by btAbilityApplyToTarget().

Definition at line 72 of file battle_ability.c.

Functions in detail

btAbilityEffectAppliesToDowned

Bool btAbilityEffectAppliesToDowned(Sint32 effect)

Returns 1 for an effect that still applies when the damage has just knocked the target out: the drains.

References Sint32.

Referenced by btAbilityApplyToTarget().

Definition at line 8 of file battle_ability.c.

btAbilityApplyToTarget

UNREAD_RESULT btAbilityApplyToTarget(BATTLE_ACTION_RUN *plan, Sint32 slot)

Applies the action's ability to one of its targets, slot, in the seven steps README.md lists under "Weapon unleashes and 7-step ability resolution", queueing what playback will show.

References btAbilityEffectAppliesToDowned(), btEnemyClaimNameLetter(), btEnemyGetFreeUnitId(), btEnemyHasSpriteRoom(), btEnemyLetterFirstOfKind(), btEnemyList(), btFormationGetRandomMember(), btMotionReturnToSpot(), btObjectGet(), btObjectMake(), btObjectPut(), btPlacementRelayoutEnemies(), btPlaybackPush(), gmAbilityGetDefinitionStub(), gmBattleCalculateAttackDamageStub(), gmBattleCalculatePsynergyPowerStub(), gmBattleCalculateRecoveryStub(), gmBattleIsReviveEffectStub(), gmBattleRandomStub(), gmBattleRollEffectSuccessStub(), gmBattleUnitSetStub(), gmFlagGetStub(), gmUnitAddPpStub(), gmUnitCalculateStub(), gmUnitGetStub(), gmUnitRecalculateGaugesStub(), mnPartyStatusDrawStub(), RangeFalloffEffectChance, RangeFalloffEffectDamage, RangeFalloffEnemyDamage, RangeFalloffHealHp, RangeFalloffHealPp, RangeFalloffPpDamage, RangeFalloffPpLoss, RangeFalloffPsynergyDamage, RangeFalloffSummonDamage, Sint32, syHeapAllocate(), syHeapRelease() and syWordsCopy().

Referenced by btPlaybackRun() and btStagingRunMessages().

Definition at line 87 of file battle_ability.c.

btAbilityIsPsynergy

Uint32 btAbilityIsPsynergy(Sint32 abilityId)

Returns 1 for an ability that costs PP, and for Psy Drain, which costs none.

References gmAbilityGetDefinitionStub() and Sint32.

Referenced by btActionRunBuild() and btAIChooseAction().

Definition at line 1365 of file battle_ability.c.