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

monk 3 #363

Merged
merged 2 commits into from
Jun 5, 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
42 changes: 34 additions & 8 deletions BossMod/Autorotation/MNK/MNKActions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Dalamud.Game.ClientState.JobGauge.Types;
using System;
using Dalamud.Game.ClientState.JobGauge.Types;

namespace BossMod.MNK;

Expand All @@ -7,6 +8,7 @@ class Actions : CommonActions
public const int AutoActionST = AutoActionFirstCustom + 0;
public const int AutoActionAOE = AutoActionFirstCustom + 1;
public const int AutoActionFiller = AutoActionFirstCustom + 2;
public const int AutoActionSTQOpener = AutoActionFirstCustom + 3;

private readonly Rotation.State _state;
private readonly Rotation.Strategy _strategy;
Expand Down Expand Up @@ -54,28 +56,37 @@ protected override void UpdateInternalState(int autoAction)
{
UpdatePlayerState();
FillCommonStrategy(_strategy, CommonDefinitions.IDPotionStr);
_strategy.NumBlitzTargets = NumTargetsHitByBlitz();
_strategy.ApplyStrategyOverrides(Autorot.Bossmods.ActiveModule?.PlanExecution?.ActiveStrategyOverrides(Autorot.Bossmods.ActiveModule.StateMachine) ?? []);
_strategy.NumPointBlankAOETargets = autoAction == AutoActionST ? 0 : NumTargetsHitByPBAOE();
_strategy.NumEnlightenmentTargets = Autorot.PrimaryTarget != null && autoAction != AutoActionST && _state.Unlocked(AID.HowlingFist) ? NumTargetsHitByEnlightenment(Autorot.PrimaryTarget) : 0;

_strategy.UseAOE = _strategy.NumPointBlankAOETargets >= 3;
_strategy.UseSTQOpener = autoAction == AutoActionSTQOpener;

if (autoAction == AutoActionFiller)
{
_strategy.FireUse = Rotation.Strategy.FireStrategy.Delay;
_strategy.WindUse = CommonRotation.Strategy.OffensiveAbilityUse.Delay;
_strategy.BrotherhoodUse = CommonRotation.Strategy.OffensiveAbilityUse.Delay;
_strategy.PerfectBalanceUse = CommonRotation.Strategy.OffensiveAbilityUse.Delay;
_strategy.TrueNorthUse = CommonRotation.Strategy.OffensiveAbilityUse.Delay;
}

FillStrategyPositionals(_strategy, Rotation.GetNextPositional(_state, _strategy), _state.TrueNorthLeft > _state.GCD);
}

protected override void QueueAIActions()
{
if (_state.Unlocked(AID.SteelPeak))
SimulateManualActionForAI(ActionID.MakeSpell(AID.Meditation), Player, !Player.InCombat && _state.Chakra < 5);
if (_state.Unlocked(AID.SecondWind))
SimulateManualActionForAI(ActionID.MakeSpell(AID.SecondWind), Player, Player.InCombat && Player.HPMP.CurHP < Player.HPMP.MaxHP * 0.5f);
if (_state.Unlocked(AID.Bloodbath))
SimulateManualActionForAI(ActionID.MakeSpell(AID.Bloodbath), Player, Player.InCombat && Player.HPMP.CurHP < Player.HPMP.MaxHP * 0.8f);
if (_state.Unlocked(AID.Meditation))
SimulateManualActionForAI(ActionID.MakeSpell(AID.Meditation), Player, !Player.InCombat && _state.Chakra < 5);
// TODO: this ends up being super annoying in some cases, maybe reconsider conditions
// if (_state.Unlocked(AID.FormShift))
// SimulateManualActionForAI(ActionID.MakeSpell(AID.FormShift), Player, !Player.InCombat && _state.FormShiftLeft == 0 && _state.PerfectBalanceLeft == 0);
}

protected override NextAction CalculateAutomaticGCD()
Expand All @@ -88,14 +99,14 @@ protected override NextAction CalculateAutomaticGCD()

protected override NextAction CalculateAutomaticOGCD(float deadline)
{
if (!Rotation.HaveTarget(_state, _strategy) || AutoAction < AutoActionAIFight)
if (AutoAction < AutoActionAIFight)
return new();

ActionID res = new();
if (_state.CanWeave(deadline - _state.OGCDSlotLength)) // first ogcd slot
res = Rotation.GetNextBestOGCD(_state, _strategy, deadline - _state.OGCDSlotLength);
res = Rotation.GetNextBestOGCD(_state, _strategy, deadline - _state.OGCDSlotLength, deadline);
if (!res && _state.CanWeave(deadline)) // second/only ogcd slot
res = Rotation.GetNextBestOGCD(_state, _strategy, deadline);
res = Rotation.GetNextBestOGCD(_state, _strategy, deadline, deadline);
return MakeResult(res, Autorot.PrimaryTarget);
}

