Chompy¶
This action coroutine involves chompy's special attack phase when she is present. It it is called during the player phase after all player party members's actor turns are done. Whether or not this coroutine has ran is tracked by chompyattacked and whether or not it's in progress is tracked by the chompyattack coroutine (chompyaction also tells if the setup is complete).
The actual flow is only switched once the setup is complete meaning this coroutine may stay in a controlled flow for a little while before switching to an uncontrolled flow
Setup¶
This section runs first and performs any waits or setup needed before switching to an uncontrolled flow.
- MainManager.
listredirectis reset to null which is a workaround of the inlist issue - A frame is yielded if there's at least one
extraenemies - All frames are yielded while
checkingdeadis in progress,summonnewenemyis true or while any enemy party member's battleentity is in aforcemove - ReorganizeEnemies(true) is called which removes all dead enemy party members and orders them by battleentity.position.x
- RefreshEnemyPos is called which checks all
enemydatawhosehpis above 0, whose cantfall is false and whose position isGroundorFlying. If the enemy battleentity.heightis above battleentity.minheight+ 0.5, thepositionis set toFlying,Groundotherwise combois set to 1chompyactionis set to true informing that the setup is completeactionis set to true switching to a uncontrolled flow- A frame is yielded
Vine menu setup¶
This section builds the vine menu.
- A new GameObject named
ChompyVineis created and childed tobattlemapwith a position ofchompy's position + (0.0, 10.0, 0.0) - A new GameObject named
Baseis created and childed toChompyVinewith a scale of to (1.0, 0.75, 1.0) and angles of (0.0, -40.0, 0.0) coptionsis set to a new list with 2 elements being 0 and 1 (these are the attack and do nothing options)- The list of the ribbons's item ids in
items[1](key items) is obtained locally via EventControl.ChompyRibbons. Only theChomperRibbon,PoisonRibbon,NumbRibbon,SleepRibbonandRedRibbonitems counts - If the lost of ribbons isn't empty, 3 is added to
coptions(this adds the switch ribbons option) - If flags 404 is true (chompy has a ribbon on her) and flagvar 56 (the item id of the ribbon chompy has on her) isn't
ChomperRibbonRedRibbonor 0 (which means unequipped here), 2 is added tocoptions(this adds the the ribbon specific attack option) maxoptionsis set to the final amount ofcoptionsoptionis set tochompyoption. This means the default option will be the last one selected during the battle, but if that option index is no longer available by checking if it's equal or higher thanmaxoption,optionis set to 0 instead (attack)- For each option indexes available from 0 to
maxoptionsexclusive:- A
Prefabs/Objects/Vineis instantiated to a new GameObject childed to theBasewith a position ofChompyVine's position + (0.0, 0.0, -1.0), a scale of (2.5, 2.5, 2.5) and a SpriteRenderer component ChompyVine's angles are decremented by (0.0, 360 /maxoptionsconverted to float, 0.0)- The sprite of the SpriteRenderer of the vine GameObject is set depending on the corrsponding
coptionmatching the option index:- 0 (Attack):
guisprites[147] - 1 (Do Nothing):
guisprites[148] - 2 (Ribbon specific action): Depends on the flagvar 56 (the item id of the ribbon chompy has on her). This also initialises the attack property of the bite specific attack (check the selected option handling for details). The sprite is
guisprites[158]for thePoisonRibbon,guisprites[159]for theNumbRibbonandguisprites[160]for theSleepRibbon. Additionally, if instance.tpis less than 2, the material of the sprite is set to MainManager.grayscale - 3: (Switch Ribbon)
guisprites[217]
- 0 (Attack):
- The sprite of the vine GameObject's flipX is set to true
- A
- currentaction is set to
Chompy - UpdateText is called
Vine menu selection loop¶
This is an infinite loop that runs until an option has been confirmed in the vine menu. Everything in this section runs perpetually until explicitly said otherwise.
- RefreshEnemyHP is called
- As long as input 4 (confirm) isn't pressed, the following runs in an inner infinite loop:
- If input 3 (left) or input 2 (right) is pressed, the
Scrollsound is played followed by theoptionbeing decremented or incremented accordingly with wrap around tomaxoptions- 1 followed by UpdateText being called Basey angle is lerped from the existing one to -option* (360.0 /maxoptions) - 40.0 with a factor of 1/10 of the game's frametimeBase's y scale is lerped from the existing one to 1.0 with a factor of 1/10 of the game's frametime (the x and z scale are set to 1.0)- A frame is yielded
- If input 3 (left) or input 2 (right) is pressed, the
- Getting here means a main vine menu option was chosen. If it's 2 (ribbon specific action) while instance.
tpis less than 2, the buzzer sound is played followed by a frame yield followed by perfoming another iteration of the selection loop - If the confimed option isn't 3 (switch ribbons), the slection loop ends (switch ribbon is the only option that needs further handling once chosen)
- The
Confirmsound is played if it wasn't already - currentaction is set to
BaseAction - UpdateTect is called
- instance.
multilistis set to the ribbons list obtained earlier except the one held in flagvar 56 (the one chompy has on her) - SetText is called in dialogue mode using the text
|hide||pickitem,35,-11,-11|(which pops an ItemList with the chompy ribbons list type). The call has these properties:- fonttype of 0 (
BubblegumSans) - linebreak of
messagebreak - No tridimensional
- position of Vector3.zero
- No cameraoffset
- size of Vector3.one
- No parent
- No caller
- fonttype of 0 (
- RefreshEnemyHP is called
- As long as the message lock is active:
Base's y angle is set to a lerp from the existing one to -option* (360.0 /maxoptions) - 40.0 with a fractor offramestep* 0.1Base's y scale is lerped from the existing one to 1.0 with a factor offramestep* 0.1 (the x and z scale are set to 1.0)- A frame is yielded
- Getting here means the ItemList handling and the dialogue has completed. If MainManager.
listcancelledis true, it means the selection loop isn't done yet and the following is performed:optionis set to the value it had before the SetText call (this is because the ItemList system uses it so it restores the value to continue being used for the vine menu)maxoptionsis set to the amount ofcoptions(this is also because it was used as part of ItemList)- currentaction is set back to
Chompy - UpdateText is called
- Another iteration of the vine menu selection loop is performed
- The value of flagvar 0 is saved locally (this corresponds to the item id of the selected ribbon)
- The vine menu selection loop ends here as the switch ribbon option was just confirmed
Selected option handling¶
Getting here means that an option has been confirmed in the vine menu selection loop and the coroutine is ready to handle it.
chompyoptionis set to the selectedoption- currentaction is reset to
BaseAction - UpdateText is called
- The
Confirmsound is played - The
ChompyVineobject is destroyed hideenemyhpis set to true
What follows depends on the coption[option] selected.
0 (Attack) or 2 (Ribbon specific action)¶
- If the
coptionis 2 (ribbon specific action), instance.tpis decreased by 2 - All player party members has DestroyConditionIcons called on their entity (not battleentity)
- All enemy party members has DestroyConditionIcons called on their entity if it exists (this is normally the same than battleentity)
- The enemy party member to target is obtained by getting the first one whose position is
Groundorenemydata[0]if none are found - MainManager.SetCamera is called with no target, the targetted enemy's battleentity's position as the targetpos, 0.03 as the speed and (0.0, 2.85, -7.5) as the offset
- The x/z position of
chompyare saved locally (the y component is saved to 0.0) chompy'soverrideflipis set to true- MoveTowards is called on
chompyto move towards the targetted enemy's battleentity's position + (0.0 - thesizeof the targetted enemy, 0.0, -0.1) with a multiplier of 3.0 - All frames are yielded while
chompyis in aforcemove chompy's animstate is set to 100- The
Chewsound is played with a pitch of 1.5 - If the targetted enemy's position is indeed
Ground(always happen unless no grounded enemies existed earlier):- DoCommand is called with a timer of 60.0, a commandtype of
PressKeyTimerand a data being a one element array containing a random integer between 4 and 6 converted to float - A frame is yielded
- All frames are yielded while
doingactionis true
- DoCommand is called with a timer of 60.0, a commandtype of
- A base amount of damage to deal is determined. It's 2 + the amount of
HelperBoostmedals equipped (under normal gameplay, there's only 1 medal so the value is 3 with the medal, 2 without) - If the targetted enemy's position is indeed
Ground(always happen unless no grounded enemies existed earlier) andcommandsuccessis true:chompy's animstate is set to 102- The
Bitesound is played with a pitch of 1.25 - DoDamage is called without attacker to the targetted enemy for a damage of the base amount determined earlier (with 1 added if flags 404 is true and flagvar 56 is
ChomperRibbonmeaning that ribbon is currently on Chompy) without block. The property depends on the ribbon:PoisonRibbon:PoisonNumbRibbon:NumbSleepRibbon:Sleep- Anything else: No properties
- if flagvar 56 (the item id of the ribbon chompy has on her) is
RedRibbonandlastdamageis above 0:- instance.
tpis incremented then clamped from 0 to instance.maxtp - The
Heal2sound is played - ShowDamageCounter is called with type 2 (TP) with an ammount of 1 starting from
chompy's position + (-1.0, 1.0, 0.0) and ending at Vector3.up
- instance.
- Otherwise (meaning no grounded enemies existed or the action command was failed):
- 0.1 seconds are yielded
- The
AtkFailsound is played chompy's animstate is set to 103
- 0.4 seconds are yielded
- SetDefaultCamera is called
chompy'srigidconstraints are set to freeze everything except x/z position- MoveTowards is called on
chompyto move her to the position saved earlier with a multiplier of 2.0 - All frames are yielded while
chompyis in aforcemove - StopForceMove is called on
chompy chompy'srigidgravity is enabledchompy's position is set to the one saved earlier- A frame is yielded
chompy'sflipis set to truechompy'soverrideflipis reset to falsestartdropis set to true (this allows enemies that requires dropping to finish their drops)- A frame is yielded (this lets the drops finish)
startdropis set back to false (since it's no longer needed)- The targetted enemy party member (if any existed) has their
blockTimesreset to 0 checkingdeadis set to a new CheckDead coroutine- All frames are yielded while
checkingdeadis in progress - If there's still any enemy party member with an
hpabove 0,actionis set to false switching to a controlled flow (this means the flow isn't changed if all enemies are dead)
1 (Do Nothing)¶
The only thing that happens is action is set to false switching to a controlled flow
3 (Switch ribbon)¶
- The
Switchsound is played chompy'sspinis set to (0.0, -20.0, 0.0)- 0.33 seconds are yielded
- The selected ribbon's item id is removed from
items[1](key items) - If flags 404 is false (Chompy doesn't have a ribbon on her), flags 404 is set to true. Otherwise, flagvar 56 (the item id of the ribbon chompy has on her) is added to
items[1](key items) if it didn't existed in the list already - flagvar 56 (the item id of the ribbon chompy has on her) is set to the selected ribbon item id
- ChompyRibbon is called on
chompyusing theirextrasprites[0](their ribbon) which changes its color depending on flagvar 56 (the item id of the ribbon chompy has on her):PoisonRibbon: Lerp between pure red and pure blue with a factor of 0.65 (this means purple with a bit more blue)NumbRibbon: Lerp between pure yellow and pure black with a factor of 0.2 (mostly yellow)SleepRibbon: Lerp between pure green and pure black with a factor of 0.3 (mostly green)RedRibbon: Lerp between pure white and pure bluw with a factor of 0.5 (light blue)- Any other item id: Lerp between pure red and pure white with a factor of 0.5 (light red)
- 0.1 seconds are yielded
chompy'sspinis zeroed outactionis set to false switching to a controlled flow
End¶
This section contains all the cleanup steps needed to end the action coroutine.
- A frame is yielded if there's at least one
extraenemies - All frames are yielded while
checkingdeadis in progress,summonnewenemyis true or while any enemy party member's battleentity is in aforcemove - RefreshEnemyHP is called
chompyactionis reset to falsechompyattackedis set to truechompyattackis set to null indicating the coroutine is done