Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xan base rename #390

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@

namespace BossMod.Autorotation.xan;

// frick you i'll name my class whatever i want
#pragma warning disable CS8981
#pragma warning disable IDE1006

public enum Targeting { Auto, Manual, AutoPrimary }
public enum OffensiveStrategy { Automatic, Delay, Force }
public enum AOEStrategy { AOE, SingleTarget }

public abstract class xbase<AID, TraitID> : LegacyModule where AID : Enum where TraitID : Enum
public abstract class Basexan<AID, TraitID> : LegacyModule where AID : Enum where TraitID : Enum
{
public class State(RotationModule module) : CommonState(module) { }

Expand All @@ -21,7 +17,9 @@ public class State(RotationModule module) : CommonState(module) { }
protected float TrueNorthLeft { get; private set; }
protected float CombatTimer { get; private set; }

protected xbase(RotationModuleManager manager, Actor player) : base(manager, player)
protected AID ComboLastMove => (AID)(object)_state.ComboLastAction;

protected Basexan(RotationModuleManager manager, Actor player) : base(manager, player)
{
_state = new(this);
}
Expand Down Expand Up @@ -161,7 +159,7 @@ public sealed override void Execute(StrategyValues strategy, Actor? primaryTarge
protected int StatusStacks<SID>(SID status) where SID : Enum => Status(status).Stacks;
}

static class xtensions
static class Extendxan
{
public static RotationModuleDefinition.ConfigRef<Targeting> DefineTargeting<Index>(this RotationModuleDefinition def, Index trackname)
where Index : Enum
Expand Down
17 changes: 13 additions & 4 deletions BossMod/Autorotation/xan/DNC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace BossMod.Autorotation.xan;

public sealed class DNC(RotationModuleManager manager, Actor player) : xbase<AID, TraitID>(manager, player)
public sealed class DNC(RotationModuleManager manager, Actor player) : Basexan<AID, TraitID>(manager, player)
{
public enum Track { AOE, Targeting, Buffs, Partner }
public enum PartnerStrategy { Automatic, Manual }
Expand Down Expand Up @@ -96,7 +96,7 @@ private void CalcNextBestGCD(StrategyValues strategy, Actor? primaryTarget)
var canFlow = CanFlow(out var flowCombo);
var canSymmetry = CanSymmetry(out var symmetryCombo);
var combo2 = NumAOETargets > 1 ? AID.Bladeshower : AID.Fountain;
var haveCombo2 = Unlocked(combo2) && _state.ComboLastAction == (NumAOETargets > 1 ? (uint)AID.Windmill : (uint)AID.Cascade);
var haveCombo2 = Unlocked(combo2) && ComboLastMove == (NumAOETargets > 1 ? AID.Windmill : AID.Cascade);

if (canStarfall && FlourishingStarfallLeft <= _state.AttackGCDTime)
PushGCD(AID.StarfallDance, BestStarfallTarget);
Expand Down Expand Up @@ -329,7 +329,9 @@ public override void Exec(StrategyValues strategy, Actor? primaryTarget, float e

private bool IsFan4Target(Actor primary, Actor other) => Hints.TargetInAOECone(other, Player.Position, 15, Player.DirectionTo(primary), 60.Degrees());

private Actor? FindDancePartner() => World.Party.WithoutSlot().Exclude(Player).MaxBy(p => p.Class switch
private Actor? FindDancePartner()
{
var player = World.Party.WithoutSlot().Exclude(Player).MaxBy(p => p.Class switch
{
Class.SAM => 100,
Class.NIN or Class.VPR => 99,
Expand All @@ -343,5 +345,12 @@ public override void Exec(StrategyValues strategy, Actor? primaryTarget, float e
Class.BRD => 68,
Class.DNC => 67,
_ => 1
}) ?? World.Actors.FirstOrDefault(x => x.Type == ActorType.Chocobo && x.OwnerID == Player.InstanceID);
});

// check if valid target is in cutscene
if (player != null)
return World.Party.Members[World.Party.FindSlot(player.InstanceID)].InCutscene ? null : player;

return World.Actors.FirstOrDefault(x => x.Type == ActorType.Chocobo && x.OwnerID == Player.InstanceID);
}
}
8 changes: 4 additions & 4 deletions BossMod/Autorotation/xan/MCH.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using FFXIVClientStructs.FFXIV.Client.Game.Gauge;

namespace BossMod.Autorotation.xan;
public sealed class MCH(RotationModuleManager manager, Actor player) : xbase<AID, TraitID>(manager, player)
public sealed class MCH(RotationModuleManager manager, Actor player) : Basexan<AID, TraitID>(manager, player)
{
public enum Track { AOE, Targeting, Buffs }

Expand Down Expand Up @@ -109,10 +109,10 @@ private void CalcNextBestGCD(StrategyValues strategy, Actor? primaryTarget)
}
else
{
if ((AID)_state.ComboLastAction == AID.SlugShot && Unlocked(AID.CleanShot))
if (ComboLastMove == AID.SlugShot && Unlocked(AID.CleanShot))
PushGCD(AID.CleanShot, primaryTarget);

if ((AID)_state.ComboLastAction == AID.SplitShot && Unlocked(AID.SlugShot))
if (ComboLastMove == AID.SplitShot && Unlocked(AID.SlugShot))
PushGCD(AID.SlugShot, primaryTarget);

PushGCD(AID.SplitShot, primaryTarget);
Expand Down Expand Up @@ -206,7 +206,7 @@ private bool ShouldReassemble(StrategyValues strategy, Actor? primaryTarget)
return false;

if (!Unlocked(AID.Drill))
return (AID)_state.ComboLastAction == AID.SlugShot;
return ComboLastMove == AID.SlugShot;

return NextToolCD(untilCap: false) <= _state.GCD;
}
Expand Down
Loading