Skip to content

Commit

Permalink
some stylistic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
CarnifexOptimus committed Dec 5, 2024
1 parent e0a8b47 commit 472a3b7
Show file tree
Hide file tree
Showing 48 changed files with 125 additions and 114 deletions.
2 changes: 1 addition & 1 deletion BossMod/BossModule/MiniArena.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ public void Actors(IEnumerable<Actor> actors, uint color = 0, bool allowDeadAndU
Actor(a, color == 0 ? Colors.Enemy : color, allowDeadAndUntargetable);
}

public void Actors(IReadOnlyList<Actor> actors, uint color = 0, bool allowDeadAndUntargetable = false)
public void Actors(List<Actor> actors, uint color = 0, bool allowDeadAndUntargetable = false)
{
for (var i = 0; i < actors.Count; ++i)
{
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Components/Adds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// generic component used for drawing adds
public class Adds(BossModule module, uint oid, int priority = 0) : BossComponent(module)
{
public readonly IReadOnlyList<Actor> Actors = module.Enemies(oid);
public readonly List<Actor> Actors = module.Enemies(oid);
public IEnumerable<Actor> ActiveActors => Actors.Where(a => a.IsTargetable && !a.IsDead);

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Components/BaitAway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public class BaitAwayTethers(BossModule module, AOEShape shape, uint tetherID, A
public AOEShape Shape = shape;
public uint TID = tetherID;
public bool DrawTethers = true;
public readonly IReadOnlyList<Actor> _enemies = module.Enemies(enemyOID);
public readonly List<Actor> _enemies = module.Enemies(enemyOID);
public float ActivationDelay = activationDelay;

public override void DrawArenaForeground(int pcSlot, Actor pc)
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Components/Cleave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Cleave(BossModule module, ActionID aid, AOEShape shape, uint enemyO
public bool ActiveWhileCasting { get; init; } = activeWhileCasting;
public bool OriginAtTarget { get; init; } = originAtTarget;
public DateTime NextExpected;
private readonly IReadOnlyList<Actor> _enemies = module.Enemies(enemyOID != 0 ? enemyOID : module.PrimaryActor.OID);
private readonly List<Actor> _enemies = module.Enemies(enemyOID != 0 ? enemyOID : module.PrimaryActor.OID);

public override void AddHints(int slot, Actor actor, TextHints hints)
{
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Components/Tethers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public class StretchTetherDuo(BossModule module, float minimumDistance, float ac
public uint TIDBad = tetherIDBad;
public float MinimumDistance = minimumDistance;
public bool KnockbackImmunity { get; init; } = knockbackImmunity;
public readonly IReadOnlyList<Actor> _enemies = module.Enemies(enemyOID);
public readonly List<Actor> _enemies = module.Enemies(enemyOID);
public readonly List<(Actor, uint)> TetherOnActor = [];
public readonly List<(Actor, DateTime)> ActivationDelayOnActor = [];
public float ActivationDelay = activationDelay;
Expand Down
19 changes: 11 additions & 8 deletions BossMod/Modules/Dawntrail/Dungeon/D02WorqorZormor/D023Gurfurlur.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,32 +67,35 @@ public override void OnEventEnvControl(byte index, uint state)

class AuraSphere(BossModule module) : BossComponent(module)
{
private readonly IReadOnlyList<Actor> _orbs = module.Enemies(OID.AuraSphere);

private IEnumerable<Actor> ActiveOrbs => _orbs.Where(orb => !orb.IsDead);
private readonly IEnumerable<Actor> _orbs = module.Enemies(OID.AuraSphere).Where(orb => !orb.IsDead);

public override void AddGlobalHints(GlobalHints hints)
{
if (ActiveOrbs.Any())
if (_orbs.Any())
hints.Add("Soak the orbs!");
}

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
{
var orbs = new List<Func<WPos, float>>();
if (ActiveOrbs.Any())
Actor[] sph = [.. _orbs];
var len = sph.Length;
if (len != 0)
{
hints.ActionsToExecute.Push(ActionID.MakeSpell(ClassShared.AID.Sprint), actor, ActionQueue.Priority.High);
foreach (var o in ActiveOrbs)
for (var i = 0; i < len; ++i)
{
var o = sph[i];
orbs.Add(ShapeDistance.InvertedCircle(o.Position + 0.5f * o.Rotation.ToDirection(), 0.5f));
}
}
if (orbs.Count > 0)
if (orbs.Count != 0)
hints.AddForbiddenZone(p => orbs.Max(f => f(p)));
}

public override void DrawArenaForeground(int pcSlot, Actor pc)
{
foreach (var orb in ActiveOrbs)
foreach (var orb in _orbs)
Arena.AddCircle(orb.Position, 1.4f, Colors.Safe);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,40 +62,43 @@ class AiryBubble(BossModule module) : Components.GenericAOEs(module)
private const float Radius = 1.1f;
private const int Length = 3;
private static readonly AOEShapeCapsule capsule = new(Radius, Length);
private readonly IReadOnlyList<Actor> _orbs = module.Enemies(OID.AiryBubble);
private IEnumerable<Actor> Orbs => _orbs.Where(x => x.HitboxRadius == Radius);
private readonly List<Actor> _aoes = [];

public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
{
foreach (var o in _aoes)
for (var i = 0; i < _aoes.Count; ++i)
{
var o = _aoes[i];
yield return new(capsule, o.Position, o.Rotation);
}
}

public override void OnActorPlayActionTimelineEvent(Actor actor, ushort id)
{
if (id == 0x1E46 && Orbs.Contains(actor))
_aoes.Add(actor);
else if (id == 0x1E3C && Orbs.Contains(actor))
_aoes.Remove(actor);
if (Module.Enemies(OID.AiryBubble).Where(x => x.HitboxRadius == 1.1f).Contains(actor))
if (id == 0x1E46)
_aoes.Add(actor);
else if (id == 0x1E3C)
_aoes.Remove(actor);
}

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
{
if (_aoes.Count == 0)
return;
var forbidden = new List<Func<WPos, float>>();
foreach (var o in _aoes)
for (var i = 0; i < _aoes.Count; ++i)
{
var o = _aoes[i];
forbidden.Add(ShapeDistance.Capsule(o.Position, o.Rotation, Length, Radius));
}
forbidden.Add(ShapeDistance.Circle(Arena.Center, Module.PrimaryActor.HitboxRadius));
hints.AddForbiddenZone(p => forbidden.Min(f => f(p)));
}
}

class Burst(BossModule module) : Components.GenericAOEs(module)
{
private readonly IReadOnlyList<Actor> _orbs = module.Enemies(OID.AiryBubble);
private IEnumerable<Actor> Orbs => _orbs.Where(x => x.HitboxRadius != 1.1f);
private static readonly AOEShapeCircle circle = new(6);
private readonly List<AOEInstance> _aoes = [];

Expand All @@ -117,7 +120,7 @@ public override void OnCastStarted(Actor caster, ActorCastInfo spell)

private void AddAOEs(float offset, DateTime activation)
{
foreach (var orb in Orbs)
foreach (var orb in Module.Enemies(OID.AiryBubble).Where(x => x.HitboxRadius != 1.1f))
_aoes.Add(new(circle, orb.Position + new WDir(offset, 0), default, activation));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// TODO: consider improving this somehow? too many ways to resolve...
class ProjectionOfTurmoil(BossModule module) : Components.CastCounter(module, ActionID.MakeSpell(AID.MightOfVollok))
{
private readonly IReadOnlyList<Actor> _line = module.Enemies(OID.ProjectionOfTurmoil);
private readonly List<Actor> _line = module.Enemies(OID.ProjectionOfTurmoil);
private BitMask _targets;

public override PlayerPriority CalcPriority(int pcSlot, Actor pc, int playerSlot, Actor player, ref uint customColor) => _targets[playerSlot] ? PlayerPriority.Interesting : PlayerPriority.Normal;
Expand All @@ -16,8 +16,9 @@ public override void DrawArenaForeground(int pcSlot, Actor pc)
if (actor != null)
Arena.AddCircle(actor.Position, 8, Colors.Safe);
}
foreach (var l in _line)
for (var i = 0; i < _line.Count; ++i)
{
var l = _line[i];
var off = new WDir(28.28427f - Math.Abs(l.Position.Z - Module.Center.Z), 0);
Arena.AddLine(l.Position - off, l.Position + off, Colors.Danger);
}
Expand Down
10 changes: 5 additions & 5 deletions BossMod/Modules/Dawntrail/FATE/MicaTheMagicalMu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public enum AID : uint

class Draw(BossModule module) : Components.GenericAOEs(module)
{
private readonly IReadOnlyList<Actor>[] _cards = [
private readonly List<Actor>[] _cards = [
module.Enemies(OID.Card1),
module.Enemies(OID.Card2),
module.Enemies(OID.Card3),
Expand All @@ -91,11 +91,11 @@ class Draw(BossModule module) : Components.GenericAOEs(module)

public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
{
if (_safeZones.Count > 0)
for (int i = 0; i < _cards.Length; ++i)
if (_safeZones.Count != 0)
for (var i = 0; i < 6; ++i)
if (i != _safeZones[0])
foreach (var a in _cards[i])
yield return new(_shape, a.Position, default, _activation);
for (var j = 0; j < _cards[j].Count; ++j)
yield return new(_shape, _cards[i][j].Position, default, _activation);
}

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/Dawntrail/Ultimate/FRU/P2LightRampant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public override void DrawArenaForeground(int pcSlot, Actor pc)
var source = Raid[i];
var target = _tetherTargets[i];
if (source != null && target != null)
Arena.AddLine(source.Position, target.Position, (source.Position - target.Position).LengthSq() < 625 ? ArenaColor.Danger : ArenaColor.Safe);
Arena.AddLine(source.Position, target.Position, (source.Position - target.Position).LengthSq() < 625 ? Colors.Danger : Colors.Safe);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public override void DrawArenaForeground(int pcSlot, Actor pc)
{
var assignedDir = States[pcSlot].AssignedDir;
if (assignedDir != default)
Arena.AddCircle(Module.Center + RangeHint(States[pcSlot], pc.Class.IsSupport(), NumCasts) * assignedDir, 1, ArenaColor.Safe);
Arena.AddCircle(Module.Center + RangeHint(States[pcSlot], pc.Class.IsSupport(), NumCasts) * assignedDir, 1, Colors.Safe);
}

public override void OnStatusGain(Actor actor, ActorStatus status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// TODO: improve!
class ForbiddenFruit5(BossModule module) : ForbiddenFruitCommon(module, ActionID.MakeSpell(AID.Burst))
{
private readonly IReadOnlyList<Actor> _towers = module.Enemies(OID.Tower);
private readonly List<Actor> _towers = module.Enemies(OID.Tower);

private const float _towerRadius = 5;

Expand All @@ -13,7 +13,7 @@ public override void DrawArenaForeground(int pcSlot, Actor pc)
if (tetherSource != null)
Arena.AddLine(tetherSource.Position, pc.Position, TetherColor(tetherSource));

foreach (var tower in _towers)
Arena.AddCircle(tower.Position, _towerRadius, tetherSource == null ? Colors.Safe : Colors.Danger);
for (var i = 0; i < _towers.Count; ++i)
Arena.AddCircle(_towers[i].Position, _towerRadius, tetherSource == null ? Colors.Safe : Colors.Danger);
}
}
10 changes: 5 additions & 5 deletions BossMod/Modules/RealmReborn/Extreme/Ex3Titan/Ex3Titan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ class GaolerVoidzone(BossModule module) : Components.PersistentVoidzone(module,
[ModuleInfo(BossModuleInfo.Maturity.Verified, GroupType = BossModuleInfo.GroupType.CFC, GroupID = 64, NameID = 1801, PlanLevel = 50)]
public class Ex3Titan : BossModule
{
private readonly IReadOnlyList<Actor> _heart;
private readonly List<Actor> _heart;
public Actor? Heart() => _heart.FirstOrDefault();

public IReadOnlyList<Actor> Gaolers;
public IReadOnlyList<Actor> Gaols;
public IReadOnlyList<Actor> Bombs;
public readonly List<Actor> Gaolers;
public readonly List<Actor> Gaols;
public readonly List<Actor> Bombs;

public Ex3Titan(WorldState ws, Actor primary) : base(ws, primary, new(0, 0), new ArenaBoundsCircle(25))
{
Expand All @@ -35,7 +35,7 @@ protected override void CalculateModuleAIHints(int slot, Actor actor, PartyRoles

protected override void DrawEnemies(int pcSlot, Actor pc)
{
Arena.Actor(PrimaryActor, Colors.Enemy, true);
Arena.Actor(PrimaryActor, allowDeadAndUntargetable: true);
Arena.Actors(Gaolers);
Arena.Actors(Gaols, Colors.Object);
Arena.Actors(Bombs, Colors.Object);
Expand Down
12 changes: 6 additions & 6 deletions BossMod/Modules/RealmReborn/Raid/T04Gauntlet/T04Gauntlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ private void SinglePhase(uint id)
[ModuleInfo(BossModuleInfo.Maturity.Verified, PrimaryActorOID = (uint)OID.TerminalStart, GroupType = BossModuleInfo.GroupType.CFC, GroupID = 96)]
public class T04Gauntlet : BossModule
{
public IReadOnlyList<Actor> P1Bugs;
public IReadOnlyList<Actor> Bugs;
public IReadOnlyList<Actor> Soldiers;
public IReadOnlyList<Actor> Knights;
public IReadOnlyList<Actor> Rooks;
public IReadOnlyList<Actor> Dreadnaughts;
public readonly List<Actor> P1Bugs;
public readonly List<Actor> Bugs;
public readonly List<Actor> Soldiers;
public readonly List<Actor> Knights;
public readonly List<Actor> Rooks;
public readonly List<Actor> Dreadnaughts;

public T04Gauntlet(WorldState ws, Actor primary) : base(ws, primary, new(0, 0), new ArenaBoundsCircle(25))
{
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 @@ -43,7 +43,7 @@ public override void DrawArenaForeground(int pcSlot, Actor pc)
class P4Dreadknights(BossModule module) : BossComponent(module)
{
private Actor? _target;
private readonly IReadOnlyList<Actor> _dreadknights = module.Enemies(OID.Dreadknight);
private readonly List<Actor> _dreadknights = module.Enemies(OID.Dreadknight);
public IEnumerable<Actor> ActiveDreadknights => _dreadknights.Where(a => !a.IsDead);

public override void Update()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ public CE41WithDiremiteAndMainStates(BossModule module) : base(module)
[ModuleInfo(BossModuleInfo.Maturity.Verified, GroupType = BossModuleInfo.GroupType.BozjaCE, GroupID = 778, NameID = 21)] // bnpcname=9969
public class CE41WithDiremiteAndMain : BossModule
{
private readonly IReadOnlyList<Actor> _dimCrystals;
private readonly IReadOnlyList<Actor> _corruptedCrystals;
private readonly List<Actor> _dimCrystals;
private readonly List<Actor> _corruptedCrystals;

public CE41WithDiremiteAndMain(WorldState ws, Actor primary) : base(ws, primary, new(-220, 530), new ArenaBoundsCircle(30))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TimeEruptionBombReproduce(BossModule module) : Components.GenericAOEs(modu
{
private DateTime _bombsActivation;
private DateTime _eruptionStart; // timestamp of StartTime cast start
private readonly IReadOnlyList<Actor> _bombs = module.Enemies(OID.TimeBomb1); // either 1 or 2 works, dunno what's the difference
private readonly List<Actor> _bombs = module.Enemies(OID.TimeBomb1); // either 1 or 2 works, dunno what's the difference
private readonly List<Actor> _cycloneCasters = [];
private readonly List<(WPos pos, TimeSpan delay)> _clocks = [];
private readonly List<WPos> _eruptionSafeSpots = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public CE54NeverCryWolfStates(BossModule module) : base(module)
[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "Malediktus", GroupType = BossModuleInfo.GroupType.BozjaCE, GroupID = 778, NameID = 25)] // bnpcname=9941
public class CE54NeverCryWolf : BossModule
{
private readonly IReadOnlyList<Actor> _adds;
private readonly List<Actor> _adds;

public CE54NeverCryWolf(WorldState ws, Actor primary) : base(ws, primary, new(-830, 190), new ArenaBoundsSquare(24))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Flame(BossModule module) : Components.RaidwideCast(module, ActionID.MakeSp

class Burn(BossModule module) : Components.GenericAOEs(module)
{
private readonly IReadOnlyList<Actor> _flames = module.Enemies(OID.BallOfFire);
private readonly List<Actor> _flames = module.Enemies(OID.BallOfFire);
private readonly List<(Actor actor, AOEInstance? aoe)> _casters = [];

private static readonly AOEShapeCircle _shape = new(8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public CE64FeelingTheBurnStates(BossModule module) : base(module)
[ModuleInfo(BossModuleInfo.Maturity.Verified, GroupType = BossModuleInfo.GroupType.BozjaCE, GroupID = 778, NameID = 18)] // bnpcname=9945
public class CE64FeelingTheBurn : BossModule
{
public IReadOnlyList<Actor> Escorts;
public List<Actor> Escorts;

public CE64FeelingTheBurn(WorldState ws, Actor primary) : base(ws, primary, new(-240, -230), new ArenaBoundsSquare(24))
{
Expand All @@ -176,6 +176,6 @@ public class CE64FeelingTheBurn : BossModule
protected override void DrawEnemies(int pcSlot, Actor pc)
{
base.DrawEnemies(pcSlot, pc);
Arena.Actors(Escorts, Colors.Enemy);
Arena.Actors(Escorts);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class AboveBoard(BossModule module) : Components.GenericAOEs(module)
public enum State { Initial, ThrowUpDone, ShortExplosionsDone, LongExplosionsDone }

public State CurState { get; private set; }
private readonly IReadOnlyList<Actor> _smallBombs = module.Enemies(OID.AetherialBolt);
private readonly IReadOnlyList<Actor> _bigBombs = module.Enemies(OID.AetherialBurst);
private readonly List<Actor> _smallBombs = module.Enemies(OID.AetherialBolt);
private readonly List<Actor> _bigBombs = module.Enemies(OID.AetherialBurst);
private bool _invertedBombs; // bombs are always either all normal (big=short) or all inverted
private readonly BitMask _invertedPlayers; // default for player is 'long', short is considered inverted (has visible status)
private readonly DateTime _activation = module.WorldState.FutureTime(12);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
[ModuleInfo(BossModuleInfo.Maturity.WIP, Contributors = "The Combat Reborn Team", PrimaryActorOID = (uint)OID.Knight, GroupType = BossModuleInfo.GroupType.CFC, GroupID = 760, NameID = 9838)]
public class DRN3QueensGuard : BossModule
{
private readonly IReadOnlyList<Actor> _warrior;
private readonly IReadOnlyList<Actor> _soldier;
private readonly IReadOnlyList<Actor> _gunner;
private readonly List<Actor> _warrior;
private readonly List<Actor> _soldier;
private readonly List<Actor> _gunner;

public Actor? Knight() => PrimaryActor.IsDestroyed ? null : PrimaryActor;
public Actor? Warrior() => _warrior.FirstOrDefault();
public Actor? Soldier() => _soldier.FirstOrDefault();
public Actor? Gunner() => _gunner.FirstOrDefault();
public IReadOnlyList<Actor> GunTurrets;
public readonly List<Actor> GunTurrets;

public DRN3QueensGuard(WorldState ws, Actor primary) : base(ws, primary, new(244, -162), new ArenaBoundsCircle(25))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class AboveBoard(BossModule module) : Components.GenericAOEs(module)
public enum State { Initial, ThrowUpDone, ShortExplosionsDone, LongExplosionsDone }

public State CurState { get; private set; }
private readonly IReadOnlyList<Actor> _smallBombs = module.Enemies(OID.AetherialBolt);
private readonly IReadOnlyList<Actor> _bigBombs = module.Enemies(OID.AetherialBurst);
private readonly List<Actor> _smallBombs = module.Enemies(OID.AetherialBolt);
private readonly List<Actor> _bigBombs = module.Enemies(OID.AetherialBurst);
private bool _invertedBombs; // bombs are always either all normal (big=short) or all inverted
private BitMask _invertedPlayers; // default for player is 'long', short is considered inverted (has visible status)
private readonly DateTime _activation = module.WorldState.FutureTime(14.4f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class SpitFlame(BossModule module) : Components.UniformStackSpread(module, 0, 4, alwaysShowSpreads: true, raidwideOnResolve: false)
{
private readonly Actor?[] _targets = [null, null, null, null];
private readonly IReadOnlyList<Actor> _adds = module.Enemies(OID.Marchosias);
private readonly List<Actor> _adds = module.Enemies(OID.Marchosias);

public override void Update()
{
Expand Down
Loading

0 comments on commit 472a3b7

Please sign in to comment.