Skip to content

Commit d50cb55

Browse files
Merge pull request #950 from FFXIV-CombatReborn/mergeWIP
clean up
2 parents 37994e5 + 5b8a651 commit d50cb55

File tree

446 files changed

+2172
-1302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

446 files changed

+2172
-1302
lines changed

BossMod/AI/AIBehaviour.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44

55
namespace BossMod.AI;
66

7-
public record struct Targeting(AIHints.Enemy Target, float PreferredRange = 2.6f, Positional PreferredPosition = Positional.Any, bool PreferTanking = false);
7+
public struct Targeting(AIHints.Enemy target, float preferredRange = 2.6f, Positional preferredPosition = Positional.Any, bool preferTanking = false)
8+
{
9+
public AIHints.Enemy Target = target;
10+
public readonly float PreferredRange = preferredRange;
11+
public Positional PreferredPosition = preferredPosition;
12+
public readonly bool PreferTanking = preferTanking;
13+
}
814

915
// constantly follow master
1016
sealed class AIBehaviour(AIController ctrl, RotationModuleManager autorot, Preset? aiPreset) : IDisposable
@@ -95,7 +101,7 @@ public async Task Execute(Actor player, Actor master)
95101
{
96102
autorot.Preset = target.Target != null ? AIPreset : null;
97103
}
98-
UpdateMovement(player, master, target, gazeImminent || pyreticImminent, misdirectionMode ? autorot.Hints.MisdirectionThreshold : default, !forbidTargeting ? autorot.Hints.ActionsToExecute : null);
104+
UpdateMovement(player, master, gazeImminent || pyreticImminent, misdirectionMode ? autorot.Hints.MisdirectionThreshold : default, !forbidTargeting ? autorot.Hints.ActionsToExecute : null);
99105
}
100106
finally
101107
{
@@ -247,7 +253,7 @@ private bool TrackMasterMovement(Actor master)
247253
return masterIsMoving;
248254
}
249255

