Skip to content

Commit

Permalink
Merge pull request #484 from FFXIV-CombatReborn/mergeWIP
Browse files Browse the repository at this point in the history
more code analyzer fixes
  • Loading branch information
CarnifexOptimus authored Dec 5, 2024
2 parents b47944c + 7e37f53 commit 08a2074
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 24 deletions.
1 change: 0 additions & 1 deletion BossMod/Autorotation/MiscAI/StayWithinLeylines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,5 @@ public override void Execute(StrategyValues strategy, Actor? primaryTarget, floa
Hints.GoalZones.Add(Hints.GoalSingleTarget(zone.Position, 1f));
}
}

}
}
4 changes: 2 additions & 2 deletions BossMod/Components/Twister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ public class GenericTwister(BossModule module, float radius, uint oid, ActionID
{
private readonly AOEShapeCircle _shape = new(radius);
private readonly uint _twisterOID = oid;
protected IReadOnlyList<Actor> Twisters = module.Enemies(oid);
protected readonly List<Actor> Twisters = module.Enemies(oid);
protected DateTime PredictedActivation;
protected List<WPos> PredictedPositions = [];
protected readonly List<WPos> PredictedPositions = [];

public IEnumerable<Actor> ActiveTwisters => Twisters.Where(v => v.EventState != 7);
public bool Active => ActiveTwisters.Any();
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/Dawntrail/Extreme/Ex2ZoraalJa/AeroIII.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class AeroIII(BossModule module) : Components.Knockback(module, ignoreImmunes: true)
{
public readonly IReadOnlyList<Actor> Voidzones = module.Enemies(OID.BitingWind);
public readonly List<Actor> Voidzones = module.Enemies(OID.BitingWind);

private static readonly AOEShapeCircle _shape = new(4);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ public TtokrroneStates(BossModule module) : base(module)
public class Ttokrrone(WorldState ws, Actor primary) : BossModule(ws, primary, new(53, -820), new ArenaBoundsCircle(29.5f))
{
// if boss is pulled when player is really far away and helpers aren't loaded, some components might never see resolve casts and get stuck forever
protected override bool CheckPull() => base.CheckPull() && Enemies(OID.Helper).Any();
protected override bool CheckPull() => base.CheckPull() && Enemies(OID.Helper).Count != 0;
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public Ex2HydaelynStates(BossModule module) : base(module)
{
SimplePhase(0, Phase1, "P1")
.ActivateOnEnter<WeaponTracker>()
.Raw.Update = () => Module.Enemies(OID.CrystalOfLight).Any();
.Raw.Update = () => Module.Enemies(OID.CrystalOfLight).Count != 0;
DeathPhase(1, Phase2)
.ActivateOnEnter<WeaponTracker>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ struct PlayerState

public int NumPlayerTethers { get; private set; }
public int NumShapeTethers { get; private set; }
private readonly IReadOnlyList<Actor> _hexa = module.Enemies(OID.ConceptOfWater);
private readonly IReadOnlyList<Actor> _tri = module.Enemies(OID.ConceptOfFire);
private readonly IReadOnlyList<Actor> _sq = module.Enemies(OID.ConceptOfEarth);
private readonly List<Actor> _hexa = module.Enemies(OID.ConceptOfWater);
private readonly List<Actor> _tri = module.Enemies(OID.ConceptOfFire);
private readonly List<Actor> _sq = module.Enemies(OID.ConceptOfEarth);
private readonly (WPos hexa, WPos tri, WPos sq)[] _resolvedShapes = new (WPos, WPos, WPos)[4];
private readonly PlayerState[] _states = Utils.MakeArray(PartyState.MaxPartySize, new PlayerState() { Column = -1, PartnerSlot = -1 });
private readonly bool _invert = invert;
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/Endwalker/Ultimate/DSW2/DSW2States.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class DSW2States : StateMachineBuilder
private readonly DSW2 _module;

private bool IsReset => Module.PrimaryActor.IsDestroyed && (_module.ArenaFeatures?.IsDestroyed ?? true);
private bool IsResetOrRewindFailed => IsReset || Module.Enemies(OID.BossP2).Any();
private bool IsResetOrRewindFailed => IsReset || Module.Enemies(OID.BossP2).Count != 0;
private bool IsDead(Actor? actor) => actor != null && actor.IsDeadOrDestroyed;
private bool IsEffectivelyDead(Actor? actor) => actor != null && (actor.IsDeadOrDestroyed || !actor.IsTargetable && actor.HPMP.CurHP <= 1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public override void OnEventCast(Actor caster, ActorCastEvent spell)
class P5WrathOfTheHeavensTwister(BossModule module) : Components.GenericAOEs(module, default, "GTFO from twister!")
{
private readonly List<WPos> _predicted = [.. module.Raid.WithoutSlot().Select(a => a.Position)];
private readonly IReadOnlyList<Actor> _voidzones = module.Enemies(OID.VoidzoneTwister);
private readonly List<Actor> _voidzones = module.Enemies(OID.VoidzoneTwister);

private static readonly AOEShapeCircle _shape = new(2); // TODO: verify radius

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public Un3SophiaStates(BossModule module) : base(module)
SimplePhase(1, Phase2, "Adds + next few mechanics (until 75%)")
.Raw.Update = () => Module.PrimaryActor.IsDestroyed || (Module.PrimaryActor.CastInfo?.IsSpell(AID.ThunderCone) ?? false);
SimplePhase(2, Phase3, "Skippable mechanics (until 68%)")
.Raw.Update = () => Module.PrimaryActor.IsDestroyed || Module.Enemies(OID.AionTeleos).Any();
.Raw.Update = () => Module.PrimaryActor.IsDestroyed || Module.Enemies(OID.AionTeleos).Count != 0;
DeathPhase(3, Phase4);
}

Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/Heavensward/Quest/Heliodrome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ State build(uint id) => SimpleState(id, 10000, "Enrage")
.ActivateOnEnter<MagitekMissiles>();

SimplePhase(1, id => build(id).ActivateOnEnter<Bounds>(), "P1")
.Raw.Update = () => Module.Enemies(OID.GrynewahtP2).Any();
.Raw.Update = () => Module.Enemies(OID.GrynewahtP2).Count != 0;
DeathPhase(0x100, id => build(id).ActivateOnEnter<ReaperAI>().OnEnter(() =>
{
Module.Arena.Bounds = new ArenaBoundsCircle(20);
Expand Down
12 changes: 6 additions & 6 deletions BossMod/Modules/RealmReborn/Extreme/Ex2Garuda/Ex2Garuda.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class GreatWhirlwind(BossModule module) : Components.LocationTargetedAOEs(module
[ModuleInfo(BossModuleInfo.Maturity.Verified, GroupType = BossModuleInfo.GroupType.CFC, GroupID = 65, NameID = 1644)]
public class Ex2Garuda : BossModule
{
public IReadOnlyList<Actor> Monoliths;
public IReadOnlyList<Actor> RazorPlumes;
public IReadOnlyList<Actor> SpinyPlumes;
public IReadOnlyList<Actor> SatinPlumes;
public IReadOnlyList<Actor> Chirada;
public IReadOnlyList<Actor> Suparna;
public readonly List<Actor> Monoliths;
public readonly List<Actor> RazorPlumes;
public readonly List<Actor> SpinyPlumes;
public readonly List<Actor> SatinPlumes;
public readonly List<Actor> Chirada;
public readonly List<Actor> Suparna;

public Ex2Garuda(WorldState ws, Actor primary) : base(ws, primary, new(0, 0), new ArenaBoundsCircle(22))
{
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/RealmReborn/Extreme/Ex3Titan/Ex3TitanAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Ex3TitanAI(BossModule module) : BossComponent(module)

public override void Update()
{
if (KillNextBomb && !Module.Enemies(OID.BombBoulder).Any())
if (KillNextBomb && Module.Enemies(OID.BombBoulder).Count == 0)
KillNextBomb = false;
}

Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/RealmReborn/Raid/T05Twintania/Phase4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// P4 mechanics
class P4Twisters(BossModule module) : BossComponent(module)
{
private readonly IReadOnlyList<Actor> _twisters = module.Enemies(OID.Twister);
private readonly List<Actor> _twisters = module.Enemies(OID.Twister);
private readonly List<WPos> _predictedPositions = [];
private IEnumerable<Actor> ActiveTwisters => _twisters.Where(t => t.EventState != 7);

Expand Down
6 changes: 3 additions & 3 deletions BossMod/Modules/RealmReborn/Raid/T05Twintania/T05Twintania.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public class T05Twintania : BossModule
{
public const float NeurolinkRadius = 2;

public IReadOnlyList<Actor> ScourgeOfMeracydia;
public IReadOnlyList<Actor> Neurolinks;
public readonly List<Actor> ScourgeOfMeracydia;
public readonly List<Actor> Neurolinks;

public T05Twintania(WorldState ws, Actor primary) : base(ws, primary, new(-3, -6.5f), new ArenaBoundsCircle(31))
{
Expand All @@ -154,7 +154,7 @@ public class T05Twintania : BossModule

protected override void DrawEnemies(int pcSlot, Actor pc)
{
Arena.Actor(PrimaryActor, Colors.Enemy, true);
Arena.Actor(PrimaryActor, allowDeadAndUntargetable: true);
Arena.Actors(ScourgeOfMeracydia);
}
}

0 comments on commit 08a2074

Please sign in to comment.