Skip to content

Battle state

These fields describes the state of the battle. Some fields belongs to MainManager, but are mostly BattleControl related.

BattleControl fields

This is all the BattleControl fields.

Battle setup information

Name Type Public? Description
battlemap GameObject Yes The parent of all the battles objects notably the battle map prefab. This is a game object named Battle created on StartBattle
caller NPCControl No The Enemy NPCControl whose encounters caused this battle. This is set to the calledfrom value sent to StartBattle. If it's null, no encounter caused this battle and it was started manually
sadv int No The starting advantage value. Set to the sent adv value of StartBattle, but adv is set to this field if it's a retry. The only recognised value is 3 which means the enemy party has the advantage, other values do nothing
sdata StartUpData No The StartUpData stored during StartBattle when saveddata is false. Restored on StartBattle for a retry
saveddata bool No Whether the sdata have been saved and are ready for restoration. Set to true at the very end of StartBattle
canflee bool Yes Whether fleeing is allowed as well as retry when a GameOver occurs. Set to the canescape value sent to StartBattle

Battle flow

Name Type Public? Description
action bool Yes If true, it means an action coroutine or a method controls the battle flow making it an uncontrolled flow. Set to false on StartBattle
inevent bool Yes Tells if an EventDialogue is in progress or not. If one is, we enter an uncontrolled flow
calleventnext int No If not negative, the EventDialogue whose id is this value will be done on the next uncontrolled flow. This is only used in conjuction with an enemy party member's eventonfall when it triggers
cancelupdate bool Yes Whether updates are disabled which only happen when some kind of terminal event occurs that changes the flow to a terminal flow. Set to false on StartBattle
alreadyending bool Yes Tells when the battle is about to end via GameOver or AddExperience. Set to false on StartBattle. This protects against potential double terminal flow changes
enemy bool Yes Whether we're in the enemy phase or not (false means we're in the player phase) of the turn of a controlled flow or processing a hitaction or processing a delproj. Set to false on StartBattle
mainturn Coroutine No The AdvanceMainTurn coroutine if one is in progress (null if it's not)
delprojs DelayedProjectileData[] Yes The delayed projectiles currently active
turns int No The amount of completed main turns advanced by AdvanceMainTurn. Set to 0 on StartBattle
demomode bool No If true, indicates the battle operates in tutorial mode. Used for the combat tutorials process and Spuder EventDialogues
gameover Coroutine No The current GameOver coroutine is one is in progress (null if it's not). Set to null on StartBattle
halfload bool Yes Whether or not StartBattle roughly got done half of the starting process. This is set to true right after calling SetLastTurns and it's used by the game to yield until this goes to true
avaliableplayers int No The amount of players that are considered free by GetFreePlayerAmmount. Set to the current amount on StartBattle and updated in specific situations
currentturn int Yes Determine the playerdata index currently selected for an action. -1 means no one is selected yet, being below playerdata length means that player index is selected and being at length or above means all players have taken their actions and the player phase is over. Set to -1 on StartBattle
lastturns int[] No The state of the player index selection cycle which starts with an array with a length of the amount of free players - 1. Advancing it means either assigning the first free slot (-1) to the player being selected or shift the elements such that it falls on the latest while the oldest is removed
receivedrelay bool[] No An array indicating which player index got relayed to via Relay which allows the tiredpart to be rendered whenever tired gets above 0 during UpdateAnim
actedthisturn bool No Tells if PlayerTurn was called at least once during the turn implying at least one player could act. Set back to false on AdvanceMainTurn
noaction int No The amount of main turns in a row where actedthisturn was false. If it reaches 5 without game over, the inactive failsafe triggers in AdvanceMainTurn
attackedally int No The playerdata index that was attacked while the FavoriteOne medal was equipped on them which will cause it to take effect during AdvanceMainTurn. If this medal isn't applicable, the value is -1
firststrike bool No Whether or not the enemy is currently acting as part of the enemy party getting the starting advantage during StartBattle
summonnewenemy bool No If true, it means that the game is in the process of summoning an enemy from the extraenemies to enemydata via SummonEnemy, called duing CheckDead. This prevents SummonEnemy to set checkingdead to null once completed to not interfere with the ongoing CheckDead and it also allows CheckDead to wait the summon is over
selfsacrifice bool No If true, it indicates that the enemy party member killed themselves during their DoAction which changes CleanKill and the post action logic of DoAction
eatenkill bool Yes If true, it indicates that a player party member was killed by a Pitcher enemy by draining their HP which allows AdvanceMainTurn to handle this special case
lastdamage int No The last final amount of damage done at the end of DoDamage
damagethisturn int No The amount of damage the player party inflicted in the current main turn. If it gets higher than flagvar 41 (highest damage in one turn), the flagvar value is set to it before resetting the value of damagethisturn in AdvanceMainTurn
charmcooldown int No The amount of main turns that needs to pass for UseCharm to process the next charm even if one is available and could have been processed otherwise. Set to a random integer between 3 and 7 inclusive after a charm has been processed and decremented on AdvanceMainTurn
currentEnemy int No The value of the actionid parameter sent to the last DoAction for an enemy party member. This field is primarily done to allow to yield return sub coroutines for enemy actions logic so the value can be accessed from outside DoAction

Actors information

Name Type Public? Description
partypointer int[] Yes The mapping from battle order formation to playerdata index. Aligned with the correct order on StartBattle and changed on SwitchParty or SwitchPos. Check the battle party addressing documentation for more details
partyentities EntityControl[] No Set to all the playerdata battleentity on StartBattle
alldata BattleData[] Yes All the playerdata followed by all the enemydata appended together. Set by RefreshAllData which is only called during StartBattle
enemydata BattleData[] Yes The first enemy party members data with a length up to 4 (the extra ones are stored in extraenemies). Set to a new list with the same length as the sent enemyids on StartBattle (after it was truncated to the first 4) and then filled with the actual enemy data
extraenemies List No This contains the list of enemy ids that overflows the maximum amount of enemies allowed in enemydata which is 4. It is initialised as such on StartBattle
reservedata List No The list of enemies who are no longer part of enemydata because they had died and were moved there by CheckDead since their deathtype indicated they should be moved there. Doing so prevents a full destruction which allows the enemy to be revived later or to visually have a death animation without disappearing. Reset to a new list on StartBattle
enemyfled bool No Whether at least one enemy party member fled the battle or not during DoAction
lastaddedid int No The last enemy party member index added via AddNewEnemy
tempslot BattleData No The last enemy to be added in enemydata according to NewEnemy if the sent animation value isn't None
deadenemypos List No The list of the positions of previously dead enemies as found by CheckDead. It is only used by CheckDead in case extraenemies needs to be summoned in the place of the dead ones at the same positions they were before
deadmembers int[] No The array of player party members indexes whose hp is 0 or below as returned by GetDeadParty. Used during RevivePlayer to decide whether to resucitate the player party member

Attack and flow modifiers

Name Type Public? Description
dontusecharge bool No If true, the charge of the enemy party member will not be reset to 0 on EndEnemyTurn
nonphyscal bool No If true, indicate to the damage pipeline that the damages aren't physical which affects the effects of the FrostBite, SpikeBod and PoisonTouch medal
nolifesteal bool Yes If true, disables the effects of the LifeSteal medal during the damage pipeline
lockmmatter bool Yes If true, prevents the MiracleMatter medal to take effect. Set to false on StartBattle

Actions commands and blocking

Name Type Public? Description
actionroutine Coroutine No Tracks the progress of a DoCommand coroutine
doingaction bool Yes If true, an action command is in progress
successfulchain int No The amount of sucessful inputs perfomred in a LongRandomBar action commands during DoCommand
presskey int No A general purpose input id for use in DoCommand
barfill float No A number between 0.0 and 1.0 that tells the ratio of an action command's bar's filled portion which is managed by DoCommand
infinitecommand bool No If true, action commands processed by DoCommand will use their infinite variant. NOTE: Only the SequentialKeys support this feature
killinput bool No Used for the PressKey action command that when set to true, DoCommand will stop listening for inputs
commandsuccess bool Yes Tells if the last action command succeeded or tell if the player is currently blocking ignoring FRAMEONE (tracked by GetBlock)
buttons ButtonSprite[] No A general purpose array of ButtonSprites for use in DoCommand
commandsprites SpriteRenderer[] No A general purpose SpriteRenderer array for use in DoCommand or other action commands related needs
helpboxid int No The id of the current action command whose description should be rendered in helpbox by CreateHelpBox
helpbox DialogueAnim No The 9box containing the action command description whose id is helpboxid rendered by CreateHelpBox
superblockedthisframe float No A short lived cooldown in frames that allows a super block to still count until it expires, check GetBlock to learn more. Used in the damage pipeline and maintained by LateUpdate
blockcooldown float No The amount of frames left that a block can be processed ignoring FRAMEONE, check GetBlock for more details
hasblocked bool No If true, the damage pipeline detected the player blocked the attack with a valid block (even if FRAMEONE rules would have prevented it). This is only used in HardSeedVenus, a coroutine specific to the VenusBoss enemy
overridechallengeblock bool Yes Normally, standard blocks are disallowed when flags 615 and 15 are true (FRAMEONE is active while past the first tutorial fight), but if this field is true, it allows to override that behavior to allow them regardless of these conditions being fufilled or not

Targetting

Name Type Public? Description
avaliabletargets BattleData[] No An ephemeral array of actors to track possible targets for an action which is frequently set by calling GetAvailableTargets
forceattack int No The player party member's animid index that will be forced to be returned during GetRandomAvaliablePlayer. This is only set in the course of the Taunt skill during its DoAction logic
playertargetID int No The player party member index whom is currently targetted by the enemy party member. If it's -1, the enemy isn't targetting anyone
playertargetentity EntityControl No An actor to use for targetting purposes, but typically used as a shorthand to playerdata[playertargetID] during enemy actions. NOTE: despite the name, it can be an enemy party member as enemies can sometimes target other enemy party members outside of the damage pipeline
targetedenemy int No Indicates the enemy party member index that Beetle will target when using his basic attack or the HeavyStrike skill during DoAction
target int No The index of the selected target when selecting a player or enemy

Chompy informations

Name Type Public? Description
chompy EntityControl No If flags 402 is true (Chompy is with Team Snakemouth), this is initialised to a new entity created via CreateNewEntity with name chompy with the ChompyChan animid on StartBattle
chompyattack Coroutine Yes The coroutine of Chompy if it's in progress (null if it's not)
chompyaction bool No Tells if Chompy is in progress or not
chompyattacked bool No Tells if Chompy has completed during the player phase when applicable
coptions List No The list of action options available during Chompy: 0 is basic attack, 1 is do nothing, 2 is the ribbon specific attack and 3 is change ribbon
chompyoption int No The last chosen coption the last time Chompy was called
chompylock bool No If true, it prevents Chompy to be a part of the player phase even if it would normally be allowed. This is only used during DoAction specifically for the Centipede enemy

AI party informations

Name Type Public? Description
aiparty EntityControl No The entity that was created as part of AddAI if one was created
aiattacked bool No Tells if AIAttack has completed during the player phase when applicable

EXP and berries

Name Type Public? Description
estimatedexp int No The sum of all the calculated enemydata's exp
expreward int No The amount of EXP cumulated in the course of the battle that will be granted if the battle is won. Set to 0 on StartBattle
oldexp int No The last value of expreward observed since the last RefreshEXP. If it differs with the current one, RefreshEXP will be called on the next applicable Update
leveled bool No Indicates that AddExperience detected a rank up situation
moneyreward int No The amount of berries that will be dropped after the battle. Set to 0 on StartBattle

UI naviguation

Name Type Public? Description
currentaction Pick Yes The current menu being naviguated by the player. Set to BaseAction on StartBattle
currentchoice Actions Yes The current action being selected on the BaseAction menu. Set to Attack on StartBattle
itemarea AttackArea No Tells what actors are selectable to perform the current action
maxoptions int No The amount of available option on the main vine menu
lastoption int No The last selected option on the main vine menu
selecteditem int No The selected listvar option from an ItemList, set by SetItem
vineoption int No Equivalent to maxoption, but for the main vine menu value
option int Yes The current vine menu option. 0 is attack, 1 is skills, 2 is items, 3 is strategies and 4 is turn relay. Set to 0 on StartBattle. This can also be the index of an enemy or player target being selected. NOTE: the vine order is reversed in game as left goes up and right goes down in the option index with wrap around
excludeself bool Yes If true, it will cause the currentturn player to not be selectable in a currentaction of SelectPlayer in GetChoiceInput
tempskill int Yes The skill id that was confirmed from skills selection in SetItem
lastskill int No The last skill id used, set to selecteditem before its usage when confirmed in GetChoiceInput
lastaction int No The last action chosen by a player party member. Set to option on AdvanceMainTurn which keeps the last selected vine menu options since the last one chosen on the new turn
idletimer int No The amount of frames since the player idled which is used in the EXP counter update
turncooldown float No The amount of FixedUpdate cycles left before GetChoiceInput calls are allowed during PlayerTurn. Set to 5.0 in SetItem and CancelList
caninputcooldown float No A general purpose input cooldown in amount of frames left before expiring. Notably, it has an important role in GetBlock

UI rendering

Name Type Public? Description
vinebase Transform No A GameObject named Base childed to choicevine
choicevine Transform No A GameObject named Vine that is the root of the vines UI objects, childed to the battlemap and initialised on CreateVine as part of PlayerTurn
vineicons SpriteRenderer[] No The vine icons of the vine menu, childs of vinebase
cursor Transform No The selection leaf cursor. Initialised on CreateCursor which is only called on StartBattle
switchicon Transform No The parent of the UI objects that composes the switch icon which is a GameObject named switchicon childed to the GUICamera. Initialised on StartBattle
fronticon SpriteRenderer No The SpriteRenderer of the UI object named attackicon childed to the GUICamera that corresponds to the icon the front party member has. Initialised on StartBattle
hexpcounter Transform No The EXP counter shown when idling for 200+ frames when currentaction is BaseAction. Created on the first controlled update flow
expholder Transform No A GameObject named expholder childed to the GUICamera with tag DelAftBtl (destroyed on ReturnToOverworld) that holds the EXP orbs cumulated in the battle for visual rendering
lvicon Transform No The EXP icon sprite used in the UI during AddExperience
hideenemyhp bool Yes If true, the hpbar of every enemy party members's battleentity gets disabled on RefreshEnemyHP
actiontext SpriteRenderer No The UI element for the game to indicate the current action being selected which is the SpriteRenderer of a new GameObject named ActionText childed to the GUICamera. Initialised on StartBattle
smallexporbs Transform[] No The array of smaller orbs (one per 1 EXP below 10 remaining) which are instances of Prefabs/Objects/ExpOrbGUI rendered as child of the expholder
bigexporbs Transform[] No The array of larger orbs (one per 10 EXP) which are instances of Prefabs/Objects/ExpOrbGUI rendered as child of the expholder
longcancel bool No Whether the Cancel input is considered wider for rendering or not. Set to the return of InputIO.LongButton(5) on StartBattle. This is involved during the rendering of the switchicon
cancelb ButtonSprite No A ButtonSprite of the cancel input for use in UpdateText

Visual effects

Name Type Public? Description
wordroutine Coroutine No Tracks the progress of a ShowSuccessWord coroutine
commandword SpriteRenderer No The word SpriteRenderer used in ShowSuccessWord
combo int No The amount of consecutive successful action commands performed which influences visual and audio effects informing of the input successes
damcounters List No All of the currently rendered damage counters maintained by CounterAnimation, a sub coroutine of ShowDamageCounter. Set to a new list on StartBattle
defaultcounteroffset Vector3 No Always set to (0.0, 1.25, 0.0) for use in DoDamage when calculating the start of the ShowDamageCounter call
counterspriteindex int[] No Indicates the guisprites indexes of the different counter used in ShowDamageCounter. This is always {8, 40, 101}
partymiddle Vector3 No Always set to (-4.5, 0.0, 0.0) for use in DoAction
tiredpart Transform[] No Set to a new array of the transform of instances of Prefabs/Particles/Tired on StartBattle belonging to each playerdata battleentity (each is childed to their battleentity) The length is thus the same than playerdata
tskybox Material No The RenderSettings.skybox saved on StartBattle. This is used for restoring later in case of a retry
fogdist float No The value of RenderSettings.fogEndDistance saved on StartBattle if the current one needs to change. Restored from this field during ReturnToOverworld if it had a value above 0.0
dimmer SpriteRenderer No A giant black colored sprite that covers everything behind the transition during load. Initialised on StartBattle after the fade in transition and disabled with a clear color just before the fade out one
charmdance Sprite[] No The sprites Charmy uses during UseCharm. Always set to sprite 98 and 99 of Sprites/Entities/moth0 on StartBattle

Music

Name Type Public? Description
overworldmusic AudioClip No On StartBattle, this is set to MainManager.music[0].clip if the map.music[0] exists and map.musicid is not negative. This is used for restoring the music on ReturnToOverworld
overmusic float No If overworldmusic was saved, the time of that music is saved on this field if MainManager.keepmusicafterbattle is true. This is also used for restore on ReturnToOverworld
keepmusic bool Yes Towards the end of ReturnToOverworld when instance.inevent is true, it is possible to skip the default behavior of fading the current music to silence by having this field set to true before ReturnToOverworld ends which will leave the current music playing instead

Camera

Name Type Public? Description
campos Vector3 No The camtargetpos that will be set when SetDefaultCamera is called, normally Vector3.zero
camoffset Vector3 No The camoffset that will be set when SetDefaultCamera is called, normally MainManager.battlecampos
oldcamoffset Vector3 No Set to instance.camoffset on StartBattle when it's not a retry. This is used for restore later on ReturnToOverWorld
oldcamrotation Vector3 No Set to instance.camangleoffset on StartBattle when it's not a retry. This is used for restore later on ReturnToOverWorld
oldcamspeed float No Saved to instance.camspeed on StartBattle when it's not a retry. This is used for restore later on ReturnToOverWorld

Misc coroutines tracking

Name Type Public? Description
checkingdead Coroutine Yes Store diverse coroutines to track their progression (NOTE: despite the name, it's not just for CheckDead)
enemybounce Coroutine[] No A general purpose coroutines array for use in DoAction that is made to track EnemyBounce and SummonArtifact
tryenemyheal Coroutine No Tracks the progress of a TryHealEnemyItem and EnemyFlee coroutines
spitout Coroutine No The SpitOut coroutine if one is in progress which is a coroutine used by the Pitcher enemy. It is null if it's not in progress
gottaspit bool Yes When calling SpitOut (a coroutine specific to the Pitcher enemy), this needs to be set to false whenever Pitcher should spit out the player party member trapped within them
startdrop bool Yes When a Drop calls occurs, the coroutine will eventually wait for this field to become true so it can proceed with the drops

Spying

Name Type Public? Description
disablespy bool Yes If true, spying is disabled and cannot be performed on any enemy
scopeequipped bool No Whether or not the HPScope medal is equipped. Set as such on StartBattle

General purpose

Name Type Public? Description
tempdata int Yes A general purpose integer for use in DoAction meant to be set externally. This is only used for the Spuder enemy
extraentities EntityControl[] Yes A general purpose array of entities. This is only used when a VenusBoss enemy is involved

Unused fields

These fields are never referenced or never used in any meaningful ways.

Name Type Public? Description
weakenemyfound bool No UNUSED, this is only set to false at the start of DoAction and to true on TryHealEnemyItem when a heal occured, but the field is never read making it unused
actionid int No UNUSED, this is only read during the damage pipeline, but never written to making it unused
oldmusicchannel int No UNUSED
counter int No UNUSED
selection int No UNUSED
specialdefeat bool Yes UNUSED
firstaction bool Yes UNUSED
currententity EntityControl No UNUSED
oldcamtarget Transform No UNUSED, Set to instance.camtarget on StartBattle when it's not a retry
guicooldown float No UNUSED (there is logic in Update implicating it was supposed to be a cooldown that exhausts only during an Update controlled battle, but it is never practically used anywhere else making it practically unused)

MainManager fields

These fields belongs to MainManager, but they are mostly related to BattleControl's state and either have influences on the battle or they are reporting the result of the battle.

Player party

Name Type Static? Description
playerdata BattleData[] No The battle data of the players. The game keeps track of them constantly even outside of battle, but StartBattle resets their fields to a default state
tp int No The amount of TP the player party has (usually clamped from 0 to maxtp)
tpt int No The displayed amount of TP the player party has in the HUD
maxtp int No The maximum amount of TP the player can have (this is basetp + the medals effects from ApplyBadges)
basetp int No The base maximum amount of TP the player can have (this is normally 10 + all the bonuses applied from ApplyStatBonus)
bp int No The amount of MP the player party has, clamped to maxbp
maxbp int No The maximum amount of MP the player party has
partylevel int No The player party's rank, starts at 1 and maxes out at 27 under normal gameplay
partyexp int No The amount of EXP the player party has (this amount is only the one applicable for the current rank's progression)
neededexp int No The amount of EXP needed for the player party to rank up (in other words, partyexp needs to reach this value to rank up). This starts at 100

Battle modifiers

Name Type Static? Description
haltbattleload bool Yes If this is set to true right after StartBattle starts by the caller, StartBattle will wait that it goes to false right after the fade in transition played
battlelossevent bool Yes Tells if ReturnToOverworld should be called without flee if DeadParty happens

Battle state and results

Name Type Static? Description
battle BattleControl Yes The current battle (null if no battle is in progress). Set on StartBattle when it's null (meaning it wasn't a retry)
inbattle bool No Whether we are in battle or not. Set to true on StartBattle after the fade out transition and set to false in a terminal case where we know the battle will end without retry
partyorder int[] No The list of player party members by their animid ordered by their formation in the overworld. Used to align the partypointer on StartBattle
battlenoexp bool Yes Whether the last battle yielded no EXP. Set to false on StartBattle
battlefled bool Yes Tells if the battle ended by fleeing
battleenemyfled bool Yes Whether the battle ended while enemyfled was true without expreward. Set to false on StartBattle. This won't be set to true for an Enemy NPCControl encounter if any GoldenSeedling enemy were defeated
lastdefeated List No The list of enemy ids that were defeated in the last battle (amended when applicable by CheckDead)
lastitemuser int Yes The last player party member's trueid who used an item via UseItem
lastdefeated List No The list of enemy ids that CheckDead detected were killed due to their hp reaching 0 or below. Set to a new list on StartBattle and reset to a new list after processing drops during the Death of the Enemy NPCControl if the battle was caused by a regular encounter
battleresult bool Yes Whether the battle ended by winning (fleeing don't count) Set to true on StartBattle and set to false during TryFlee (when succeeding) and during DeadParty
firstbattleaction bool No This is only set to true on the first StartBattle call since the last save load and it is used to apply an optimisation that involves a dummy DoAction call. This is only needed on the first StartBattle call so when true, this optimisation doesn't happen again