Skip to content

Instantly share code, notes, and snippets.

@roccodev
Last active January 15, 2023 16:31
Show Gist options
  • Save roccodev/57d1d90db2fe3418c2df2caa511e2cc6 to your computer and use it in GitHub Desktop.
Save roccodev/57d1d90db2fe3418c2df2caa511e2cc6 to your computer and use it in GitHub Desktop.
XC3 fusion AI

I'll distinguish the following scenarios:

  • Class art is being used and master art is charged: Use class art (automatically fuses) unconditionally (if the class art ends up being used, the master art will also be used no matter priority and conditions)
  • Master art is being used and class art is charged: Section (A)
  • Either art is being used and the other one is on cooldown: Section (B)

Note that "use the art" means to add it to the priority queue like normal. In all other cases, ignore the art entirely.

Section (A): using master art with charged class art
If Condition.field_760B765B = 1, use the master art. (+ fusion)
If the fusion has been active for less than 5 seconds (10 seconds if Fusion First), use the master art. (+ fusion)

Section (B): using art with the other one on cooldown
if Condition.field_B65743C7 = 1, use the art.
Otherwise, calculate the time variable for both arts (formula below), then if (Time(art on cooldown) * 30 / Time(charged art)) is greater than or equal to 30% (60% if Fusion First), use the art.
The time for the art on cooldown is multiplied by 30 for both keves and agnus arts (bug?), which means that agnus arts will always be used no matter the other art's recharge.
(Essentially, this mechanic is used to determine whether using the art now would outbenefit waiting for a fusion.)

Time formula
For keves arts, this is just the cooldown time left (in frames). (If the art is fully charged this is the max cooldown, not 0)
For agnus arts, this is (recharge left) * (Art.LastEligibleFrame/30 + 2/3 + IntervalAT*(1 - AutoAtkAdditives%)), where:

  • Art.LastEligibleFrame is the last hit frame with a DmgRt < 255 (or the first hit frame, if no hits meet that criteria)
  • IntervalAT is always 0 for arts
  • AutoAtkAdditives% is stuff like the auto-attack interval gem, Martial Artist effects, etc.
  • (recharge left) is the max cooldown if fully charged, otherwise it's the recharge "time" left, usually the number of auto-attacks left. Note that this isn't always an integer because e.g. multi-hit auto-attacks only decrease it by a fraction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment