diff --git a/BossMod/Autorotation/MiscAI/AutoPull.cs b/BossMod/Autorotation/MiscAI/AutoPull.cs index a19a7cd70a..9909f8b642 100644 --- a/BossMod/Autorotation/MiscAI/AutoPull.cs +++ b/BossMod/Autorotation/MiscAI/AutoPull.cs @@ -29,7 +29,7 @@ public override void Execute(StrategyValues strategy, Actor? primaryTarget, floa enabled |= Bossmods.ActiveModule?.Info?.Category == BossModuleInfo.Category.Quest; if (strategy.Enabled(Track.DeepDungeon)) - enabled |= Bossmods.ActiveModule?.Info?.Category == BossModuleInfo.Category.DeepDungeon && World.Party.WithoutSlot().Count() == 1; + enabled |= Bossmods.ActiveModule?.Info?.Category == BossModuleInfo.Category.DeepDungeon && World.Party.WithoutSlot().Length == 1; if (strategy.Enabled(Track.EpicEcho)) enabled |= Player.Statuses.Any(s => s.ID == 2734); diff --git a/BossMod/Autorotation/Standard/xan/Melee/MNK.cs b/BossMod/Autorotation/Standard/xan/Melee/MNK.cs index 4e8d110e4e..7a95c99416 100644 --- a/BossMod/Autorotation/Standard/xan/Melee/MNK.cs +++ b/BossMod/Autorotation/Standard/xan/Melee/MNK.cs @@ -118,7 +118,6 @@ public static RotationModuleDefinition Definition() .AddOption(WRStrategy.PreDowntime, "Ensure usage at least 2 GCDs before next downtime", minLevel: 96) .AddAssociatedActions(AID.WindsReply); - // PB-related settings def.Define(Track.PB).As("PB", uiPriority: 89) .AddOption(PBStrategy.Automatic, "Automatically use after Opo before or during Riddle of Fire", minLevel: 50) diff --git a/BossMod/Debug/DebugQuests.cs b/BossMod/Debug/DebugQuests.cs index 61238fff61..9a0b71dc5b 100644 --- a/BossMod/Debug/DebugQuests.cs +++ b/BossMod/Debug/DebugQuests.cs @@ -48,8 +48,8 @@ public DebugQuests() foreach (var quests in _dailyQuests.Values) { quests.AllQuests.SortBy(q => (q.Unknown11 == 3, q.RowId)); - var rankMin = (int)quests.AllQuests.Select(q => q.BeastReputationRank.RowId).Min(); - var rankMax = (int)quests.AllQuests.Select(q => q.BeastReputationRank.RowId).Max(); + var rankMin = (int)quests.AllQuests.Min(q => q.BeastReputationRank.RowId); + var rankMax = (int)quests.AllQuests.Max(q => q.BeastReputationRank.RowId); var rankCur = RankForQuest(quests.AllQuests[0], out var rankedUp); quests.OutrankAll = quests.AllQuests.All(q => RankForQuest(q, out _) > q.BeastReputationRank.RowId); quests.AvailableQuests = CalculateAvailable(quests.AllQuests, QuestManager.Instance()->DailyQuestSeed, quests.OutrankAll, rankCur, rankedUp); diff --git a/BossMod/Modules/Endwalker/Savage/P3SPhoinix/FledglingFlight.cs b/BossMod/Modules/Endwalker/Savage/P3SPhoinix/FledglingFlight.cs index 39d26fdc19..7213897a84 100644 --- a/BossMod/Modules/Endwalker/Savage/P3SPhoinix/FledglingFlight.cs +++ b/BossMod/Modules/Endwalker/Savage/P3SPhoinix/FledglingFlight.cs @@ -20,7 +20,7 @@ public override void Update() foreach ((var i, var player) in Raid.WithSlot(false, true, true)) { _playerDeathTollStacks[i] = player.FindStatus((uint)SID.DeathsToll)?.Extra ?? 0; // TODO: use status events here... - _playerAOECount[i] = _sources.Where(srcRot => player.Position.InCone(srcRot.Item1.Position, srcRot.Item2, _coneHalfAngle)).Count(); + _playerAOECount[i] = _sources.Count(srcRot => player.Position.InCone(srcRot.Item1.Position, srcRot.Item2, _coneHalfAngle)); } } diff --git a/BossMod/Modules/Endwalker/Savage/P4S2Hesperos/WreathOfThorns4.cs b/BossMod/Modules/Endwalker/Savage/P4S2Hesperos/WreathOfThorns4.cs index ffa43c19b9..1d1af8d0f5 100644 --- a/BossMod/Modules/Endwalker/Savage/P4S2Hesperos/WreathOfThorns4.cs +++ b/BossMod/Modules/Endwalker/Savage/P4S2Hesperos/WreathOfThorns4.cs @@ -207,7 +207,7 @@ private WPos DetermineWaterSafeSpot(Actor source) { var ccw = Service.Config.Get().Act4DarkSoakCCW; var pos = RotateCW(source.Position, (ccw ? -1 : 1) * 45.Degrees(), 18); - return _playerTetherSource.Where(x => x != null && x.Position.InCircle(pos, 4)).FirstOrDefault(); + return _playerTetherSource.FirstOrDefault(x => x != null && x.Position.InCircle(pos, 4)); } private Actor? NextAOE() diff --git a/BossMod/Modules/Endwalker/Savage/P9SKokytos/ArchaicRockbreaker.cs b/BossMod/Modules/Endwalker/Savage/P9SKokytos/ArchaicRockbreaker.cs index a9b1ab7049..85aa114374 100644 --- a/BossMod/Modules/Endwalker/Savage/P9SKokytos/ArchaicRockbreaker.cs +++ b/BossMod/Modules/Endwalker/Savage/P9SKokytos/ArchaicRockbreaker.cs @@ -7,13 +7,13 @@ class ArchaicRockbreakerShockwave(BossModule module) : Components.Knockback(modu private readonly DateTime _activation = module.WorldState.FutureTime(6.5f); private static readonly List Walls0 = [new(new(93, 117.5f), new(108, 117.5f)), new(new(82.5f, 93), new(82.5f, 108)), new(new(117.5f, 93), new(117.5f, 108)), new(new(93, 82.5f), new(108, 82.5f))]; - private static readonly List Walls45 = Walls0.Select(wall => RotatedSafeWall(wall.Vertex1, wall.Vertex2)).ToList(); + private static readonly List Walls45 = [.. Walls0.Select(wall => RotatedSafeWall(wall.Vertex1, wall.Vertex2))]; public override IEnumerable Sources(int slot, Actor actor) { if (Arena.Bounds == P9SKokytos.arenaUplift0) yield return new(Arena.Center, 21, _activation, SafeWalls: Walls0); - if (Arena.Bounds == P9SKokytos.arenaUplift45) + else if (Arena.Bounds == P9SKokytos.arenaUplift45) yield return new(Arena.Center, 21, _activation, SafeWalls: Walls45); } diff --git a/BossMod/Modules/Global/DeepDungeon/AutoClear.cs b/BossMod/Modules/Global/DeepDungeon/AutoClear.cs index 78a5576917..9542bee46e 100644 --- a/BossMod/Modules/Global/DeepDungeon/AutoClear.cs +++ b/BossMod/Modules/Global/DeepDungeon/AutoClear.cs @@ -64,7 +64,7 @@ public abstract class AutoClear : ZoneModule public record class Gaze(Actor Source, AOEShape Shape); - protected static readonly AutoDDConfig _config = Service.Config.Get(); + protected static readonly AutoDDConfig Config = Service.Config.Get(); private readonly EventSubscriptions _subscriptions; private readonly List _trapsCurrentZone = []; @@ -254,19 +254,19 @@ private void ClearState() protected void AddLOS(Actor Source, float Range) { - if (_config.AutoLOS) + if (Config.AutoLOS) AddLOSFromTerrain(Source, Range); else Circles.Add((Source, Range)); } - private bool OpenGold => _config.GoldCoffer; + private bool OpenGold => Config.GoldCoffer; private bool OpenSilver { get { // disabled - if (!_config.SilverCoffer) + if (!Config.SilverCoffer) return false; // sanity check @@ -289,9 +289,9 @@ private bool OpenSilver } } - private bool OpenBronze => _config.BronzeCoffer; + private bool OpenBronze => Config.BronzeCoffer; - public override bool WantDrawExtra() => _config.EnableMinimap && !Palace.IsBossFloor; + public override bool WantDrawExtra() => Config.EnableMinimap && !Palace.IsBossFloor; public sealed override string WindowName() => "BMR DD minimap###Zone module"; @@ -304,12 +304,12 @@ public override void DrawExtra() ImGui.Text($"Kills: {Kills}"); - var navInCombat = _config.NavigateInCombat; + var navInCombat = Config.NavigateInCombat; if (ImGui.Checkbox("Allow navigation in combat", ref navInCombat)) { - _config.NavigateInCombat = navInCombat; - _config.Modified.Fire(); + Config.NavigateInCombat = navInCombat; + Config.Modified.Fire(); } if (ImGui.Button("Reload obstacles")) @@ -389,7 +389,7 @@ protected virtual void CalculateExtraHints(int playerSlot, Actor player, AIHints public override void CalculateAIHints(int playerSlot, Actor player, AIHints hints) { - if (!_config.Enable || Palace.IsBossFloor || BetweenFloors) + if (!Config.Enable || Palace.IsBossFloor || BetweenFloors) return; foreach (var (w, rot) in Walls) @@ -448,7 +448,7 @@ public override void CalculateAIHints(int playerSlot, Actor player, AIHints hint } var fullClear = false; - if (_config.FullClear) + if (Config.FullClear) { var unexplored = Array.FindIndex(Palace.Rooms, d => (byte)d > 0 && !d.HasFlag(RoomFlags.Revealed)); if (unexplored > 0) @@ -458,8 +458,7 @@ public override void CalculateAIHints(int playerSlot, Actor player, AIHints hint } } - - if (_config.TrapHints && _trapsHidden) + if (Config.TrapHints && _trapsHidden) { var count = _trapsCurrentZone.Count; var traps = new List>(count); @@ -512,10 +511,10 @@ public override void CalculateAIHints(int playerSlot, Actor player, AIHints hint hints.ActionsToExecute.Push(new ActionID(ActionType.Pomander, (uint)p2), null, ActionQueue.Priority.VeryHigh); Actor? wantCoffer = null; - if (coffer is Actor t && !IsPlayerTransformed(player) && (_config.AutoMoveTreasure && (!player.InCombat || _config.NavigateInCombat) || player.DistanceToHitbox(t) < 3.5f)) + if (coffer is Actor t && !IsPlayerTransformed(player) && (Config.AutoMoveTreasure && (!player.InCombat || Config.NavigateInCombat) || player.DistanceToHitbox(t) < 3.5f)) wantCoffer = t; - if (!player.InCombat && _config.AutoPassage && Palace.PassageActive) + if (!player.InCombat && Config.AutoPassage && Palace.PassageActive) { if (DesiredRoom == 0) DesiredRoom = Array.FindIndex(Palace.Rooms, d => d.HasFlag(RoomFlags.Passage)); @@ -525,7 +524,7 @@ public override void CalculateAIHints(int playerSlot, Actor player, AIHints hint hints.GoalZones.Add(hints.GoalSingleTarget(c.Position, 2f, 0.5f)); // give pathfinder a little help lmao hints.GoalZones.Add(hints.GoalSingleTarget(c.Position, 25f, 0.25f)); - if (player.DistanceToHitbox(c) < player.DistanceToHitbox(coffer) && !_config.OpenChestsFirst) + if (player.DistanceToHitbox(c) < player.DistanceToHitbox(coffer) && !Config.OpenChestsFirst) wantCoffer = null; } } @@ -540,10 +539,10 @@ public override void CalculateAIHints(int playerSlot, Actor player, AIHints hint if (revealedTraps.Count > 0) hints.AddForbiddenZone(ShapeDistance.Union(revealedTraps)); - if (!IsPlayerTransformed(player) && (!player.InCombat || _config.NavigateInCombat) && _config.AutoMoveTreasure && hoardLight is Actor h && Palace.GetPomanderState(PomanderID.Intuition).Active) + if (!IsPlayerTransformed(player) && (!player.InCombat || Config.NavigateInCombat) && Config.AutoMoveTreasure && hoardLight is Actor h && Palace.GetPomanderState(PomanderID.Intuition).Active) hints.GoalZones.Add(hints.GoalSingleTarget(h.Position, 2f, 10f)); - var shouldTargetMobs = _config.AutoClear switch + var shouldTargetMobs = Config.AutoClear switch { AutoDDConfig.ClearBehavior.Passage => !Palace.PassageActive, AutoDDConfig.ClearBehavior.Leveling => player.Level < LevelCap || !Palace.PassageActive, @@ -681,7 +680,7 @@ private void DrawAOEs(int playerSlot, Actor player, AIHints hints) private void HandleFloorPathfind(Actor player, AIHints hints) { - if (player.InCombat && !_config.NavigateInCombat) + if (player.InCombat && !Config.NavigateInCombat) return; var playerRoom = Palace.Party[0].Room; diff --git a/BossMod/Modules/Global/DeepDungeon/LevelData.cs b/BossMod/Modules/Global/DeepDungeon/LevelData.cs index 6c33b65ef4..bb09ac920b 100644 --- a/BossMod/Modules/Global/DeepDungeon/LevelData.cs +++ b/BossMod/Modules/Global/DeepDungeon/LevelData.cs @@ -14,7 +14,7 @@ Tileset RoomsB [Serializable] public record class Tileset(List> Rooms) { - public Tileset Map(Func Mapping) => new(Rooms.Select(m => m.Map(Mapping)).ToList()); + public Tileset Map(Func Mapping) => new([.. Rooms.Select(m => m.Map(Mapping))]); public RoomData this[int index] => Rooms[index]; diff --git a/BossMod/Modules/Global/Quest/FF16Collab/InfernalShadow.cs b/BossMod/Modules/Global/Quest/FF16Collab/InfernalShadow.cs index c051f5e323..69c5c49b61 100644 --- a/BossMod/Modules/Global/Quest/FF16Collab/InfernalShadow.cs +++ b/BossMod/Modules/Global/Quest/FF16Collab/InfernalShadow.cs @@ -52,7 +52,7 @@ public override void OnCastStarted(Actor caster, ActorCastInfo spell) if ((AID)spell.Action.ID is AID.FieryRampageCleaveReal or AID.FieryRampageCleaveReal2) { _castersunsorted.Add((caster.Position, spell.Rotation, Module.CastFinishAt(spell), spell.Action.ID)); // casters appear in random order in raw ops - _casters = _castersunsorted.OrderBy(x => x.AID).Select(x => (x.position, x.rotation, x.activation)).ToList(); + _casters = [.. _castersunsorted.OrderBy(x => x.AID).Select(x => (x.position, x.rotation, x.activation))]; } } @@ -135,7 +135,7 @@ public override void OnCastStarted(Actor caster, ActorCastInfo spell) if ((AID)spell.Action.ID is AID.EruptionReal2 or AID.EruptionReal3 or AID.EruptionReal4) { _castersunsorted.Add((spell.LocXZ, Module.CastFinishAt(spell), spell.Action.ID)); - _casters = _castersunsorted.OrderBy(x => x.AID).Select(x => (x.position, x.activation)).ToList(); + _casters = [.. _castersunsorted.OrderBy(x => x.AID).Select(x => (x.position, x.activation))]; } } diff --git a/BossMod/Modules/Stormblood/Dungeon/D02ShisuiOfTheVioletTides/D022RubyPrincess.cs b/BossMod/Modules/Stormblood/Dungeon/D02ShisuiOfTheVioletTides/D022RubyPrincess.cs index ed603222fd..ff5a7d5f5c 100644 --- a/BossMod/Modules/Stormblood/Dungeon/D02ShisuiOfTheVioletTides/D022RubyPrincess.cs +++ b/BossMod/Modules/Stormblood/Dungeon/D02ShisuiOfTheVioletTides/D022RubyPrincess.cs @@ -36,7 +36,7 @@ class SeduceOld(BossModule module) : Components.GenericAOEs(module) private static readonly AOEShapeCircle circle = new(2.5f); private bool active; private bool addedCircles; - private readonly HashSet chests = module.Enemies(OID.Helper).Where(x => x.NameID == 6274).ToHashSet(); + private readonly HashSet chests = [.. module.Enemies(OID.Helper).Where(x => x.NameID == 6274)]; private readonly HashSet closedChests = []; private readonly HashSet openChests = []; diff --git a/BossMod/QuestBattle/QuestBattle.cs b/BossMod/QuestBattle/QuestBattle.cs index ce10dfecad..90e3d39efc 100644 --- a/BossMod/QuestBattle/QuestBattle.cs +++ b/BossMod/QuestBattle/QuestBattle.cs @@ -523,7 +523,7 @@ private async Task> TryPathfind(IEnumerable c ptVecs.RemoveAt(ptVecs.Count - 1); Log(string.Join(", ", ptVecs.Select(Utils.Vec3String))); - thesePoints = ptVecs.Take(ptVecs.Count - 1).Select(p => new NavigationWaypoint(p, false)).ToList(); + thesePoints = [.. ptVecs.Take(ptVecs.Count - 1).Select(p => new NavigationWaypoint(p, false))]; thesePoints.Add(new NavigationWaypoint(ptVecs.Last(), true)); } else diff --git a/BossMod/Replay/Analysis/ArenaBounds.cs b/BossMod/Replay/Analysis/ArenaBounds.cs index 86db01dfa5..e46841a1ab 100644 --- a/BossMod/Replay/Analysis/ArenaBounds.cs +++ b/BossMod/Replay/Analysis/ArenaBounds.cs @@ -134,7 +134,7 @@ private static List FilterClosePoints(IEnumerable points, double eps } private static Path64 ConvertToPath64(List points) => [.. points.Select(p => new Point64((long)(p.X * PolygonClipper.Scale), (long)(p.Z * PolygonClipper.Scale))).ToList()]; - private static List ConvertToPoints(Path64 path) => path.Select(p => new WPos((float)(p.X * PolygonClipper.InvScale), (float)(p.Y * PolygonClipper.InvScale))).ToList(); + private static List ConvertToPoints(Path64 path) => [.. path.Select(p => new WPos((float)(p.X * PolygonClipper.InvScale), (float)(p.Y * PolygonClipper.InvScale)))]; public static List GenerateConcaveHull(List points, float alpha, float epsilon) { diff --git a/BossMod/Replay/Visualization/ColumnEnemiesCastEvents.cs b/BossMod/Replay/Visualization/ColumnEnemiesCastEvents.cs index 03b0b1e41b..13fc301ef4 100644 --- a/BossMod/Replay/Visualization/ColumnEnemiesCastEvents.cs +++ b/BossMod/Replay/Visualization/ColumnEnemiesCastEvents.cs @@ -21,7 +21,7 @@ public ColumnEnemiesCastEvents(Timeline timeline, StateMachineTree tree, List a.Source.Type is not (ActorType.Player or ActorType.Pet or ActorType.Chocobo or ActorType.Buddy)).ToList(); + _actions = [.. replay.EncounterActions(enc).Where(a => a.Source.Type is not (ActorType.Player or ActorType.Pet or ActorType.Chocobo or ActorType.Buddy))]; foreach (var a in _actions) { var f = _filters.GetOrAdd(a.ID);