2.4.1 ATB Recovery and end of turn effects - jmcx532/FFX-2-TurnBased GitHub Wiki

ATBRecovery_Main.cs

h_MsATBgetRestTime - ATB Recovery calculation

This function calculates ATB Recovery time.

Note: this function is called constantly. For one time, end of turn effects, hook MsCommandComplete() instead.

Custom ATB Recovery formula

The vanilla ATB recovery formula is:

(com.atb_cost * 10000) / (agility + 1)

This formula is generally OK, but some enemies with very high Agility get too many turns, and it is less easy to increase YRP's Agility in this game compared to FFX. Therefore for characters who have an Agility stat greater than 100, the formula becomes:

(com.atb_cost * 10000) / (Math.Pow(agility + 125, 0.85) + 1)

This reduces how low a character's recovery time can go. Before this change, enemies could act up to 4 turns for every 1 character turn and this change cuts that in half.

Haste and Slow ATB recovery time modifiers

Instead of Haste/Slow modifying a character's ATB fill speed:

  • Haste cuts recovery time in half
  • Slow doubles recovery time

Auto-Ability recovery time reduction

FFX-2 has Auto-Abilities such as Turbo Swordplay which reduced the Wait Time (purple bar) of certain abilities. As the Wait Time mechanic has been removed, the reduction provided by these Auto-Abilities has been re-implemented to apply to standard ATB Recovery instead.

h_TOBtlDrawATBGaude (sic) - remove ATB gauges from status window

Stubbing out this function stops ATB gauges from being drawn.

h_MsCommandComplete - end of turn effects

This function is ran once when a character has performed an action. It calls MsATBgetRestTime() to calculate recovery time, and writes the value to the character's Chr struct.

This function was hooked to process and add end of turn effects.

Spherechange ATB Delay

Since Spherechanges have no recovery time in vanilla FFX-2, making the game turn based allowed a character to chain spherechanges to activate all Garment Grid abilites, and access Special Dresspheres all in one turn, without interruption.

A small delay has been added to compensate for this, however, it is still a very quick action to perform - it uses the standard ATB Recovery formula with a simulated Command.atb_cost of 40. [see note 1]

Disable Time Trip

In this mod, Time Trip can only be used once per battle. This function checks if the character used Time Trip, and if they did, it get's disabled until the start of the next battle.

Process status effects

This function stubs out the vanilla game's MsStatusProcess() and the mod runs TbStatusProcess() and TbRegenProcess() to trigger end of turn status effect handling.

Notes

1. Items have a Item.atb_cost of 50 and the Attack command has an atb_cost of 70.