250-
private void UpdateMovement(Actor player, Actor master, Targeting target, bool gazeOrPyreticImminent, Angle misdirectionAngle, ActionQueue? queueForSprint)
256+
private void UpdateMovement(Actor player, Actor master, bool gazeOrPyreticImminent, Angle misdirectionAngle, ActionQueue? queueForSprint)
251257
{
252258
if (gazeOrPyreticImminent)
253259
{

BossMod/ActionQueue/ActionDefinition.cs

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,19 @@ public float MainReadyIn(ReadOnlySpan<Cooldown> cooldowns, ReadOnlySpan<ClientSt
122122
if (MainCooldownGroup < 0)
123123
return 0;
124124
var cdg = cooldowns[ActualMainCooldownGroup(dutyActions)];
125-
return cdg.Total > 0 ? Math.Max(0, cdg.Total / MaxChargesAtCap() - cdg.Elapsed) : 0;
125+
return cdg.Total > 0f ? Math.Max(0f, cdg.Total / MaxChargesAtCap() - cdg.Elapsed) : default;
126126
}
127127

128-
public float ExtraReadyIn(ReadOnlySpan<Cooldown> cooldowns) => ExtraCooldownGroup >= 0 ? cooldowns[ExtraCooldownGroup].Remaining : 0;
128+
public float ExtraReadyIn(ReadOnlySpan<Cooldown> cooldowns) => ExtraCooldownGroup >= 0 ? cooldowns[ExtraCooldownGroup].Remaining : default;
129129
public float ReadyIn(ReadOnlySpan<Cooldown> cooldowns, ReadOnlySpan<ClientState.DutyAction> dutyActions) => Math.Max(MainReadyIn(cooldowns, dutyActions), ExtraReadyIn(cooldowns));
130130

131131
// return time until charges are capped (for multi-charge abilities; for single-charge this is equivalent to remaining cooldown)
132132
public float ChargeCapIn(ReadOnlySpan<Cooldown> cooldowns, ReadOnlySpan<ClientState.DutyAction> dutyActions, int level)
133133
{
134134
if (MainCooldownGroup < 0)
135-
return 0;
135+
return default;
136136
var cdg = cooldowns[ActualMainCooldownGroup(dutyActions)];
137-
return cdg.Total > 0 ? Math.Max(0, MaxChargesAtLevel(level) * cdg.Total / MaxChargesAtCap() - cdg.Elapsed) : 0;
137+
return cdg.Total > 0f ? Math.Max(0f, MaxChargesAtLevel(level) * cdg.Total / MaxChargesAtCap() - cdg.Elapsed) : default;
138138
}
139139

140140
public bool IsUnlocked(WorldState ws, Actor player)
@@ -168,29 +168,33 @@ public sealed class ActionDefinitions : IDisposable
168168
public const int DutyAction0CDGroup = 80;
169169
public const int DutyAction1CDGroup = 81;
170170

171-
public static readonly ActionID IDSprint = new(ActionType.Spell, 3);
172-
public static readonly ActionID IDAutoAttack = new(ActionType.Spell, 7);
173-
public static readonly ActionID IDAutoShot = new(ActionType.Spell, 8);
174-
public static readonly ActionID IDPotionStr = new(ActionType.Item, 1045995); // hq grade 3 gemdraught of strength
175-
public static readonly ActionID IDPotionDex = new(ActionType.Item, 1045996); // hq grade 3 gemdraught of dexterity
176-
public static readonly ActionID IDPotionVit = new(ActionType.Item, 1045997); // hq grade 3 gemdraught of vitality
177-
public static readonly ActionID IDPotionInt = new(ActionType.Item, 1045998); // hq grade 3 gemdraught of intelligence
178-
public static readonly ActionID IDPotionMnd = new(ActionType.Item, 1045999); // hq grade 3 gemdraught of mind
171+
public static readonly ActionID IDSprint = new(ActionType.Spell, 3u);
172+
public static readonly ActionID IDAutoAttack = new(ActionType.Spell, 7u);
173+
public static readonly ActionID IDAutoShot = new(ActionType.Spell, 8u);
174+
public static readonly ActionID Armslength = new(ActionType.Spell, 7548u);
175+
public static readonly ActionID Surecast = new(ActionType.Spell, 7559u);
176+
public static readonly ActionID Esuna = new(ActionType.Spell, 7568u);
177+
public static readonly ActionID WardensPaean = new(ActionType.Spell, 3561u);
178+
public static readonly ActionID IDPotionStr = new(ActionType.Item, 1045995u); // hq grade 3 gemdraught of strength
179+
public static readonly ActionID IDPotionDex = new(ActionType.Item, 1045996u); // hq grade 3 gemdraught of dexterity
180+
public static readonly ActionID IDPotionVit = new(ActionType.Item, 1045997u); // hq grade 3 gemdraught of vitality
181+
public static readonly ActionID IDPotionInt = new(ActionType.Item, 1045998u); // hq grade 3 gemdraught of intelligence
182+
public static readonly ActionID IDPotionMnd = new(ActionType.Item, 1045999u); // hq grade 3 gemdraught of mind
179183

180184
// content specific consumables
181-
public static readonly ActionID IDPotionSustaining = new(ActionType.Item, 20309);
182-
public static readonly ActionID IDPotionMax = new(ActionType.Item, 1013637);
183-
public static readonly ActionID IDPotionEmpyrean = new(ActionType.Item, 23163);
184-
public static readonly ActionID IDPotionSuper = new(ActionType.Item, 1023167);
185-
public static readonly ActionID IDPotionOrthos = new(ActionType.Item, 38944);
186-
public static readonly ActionID IDPotionHyper = new(ActionType.Item, 1038956);
187-
public static readonly ActionID IDPotionEureka = new(ActionType.Item, 22306);
185+
public static readonly ActionID IDPotionSustaining = new(ActionType.Item, 20309u);
186+
public static readonly ActionID IDPotionMax = new(ActionType.Item, 1013637u);
187+
public static readonly ActionID IDPotionEmpyrean = new(ActionType.Item, 23163u);
188+
public static readonly ActionID IDPotionSuper = new(ActionType.Item, 1023167u);
189+
public static readonly ActionID IDPotionOrthos = new(ActionType.Item, 38944u);
190+
public static readonly ActionID IDPotionHyper = new(ActionType.Item, 1038956u);
191+
public static readonly ActionID IDPotionEureka = new(ActionType.Item, 22306u);
188192

189193
// special general actions that we support
190-
public static readonly ActionID IDGeneralLimitBreak = new(ActionType.General, 3);
191-
public static readonly ActionID IDGeneralSprint = new(ActionType.General, 4);
192-
public static readonly ActionID IDGeneralDuty1 = new(ActionType.General, 26);
193-
public static readonly ActionID IDGeneralDuty2 = new(ActionType.General, 27);
194+
public static readonly ActionID IDGeneralLimitBreak = new(ActionType.General, 3u);
195+
public static readonly ActionID IDGeneralSprint = new(ActionType.General, 4u);
196+
public static readonly ActionID IDGeneralDuty1 = new(ActionType.General, 26u);
197+
public static readonly ActionID IDGeneralDuty2 = new(ActionType.General, 27u);
194198

195199
public static readonly ActionDefinitions Instance = new();
196200

BossMod/ActionQueue/ActionQueue.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,28 @@ public readonly struct Entry(ActionID action, Actor? target, float priority, flo
2828
// note that actions with priority < 0 will never be executed; they can still be added to the queue if it's convenient for the implementation
2929
public static class Priority
3030
{
31-
public const float Minimal = 0; // minimal priority for action to be still considered for execution; do not use directly
31+
public const float Minimal = default; // minimal priority for action to be still considered for execution; do not use directly
3232
// priorities > Minimal and < VeryLow should be used for ??? (don't know good usecases)
33-
public const float VeryLow = 1000; // only use this action if there is nothing else to press
33+
public const float VeryLow = 1000f; // only use this action if there is nothing else to press
3434
// priorities > VeryLow and < Low should be used for actions that can be safely delayed without affecting dps (eg. ability with charges when there is no risk of overcapping or losing raidbuffs any time soon)
35-
public const float Low = 2000; // only use this action if it won't delay dps action (eg. delay if there are any ogcds that need to be used)
35+
public const float Low = 2000f; // only use this action if it won't delay dps action (eg. delay if there are any ogcds that need to be used)
3636
// priorities > Low and < Medium should be used for normal ogcds that are part of the rotation
37-
public const float Medium = 3000; // use this action in first possible ogcd slot, unless there's some hugely important rotational ogcd; you should always have at least 1 slot per gcd to execute Medium actions
37+
public const float Medium = 3000f; // use this action in first possible ogcd slot, unless there's some hugely important rotational ogcd; you should always have at least 1 slot per gcd to execute Medium actions
3838
// priorities > Medium and < High should be used for ogcds that can't be delayed (eg. GNB continuation); code should be careful not to queue more than one such action per gcd window
39-
public const float High = 4000; // use this action asap, unless it would delay gcd (that is - in first possible ogcd slot); careless use could severely affect dps
39+
public const float High = 4000f; // use this action asap, unless it would delay gcd (that is - in first possible ogcd slot); careless use could severely affect dps
4040
// priorities > High and < VeryHigh should be used for gcds, or any other actions that need to delay gcd
41-
public const float VeryHigh = 5000; // drop everything and use this action asap, delaying gcd if needed; almost guaranteed to severely affect dps
41+
public const float VeryHigh = 5000f; // drop everything and use this action asap, delaying gcd if needed; almost guaranteed to severely affect dps
4242
// priorities > VeryHigh should not be used by general code
4343

44-
public const float ManualOGCD = 4001; // manually pressed ogcd should be higher priority than any non-gcd, but lower than any gcd
45-
public const float ManualGCD = 4999; // manually pressed gcd should be higher priority than any gcd; it's still lower priority than VeryHigh, since presumably that action is planned to delay gcd
46-
public const float ManualEmergency = 9000; // this action should be used asap, because user is spamming it
44+
public const float ManualOGCD = 4001f; // manually pressed ogcd should be higher priority than any non-gcd, but lower than any gcd
45+
public const float ManualGCD = 4999f; // manually pressed gcd should be higher priority than any gcd; it's still lower priority than VeryHigh, since presumably that action is planned to delay gcd
46+
public const float ManualEmergency = 9000f; // this action should be used asap, because user is spamming it
4747
}
4848

4949
public readonly List<Entry> Entries = [];
5050

5151
public void Clear() => Entries.Clear();
52-
public void Push(ActionID action, Actor? target, float priority, float expire = float.MaxValue, float delay = 0, float castTime = 0, Vector3 targetPos = default, Angle? facingAngle = null, bool manual = false) => Entries.Add(new(action, target, priority, expire, delay, castTime, targetPos, facingAngle, manual));
52+
public void Push(in ActionID action, Actor? target, float priority, float expire = float.MaxValue, float delay = 0, float castTime = 0, Vector3 targetPos = default, Angle? facingAngle = null, bool manual = false) => Entries.Add(new(action, target, priority, expire, delay, castTime, targetPos, facingAngle, manual));
5353

5454
public Entry FindBest(WorldState ws, Actor player, ReadOnlySpan<Cooldown> cooldowns, float animationLock, AIHints hints, float instantAnimLockDelay, bool allowDismount)
5555
{

0 commit comments

Comments
 (0)