SwitchPos¶
This action coroutine alloews to swap 2 player party member's position with each other.
private IEnumerator SwitchPos(int called, int targeted)
NOTE: The process of switching is complex and involves battle
playerdataaddressing documentation. It is recommended to check this documentation to fully understand how a party swap works.
Parameters¶
called: Theplayerdatsindex that is requesting the swaptargeted: Theplayerdataindex that was targetted for swapping by thecalled's player party member's action
Procedure¶
- The
Switchsound is played actionis set to true changing to an uncontrolled flowcurrentturnis set to -1 which unselects the current player party member- SetLastTurns is called which resets
lastturnsto a new aray with the length being the amount of free players - 1 and all elements being -1 (this resets the player selection cycle) - The called and targeted player party members has their battleentity.
spinset to (0.0, -20.0, 0.0) - 0.33 seconds are yielded
- The
partypointerindexes that maps to the called and targetedplayerdataindexes are found and their value are set to called and targeted respectively (essentially, this converts called and targeted fromplayerdataindexes topartypointerindexes) - Both
partypointerelements whose indexes matches the ones found are swapped. This essentially completes the first party of the swap - 0.1 seconds are yielded
- For each player party members, the second part of the swap is performed:
- battleentity.
overridejumpis set to true - battleentity.
spinis zeroed out pointeris set to the matchingpartypointer. This gives a way to do the same function thanpartypointer, but usingplayerdataindexes. In practice, this feature is UNUSED because the field is only written toplayerdata[partypointer[j]].battleentity position is set to the matchingpartypos. This can be thought as the player party member who had this formation position in the player party is moved to be physically at the matching position of that formation position- If battleentity.
deathcoroutineis in progress, it is stopped and set to null followed by battleentity.animstate being set to 18 (KO)
- battleentity.
- CancelList is called
- UpdateConditionIcons is called which calls UpdateConditionBubbles on all battleentity (all
playerdatawith right to false and allenemydatawithhpabove 0 with right to true) - A frame is yielded
actionis set to false changing to a controlled flow- A frame is yielded (this frame will process in a controlled flow, but the rest is just visual updates so it's safe)
- UpdateAnim is called
- UpdateText is called