Skip to content

Commit

Permalink
NIN Shukuchi addition
Browse files Browse the repository at this point in the history
  • Loading branch information
Akechi-kun committed Dec 25, 2024
1 parent 18e21cb commit 57e0c26
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 5 deletions.
9 changes: 5 additions & 4 deletions BossMod/Autorotation/Utility/ClassDRGUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
public sealed class ClassDRGUtility(RotationModuleManager manager, Actor player) : RoleMeleeUtility(manager, player)
{
public enum Track { WingedGlide = SharedTrack.Count }
public enum DashStrategy { None, GapClose }
public bool InMeleeRange(Actor? target) => Player.DistanceToHitbox(target) <= 3; //Checks if we're inside melee range
public enum DashStrategy { None, GapClose, GapCloseHold1 }

public static readonly ActionID IDLimitBreak3 = ActionID.MakeSpell(DRG.AID.DragonsongDive);

Expand All @@ -15,7 +14,8 @@ public static RotationModuleDefinition Definition()

res.Define(Track.WingedGlide).As<DashStrategy>("Winged Glide", "Dash", 20)
.AddOption(DashStrategy.None, "Automatic", "No use.")
.AddOption(DashStrategy.GapClose, "GapClose", "Use as gapcloser if outside melee range", 60, 0, ActionTargets.Hostile, 45)
.AddOption(DashStrategy.GapClose, "GapClose", "Use Winged Glide as gapcloser if outside melee range", 60, 0, ActionTargets.Hostile, 45)
.AddOption(DashStrategy.GapCloseHold1, "GapCloseHold1", "Use Winged Glide as gapcloser if outside melee range; conserves 1 charge for manual usage", 60, 0, ActionTargets.Hostile, 84)
.AddAssociatedActions(DRG.AID.WingedGlide);

return res;
Expand All @@ -34,7 +34,8 @@ public override void Execute(StrategyValues strategy, Actor? primaryTarget, floa
private bool ShouldUseDash(DashStrategy strategy, Actor? primaryTarget) => strategy switch
{
DashStrategy.None => false,
DashStrategy.GapClose => !InMeleeRange(primaryTarget),
DashStrategy.GapClose => Player.DistanceToHitbox(primaryTarget) is > 3 and <= 20,
DashStrategy.GapCloseHold1 => Player.DistanceToHitbox(primaryTarget) is > 3 and <= 20 && World.Client.Cooldowns[ActionDefinitions.Instance.Spell(DRG.AID.WingedGlide)!.MainCooldownGroup].Remaining <= 59.9f,
_ => false,
};
}
83 changes: 82 additions & 1 deletion BossMod/Autorotation/Utility/ClassNINUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

public sealed class ClassNINUtility(RotationModuleManager manager, Actor player) : RoleMeleeUtility(manager, player)
{
public enum Track { ShadeShift = SharedTrack.Count }
public enum Track { ShadeShift = SharedTrack.Count, Shukuchi }
public enum DashStrategy { None, GapClose, GapCloseHold1 }

public static readonly ActionID IDLimitBreak3 = ActionID.MakeSpell(NIN.AID.Chimatsuri);

Expand All @@ -13,12 +14,92 @@ public static RotationModuleDefinition Definition()

DefineSimpleConfig(res, Track.ShadeShift, "Shade", "", 400, NIN.AID.ShadeShift, 20);

res.Define(Track.Shukuchi).As<DashStrategy>("Shukuchi", "Dash", 20)
.AddOption(DashStrategy.None, "Automatic", "No use.")
.AddOption(DashStrategy.GapClose, "GapClose", "Use Shukuchi as gapcloser if outside melee range of any target; will dash to target selected via CDPlanner. If none selected, will dash to current target or not at all if no target", 60, 0, ActionTargets.All, 40)
.AddOption(DashStrategy.GapCloseHold1, "GapCloseHold1", "Use Shukuchi as gapcloser if outside melee range; conserves 1 charge for manual usage", 60, 0, ActionTargets.All, 76)
.AddAssociatedActions(NIN.AID.Shukuchi);

return res;
}

public override void Execute(StrategyValues strategy, Actor? primaryTarget, float estimatedAnimLockDelay, bool isMoving)
{
ExecuteShared(strategy, IDLimitBreak3, primaryTarget);
ExecuteSimple(strategy.Option(Track.ShadeShift), NIN.AID.ShadeShift, Player);

var dash = strategy.Option(Track.Shukuchi);
var dashTarget = ResolveTargetOverride(dash.Value) ?? primaryTarget;
var dashStrategy = strategy.Option(Track.Shukuchi).As<DashStrategy>();
if (ShouldUseDash(dashStrategy, primaryTarget))
QueueOGCD(NIN.AID.Shukuchi, dashTarget);

}
private bool ShouldUseDash(DashStrategy strategy, Actor? primaryTarget) => strategy switch
{
DashStrategy.None => false,
DashStrategy.GapClose => Player.DistanceToHitbox(primaryTarget) is > 3 and <= 20,
DashStrategy.GapCloseHold1 => Player.DistanceToHitbox(primaryTarget) is > 3 and <= 20 && World.Client.Cooldowns[ActionDefinitions.Instance.Spell(DRG.AID.WingedGlide)!.MainCooldownGroup].Remaining <= 59.9f,
_ => false,
};

#region Core Execution Helpers

public NIN.AID NextGCD; //Next global cooldown action to be used
public void QueueGCD<P>(NIN.AID aid, Actor? target, P priority, float delay = 0) where P : Enum
=> QueueGCD(aid, target, (int)(object)priority, delay);

public void QueueGCD(NIN.AID aid, Actor? target, int priority = 8, float delay = 0)
{
var NextGCDPrio = 0;

if (priority == 0)
return;

if (QueueAction(aid, target, ActionQueue.Priority.High, delay) && priority > NextGCDPrio)
{
NextGCD = aid;
}
}

public void QueueOGCD<P>(NIN.AID aid, Actor? target, P priority, float delay = 0) where P : Enum
=> QueueOGCD(aid, target, (int)(object)priority, delay);

public void QueueOGCD(NIN.AID aid, Actor? target, int priority = 4, float delay = 0)
{
if (priority == 0)
return;

QueueAction(aid, target, ActionQueue.Priority.Medium + priority, delay);
}

public bool QueueAction(NIN.AID aid, Actor? target, float priority, float delay)
{
if ((uint)(object)aid == 0)
return false;

var def = ActionDefinitions.Instance.Spell(aid);
if (def == null)
return false;

if (def.Range != 0 && target == null)
{
return false;
}

Vector3 targetPos = default;

if (def.AllowedTargets.HasFlag(ActionTargets.Area))
{
if (def.Range == 0)
targetPos = Player.PosRot.XYZ();
else if (target != null)
targetPos = target.PosRot.XYZ();
}

Hints.ActionsToExecute.Push(ActionID.MakeSpell(aid), target, priority, delay: delay, targetPos: targetPos);
return true;
}
#endregion

}

0 comments on commit 57e0c26

Please sign in to comment.