Skip to Content
The Alchemy Project

include/battle/range_falloff.h

How an ability weakens with each place a target stands from the aimed one, and the damage and recovery formulas that use it.

Included by battle_internal.h and field_engine_internal.h.

Functions

NameDescription
Sint32gmBattleRollEffectSuccessStub (Sint32 caster, Sint32 target, Sint32 element, Sint32 effectId, Sint32 successScale)Rolls whether an ability's effect lands on the target, less likely the farther it is from the aimed unit (gmBattleRollEffectSuccess); returns 1 when it does.
Sint32gmBattleCalculateAttackDamageStub (Sint32 attack, Sint32 defense, Sint32 addedPower, Sint32 elementDifference)Scales max(attack - defense, 0) plus twice the added power by half the element multiplier, then halves it (gmBattleCalculateAttackDamage).
Sint32gmBattleCalculatePsynergyPowerStub (Sint32 power, Sint32 elementDifference, Sint32 powerMultiplier)Returns Psynergy's power times the element multiplier and powerMultiplier (gmBattleCalculatePsynergyPower).
Sint32gmBattleCalculateRecoveryStub (Sint32 power, Sint32 elementPower, Sint32 powerMultiplier)Returns the amount healed: power times powerMultiplier and the multiplier for the healer's element power above 100 (gmBattleCalculateRecovery).
Sint16gmUnitAddPpStub (Sint32 unit, Sint32 amount)Adds amount to the unit's PP, kept between 0 and its maximum, updates its gauges and returns the new PP.
Sint32gmBattleUnitSetStub (Sint32 unitId, Sint32 enemyId, Sint32 suffix)Fills a battle unit with an enemy: its stats, its name with its letter, its items, rewards and elements (gmBattleUnitSet).
BoolbtAbilityEffectAppliesToDowned (Sint32 effect)Returns 1 for an effect that still applies when the ability's damage has just knocked its target out: the drains, which give the damage they dealt back to the user.

Variables

NameDescription
extern Uint8RangeFalloffEffectChance []The range falloff: each table is a percent of the full amount, indexed by the target's distance in places from the aimed unit (0 to 5), from the chance an effect lands to the damage, healing and PP each formula gives.
extern Sint32RangeFalloffPpLoss []The PP an effect drains.
extern Sint32RangeFalloffHealHp []The HP healed.
extern Sint32RangeFalloffPpDamage []The PP damage done.
extern Sint32RangeFalloffPsynergyDamage []Psynergy's damage.
extern Sint32RangeFalloffSummonDamage []A summon's damage.
extern Sint32RangeFalloffEnemyDamage []An enemy ability's damage.
extern Sint32RangeFalloffHealPp []The PP restored.
extern Sint32RangeFalloffEffectDamage []An effect's own damage.

Description

How an ability weakens with each place a target stands from the aimed one, and the damage and recovery formulas that use it.

Functions in detail

gmBattleRollEffectSuccessStub

Sint32 gmBattleRollEffectSuccessStub(Sint32 caster, Sint32 target, Sint32 element, Sint32 effectId, Sint32 successScale)

Rolls whether an ability's effect lands on the target, less likely the farther it is from the aimed unit (gmBattleRollEffectSuccess); returns 1 when it does.

Referenced by btAbilityApplyToTarget() and btActionRunBuild().

Definition at line 26 of file range_falloff.h.

gmBattleCalculateAttackDamageStub

Sint32 gmBattleCalculateAttackDamageStub(Sint32 attack, Sint32 defense, Sint32 addedPower, Sint32 elementDifference)

Scales max(attack - defense, 0) plus twice the added power by half the element multiplier, then halves it (gmBattleCalculateAttackDamage).

Referenced by btAbilityApplyToTarget().

Definition at line 33 of file range_falloff.h.

gmBattleCalculatePsynergyPowerStub

Sint32 gmBattleCalculatePsynergyPowerStub(Sint32 power, Sint32 elementDifference, Sint32 powerMultiplier)

Returns Psynergy's power times the element multiplier and powerMultiplier (gmBattleCalculatePsynergyPower).

Referenced by btAbilityApplyToTarget().

Definition at line 39 of file range_falloff.h.

gmBattleCalculateRecoveryStub

Sint32 gmBattleCalculateRecoveryStub(Sint32 power, Sint32 elementPower, Sint32 powerMultiplier)

Returns the amount healed: power times powerMultiplier and the multiplier for the healer's element power above 100 (gmBattleCalculateRecovery).

Referenced by btAbilityApplyToTarget() and mnAbilityApplyToTargets().

Definition at line 44 of file range_falloff.h.

gmUnitAddPpStub

Sint16 gmUnitAddPpStub(Sint32 unit, Sint32 amount)

Adds amount to the unit's PP, kept between 0 and its maximum, updates its gauges and returns the new PP.

Referenced by btAbilityApplyToTarget(), btProcessTurnEnd(), fdPartyAddPp(), fdUsePsynergy() and mnPsynergyMenuRunSteps().

Definition at line 49 of file range_falloff.h.

gmBattleUnitSetStub

Sint32 gmBattleUnitSetStub(Sint32 unitId, Sint32 enemyId, Sint32 suffix)

Fills a battle unit with an enemy: its stats, its name with its letter, its items, rewards and elements (gmBattleUnitSet).

Referenced by btAbilityApplyToTarget(), btChangeEnemyForm(), btFormationBuildEnemyList() and btRun().

Definition at line 52 of file range_falloff.h.