# Structures & Parameters

### Structures

There are several structures mentioned throughout this documentation that you will need to be familiar with when working with formula functions. These structures are comparable to classes in object-oriented programming.

You can view and modify most of the structures via [The Insurgent's Toolkit](https://www.nexusmods.com/finalfantasy12/mods/160). You can also find a spreadsheet that includes information about all of the properties of these structures in the [resources](../getting-started/resources "mention") page. So whenever you want to know what structure you have to access to retrieve a specific property of a unit, you can take a look at both of these things.

#### Battle Unit Keep

This structure includes information about a unit's stats, equipment, status effects, augments, licenses, experience, license points, level, jobs and more. It's preserved when a unit re-spawns, so any modification to it will have a permanent effect unless its explicitly overwritten.

It's also slightly different depending on if the unit is a party member or foe. If it's a party member, it includes information about the default stats, and also gambits which are ineffectual though as they were outsourced to another structure with the game update 1.0.4. If it's a foe, it includes information about the additive stats and default level instead.

#### Battle Unit Keep Plus

This structure is exclusive to foes and includes additional information about a Battle Unit Keep structure. It's used when a unit re-spawns and includes steal states, enmity, death count, re-spawn time, default position and more.

#### Battle Actor Work

This structure includes information about an actor's other structures, activity, type, target info name, and more.

Every actor (foe, treasure, door, ...) in a location has one once it spawns.

#### Battle Unit Work

This structure includes information about a unit's other structures, classification, genus, type, position, and much more.

Every unit (party member, foe, ally, ...) in a location has one once it spawns. It's used in battle and also when just idling in a location. Once a unit serves no purpose any more, for example when the player puts a party member in a reserved party slot, the structure of that unit will be disposed of.

#### Formula Processing Work

This structure is created before the processing of a formula function group (OnCast / OnHit) and is used to modify the current state of the formula processing. This includes the current formula, action, cause type, miss chance, and more.

It's only temporary and meant to help with planning the processing of succeeding formula functions. Once you are done with all your changes, an OnCastEnd / OnHitEnd function will summarize all your changes and actually apply them (e.g. add content, show combat log, ...). That way you can prevent a formula from having an effect at any point during the processing (e.g. if target is immune).

#### Formula Processing Work Plus

This structure is created before the processing of a formula function group (OnCast / OnHit) and is used to modify the current state of a character (e.g. caster) in a formula. This includes stats such as HP, MP, status effects, augments, elemental affinities, and more.

It's only temporary and meant to help with planning what changes should be applied to a character. Once you are done with all your changes, an OnCastEnd / OnHitEnd function will summarize all your changes and actually update a character's properties. That way you do not need to directly modify a character's properties with every function and therefore always have access to their original values.

#### Formula Processing Keep

Includes information about the formula processing that is exchanged between OnCast and OnHit functions. This includes:

* Calculate the damage of an action with an area of effect once and then reuse it in the next formula or function processing.
* Set the caster's combo state and count.
* Check if the last action had an effect on the target (e.g. miss, immune, reverse).
* and many more.

Every party member and foe has one by default. It's never disposed of and only overwritten instead.&#x20;

### Notes

{% hint style="info" %}
A unit is a character, treasure, etc. while an actor is just an interactive object with a physical form like a door, wall, etc. A unit is always also an actor, but an actor doesn't need to be a unit.
{% endhint %}
