The player chooses the “Twin” command on character (A)
Twin is queued on that character, with a delay of 0
When the pointer comes back around to that character, “Twin” executes:
Their partner (B) is chosen
In FF4FE, if there is more than one potential partner, they are chosen at random from the available twins1)
If there are no other twins who are able to cast, Twin fails
The “TwinCast” command is queued on both twins, with a delay equal to character (A)'s relative agility divided by 22)
The same Action Timer delay is used for both twins
2. The TwinCast command
If the partner already had a command queued, it is replaced with this
TwinCast will execute when the pointer reaches one of the partnered twins and their delay timer has expired
Which twin this will be is highly dependent on the ATB situation
Since both twins have the same timer, if they are in consecutive slots, the twin in the earlier slot will (almost?) always be the one to execute TwinCast
Both twins will start a casting animation
The twin who executes TwinCast will queue either Flare (75%) or Comet (25%)3). This twin's Wisdom stat will be used to calculate damage
Their partner will simply get a Wait command
3. The spell (Flare or Comet)
Works like a normal spell cast at this point, queued and executed by the twin who executed TwinCast, and using their Wisdom stat for damage