Expand All @@ -107,6 +118,7 @@ private void UpdatePlayerState()
_state.Chakra = gauge.Chakra;
_state.BeastChakra = gauge.BeastChakra;
_state.Nadi = gauge.Nadi;
_state.BlitzLeft = gauge.BlitzTimeRemaining / 1000f;

(_state.Form, _state.FormLeft) = DetermineForm();
_state.DisciplinedFistLeft = StatusDetails(Player, SID.DisciplinedFist, Player.InstanceID).Left;
Expand All @@ -116,6 +128,14 @@ private void UpdatePlayerState()
_state.FireLeft = StatusDetails(Player, SID.RiddleOfFire, Player.InstanceID).Left;
_state.TrueNorthLeft = StatusDetails(Player, SID.TrueNorth, Player.InstanceID).Left;

// these are functionally the same as far as the rotation is concerned
_state.LostExcellenceLeft = MathF.Max(
StatusDetails(Player, SID.LostExcellence, Player.InstanceID).Left,
StatusDetails(Player, SID.Memorable, Player.InstanceID).Left
);
_state.FoPLeft = StatusDetails(Player, SID.LostFontofPower, Player.InstanceID).Left;
_state.HsacLeft = StatusDetails(Player, SID.BannerHonoredSacrifice, Player.InstanceID).Left;

_state.TargetDemolishLeft = StatusDetails(Autorot.PrimaryTarget, SID.Demolish, Player.InstanceID).Left;
}

Expand All @@ -139,6 +159,7 @@ private void OnConfigModified(MNKConfig config)
SupportedSpell(AID.Bootshine).PlaceholderForAuto = config.FullRotation ? AutoActionST : AutoActionNone;
SupportedSpell(AID.ArmOfTheDestroyer).PlaceholderForAuto = SupportedSpell(AID.ShadowOfTheDestroyer).PlaceholderForAuto = config.FullRotation ? AutoActionAOE : AutoActionNone;
SupportedSpell(AID.TrueStrike).PlaceholderForAuto = config.FillerRotation ? AutoActionFiller : AutoActionNone;
SupportedSpell(AID.SnapPunch).PlaceholderForAuto = config.FullRotation ? AutoActionSTQOpener : AutoActionNone;

// combo replacement
SupportedSpell(AID.FourPointFury).TransformAction = config.AOECombos ? () => ActionID.MakeSpell(Rotation.GetNextComboAction(_state, _strategy)) : null;
Expand All @@ -149,11 +170,16 @@ private void OnConfigModified(MNKConfig config)

SupportedSpell(AID.Thunderclap).TransformTarget = config.SmartThunderclap ? (act) => Autorot.SecondaryTarget ?? act : null;

_strategy.PreCombatFormShift = config.AutoFormShift;

// smart targets
}

private int NumTargetsHitByBlitz()
{
if (_state.BestBlitz is AID.TornadoKick or AID.PhantomRush)
return Autorot.PrimaryTarget == null ? 0 : Autorot.Hints.NumPriorityTargetsInAOECircle(Autorot.PrimaryTarget.Position, 5);
return Autorot.Hints.NumPriorityTargetsInAOECircle(Player.Position, 5);
}

private int NumTargetsHitByPBAOE() => Autorot.Hints.NumPriorityTargetsInAOECircle(Player.Position, 5);
private int NumTargetsHitByEnlightenment(Actor primary) => Autorot.Hints.NumPriorityTargetsInAOERect(Player.Position, (primary.Position - Player.Position).Normalized(), 10, _state.Unlocked(AID.Enlightenment) ? 2 : 1);
}
3 changes: 0 additions & 3 deletions BossMod/Autorotation/MNK/MNKConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,4 @@ class MNKConfig : ConfigNode

[PropertyDisplay("Delay Thunderclap if already in melee range of target")]
public bool PreventCloseDash = true;

[PropertyDisplay("Use Form Shift out of combat")]
public bool AutoFormShift = false;
}
5 changes: 5 additions & 0 deletions BossMod/Autorotation/MNK/MNKDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ public enum SID : uint
Stun = 2, // applied by Leg Sweep to target
FormlessFist = 2513, // applied by Form Shift to self
SixSidedStar = 2514, // applied by Six-Sided Star to self

LostFontofPower = 2346,
BannerHonoredSacrifice = 2327,
LostExcellence = 2564,
Memorable = 2565,
}

public static class Definitions
Expand Down
Loading
Loading