Skip to content

Commit

Permalink
Merge pull request #600 from FFXIV-CombatReborn/mergeWIP
Browse files Browse the repository at this point in the history
cleanup
  • Loading branch information
CarnifexOptimus authored Feb 10, 2025
2 parents 7678b85 + a0fc3d3 commit 2064a5d
Show file tree
Hide file tree
Showing 77 changed files with 972 additions and 907 deletions.
12 changes: 6 additions & 6 deletions BossMod/Components/Cleave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Cleave(BossModule module, ActionID aid, AOEShape shape, uint[]? ene

public override void AddHints(int slot, Actor actor, TextHints hints)
{
if (OriginsAndTargets().Any(e => e.target != actor && Shape.Check(actor.Position, e.origin.Position, e.angle)))
if (OriginsAndTargets().Any(e => e.target != actor && Shape.Check(WPos.ClampToGrid(actor.Position), e.origin.Position, e.angle)))
{
hints.Add("GTFO from cleave!");
}
Expand All @@ -26,7 +26,7 @@ public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignme

foreach (var (origin, target, angle) in OriginsAndTargets())
if (actor != target)
hints.AddForbiddenZone(Shape, origin.Position, angle, NextExpected);
hints.AddForbiddenZone(Shape, WPos.ClampToGrid(origin.Position), angle, NextExpected);
else
AddTargetSpecificHints(actor, origin, hints);
}
Expand All @@ -37,13 +37,13 @@ private void AddTargetSpecificHints(Actor actor, Actor source, AIHints hints)
switch (Shape)
{
case AOEShapeCircle circle:
hints.AddForbiddenZone(circle, a.Position);
hints.AddForbiddenZone(circle, WPos.ClampToGrid(a.Position));
break;
case AOEShapeCone cone:
hints.AddForbiddenZone(ShapeDistance.Cone(source.Position, 100, source.AngleTo(a), cone.HalfAngle));
hints.AddForbiddenZone(ShapeDistance.Cone(WPos.ClampToGrid(source.Position), 100f, source.AngleTo(a), cone.HalfAngle));
break;
case AOEShapeRect rect:
hints.AddForbiddenZone(ShapeDistance.Cone(source.Position, 100, source.AngleTo(a), Angle.Asin(rect.HalfWidth / (a.Position - source.Position).Length())));
hints.AddForbiddenZone(ShapeDistance.Cone(WPos.ClampToGrid(source.Position), 100f, source.AngleTo(a), Angle.Asin(rect.HalfWidth / (a.Position - source.Position).Length())));
break;
}
}
Expand All @@ -52,7 +52,7 @@ public override void DrawArenaForeground(int pcSlot, Actor pc)
{
foreach (var e in OriginsAndTargets())
{
Shape.Outline(Arena, e.origin.Position, e.angle);
Shape.Outline(Arena, WPos.ClampToGrid(e.origin.Position), e.angle);
}
}

Expand Down
3 changes: 2 additions & 1 deletion BossMod/Components/Exaflare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
protected List<(WPos, DateTime, Angle)> FutureAOEs(int count)
{
var exas = new List<(WPos, DateTime, Angle)>(count);
var currentTime = WorldState.CurrentTime;
for (var i = 0; i < count; ++i)
{
var l = Lines[i];
var num = Math.Min(l.ExplosionsLeft, l.MaxShownExplosions);
var pos = l.Next;
var time = l.NextExplosion > WorldState.CurrentTime ? l.NextExplosion : WorldState.CurrentTime;
var time = l.NextExplosion > currentTime ? l.NextExplosion : currentTime;
for (var j = 1; j < num; ++j)
{
pos += l.Advance;
Expand Down
8 changes: 2 additions & 6 deletions BossMod/Modules/Dawntrail/Alliance/A10Trash/A10Aquarius.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,14 @@ public A10AquariusStates(BossModule module) : base(module)
.ActivateOnEnter<Agaricus>()
.Raw.Update = () =>
{
var allDeadOrDestroyed = true;
var enemies = module.Enemies(A10Aquarius.Trash);
var count = enemies.Count;
for (var i = 0; i < count; ++i)
{
if (!enemies[i].IsDeadOrDestroyed)
{
allDeadOrDestroyed = false;
break;
}
return false;
}
return allDeadOrDestroyed;
return true;
};
}
}
Expand Down
8 changes: 2 additions & 6 deletions BossMod/Modules/Dawntrail/Alliance/A10Trash/A10Despot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,14 @@ public A10DespotStates(BossModule module) : base(module)
.ActivateOnEnter<PanzerfaustHint>()
.Raw.Update = () =>
{
var allDeadOrDestroyed = true;
var enemies = module.Enemies(A10Despot.Trash);
var count = enemies.Count;
for (var i = 0; i < count; ++i)
{
if (!enemies[i].IsDeadOrDestroyed)
{
allDeadOrDestroyed = false;
break;
}
return false;
}
return allDeadOrDestroyed;
return true;
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,14 @@ public A10GroundskeeperStates(BossModule module) : base(module)
.ActivateOnEnter<MysteriousLight>()
.Raw.Update = () =>
{
var allDeadOrDestroyed = true;
var enemies = module.Enemies(A10Groundskeeper.Trash);
var count = enemies.Count;
for (var i = 0; i < count; ++i)
{
if (!enemies[i].IsDeadOrDestroyed)
{
allDeadOrDestroyed = false;
break;
}
return false;
}
return allDeadOrDestroyed;
return true;
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,14 @@ public A10VanguardPathfinderStates(BossModule module) : base(module)
.ActivateOnEnter<BombToss>()
.Raw.Update = () =>
{
var allDeadOrDestroyed = true;
var enemies = module.Enemies(A10VanguardPathfinder.Trash);
var count = enemies.Count;
for (var i = 0; i < count; ++i)
{
if (!enemies[i].IsDeadOrDestroyed)
{
allDeadOrDestroyed = false;
break;
}
return false;
}
return allDeadOrDestroyed;
return true;
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,14 @@ public A13ArkAngelsStates(A13ArkAngels module) : base(module)
.ActivateOnEnter<ArroganceIncarnate>()
.Raw.Update = () =>
{
var allDeadOrDestroyed = true;
var enemies = module.Enemies(A13ArkAngels.Bosses);
var count = enemies.Count;
for (var i = 0; i < count; ++i)
{
if (!enemies[i].IsDeadOrDestroyed)
{
allDeadOrDestroyed = false;
break;
}
return false;
}
return allDeadOrDestroyed;
return true;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public override void OnCastStarted(Actor caster, ActorCastInfo spell)
case (uint)AID.UmbraSmashAOE4:
case (uint)AID.UmbraSmashAOEClone:
var dir = spell.Rotation.ToDirection();
var origin = spell.LocXZ + 30f * dir;
var origin = caster.Position + 30f * dir;
Lines.Add(new() { Next = origin, Advance = 5f * dir.OrthoL(), Rotation = spell.Rotation + 90f.Degrees(), NextExplosion = Module.CastFinishAt(spell), TimeToMove = 2.3f, ExplosionsLeft = 6, MaxShownExplosions = 2 });
Lines.Add(new() { Next = origin, Advance = 5f * dir.OrthoR(), Rotation = spell.Rotation - 90f.Degrees(), NextExplosion = Module.CastFinishAt(spell), TimeToMove = 2.3f, ExplosionsLeft = 6, MaxShownExplosions = 2 });
break;
Expand All @@ -45,7 +45,7 @@ public override void OnCastFinished(Actor caster, ActorCastInfo spell)
case (uint)AID.UmbraSmashAOE4:
case (uint)AID.UmbraSmashAOEClone:
++NumCasts;
var origin = spell.LocXZ + 30f * spell.Rotation.ToDirection();
var origin = caster.Position + 30f * spell.Rotation.ToDirection();
foreach (var l in Lines.Where(l => l.Next.AlmostEqual(origin, 1f)))
{
l.Next = origin + l.Advance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ public override void Update()

public override void OnStatusGain(Actor actor, ActorStatus status)
{
if ((SID)status.ID == SID.CurseOfDarkness && Raid.FindSlot(actor.InstanceID) is var slot && slot >= 0)
if (status.ID == (uint)SID.CurseOfDarkness && Raid.FindSlot(actor.InstanceID) is var slot && slot >= 0)
_activation[slot] = status.ExpireAt;
}

public override void OnStatusLose(Actor actor, ActorStatus status)
{
if ((SID)status.ID == SID.CurseOfDarkness && Raid.FindSlot(actor.InstanceID) is var slot && slot >= 0)
if (status.ID == (uint)SID.CurseOfDarkness && Raid.FindSlot(actor.InstanceID) is var slot && slot >= 0)
_activation[slot] = default;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class EvilSeedBait(BossModule module) : BossComponent(module)
public override void DrawArenaForeground(int pcSlot, Actor pc)
{
foreach (var p in Raid.WithSlot(false, false, true).IncludedInMask(Baiters).Actors())
Arena.AddCircle(p.Position, 5, Colors.Danger);
Arena.AddCircle(p.Position, 5f, Colors.Danger);
}

public override void OnEventIcon(Actor actor, uint iconID, ulong targetID)
Expand All @@ -17,7 +17,7 @@ public override void OnEventIcon(Actor actor, uint iconID, ulong targetID)
}
}

class EvilSeedAOE(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.EvilSeedAOE), 5);
class EvilSeedAOE(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.EvilSeedAOE), 5f);

class EvilSeedVoidzone(BossModule module) : Components.PersistentVoidzone(module, 5, module => module.Enemies(OID.EvilSeed).Where(z => z.EventState != 7));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
_ => default
};
if (dir != default)
yield return new(_shape, caster.Position, caster.Rotation + dir, m[0].activation);
yield return new(_shape, WPos.ClampToGrid(caster.Position), caster.Rotation + dir, m[0].activation);
}
}

Expand Down
20 changes: 10 additions & 10 deletions BossMod/Modules/Endwalker/Alliance/A30Trash/A30Trash1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ public enum AID : uint
DivineBurst = 35441 // DivineSprite->self, no cast, range 40 circle, raidwide when Divine Sprite dies
}

class WaterIII(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.WaterIII), 8);
class WaterIII(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.WaterIII), 8f);

abstract class PelagicCleaver(BossModule module, AID aid) : Components.SimpleAOEs(module, ActionID.MakeSpell(aid), new AOEShapeCone(40, 30.Degrees()));
abstract class PelagicCleaver(BossModule module, AID aid) : Components.SimpleAOEs(module, ActionID.MakeSpell(aid), new AOEShapeCone(40f, 30f.Degrees()));
class PelagicCleaver1(BossModule module) : PelagicCleaver(module, AID.PelagicCleaver1);
class PelagicCleaver2(BossModule module) : PelagicCleaver(module, AID.PelagicCleaver2);

class PelagicCleaver1Hint(BossModule module) : Components.CastInterruptHint(module, ActionID.MakeSpell(AID.PelagicCleaver1));
class PelagicCleaver2Hint(BossModule module) : Components.CastInterruptHint(module, ActionID.MakeSpell(AID.PelagicCleaver2));

class Flood(BossModule module, AID aid) : Components.SimpleAOEs(module, ActionID.MakeSpell(aid), 6);
class Flood(BossModule module, AID aid) : Components.SimpleAOEs(module, ActionID.MakeSpell(aid), 6f);
class WaterFlood(BossModule module) : Flood(module, AID.WaterFlood);
class DivineFlood(BossModule module) : Flood(module, AID.DivineFlood);

Expand All @@ -44,11 +44,11 @@ public A30Trash1States(A30Trash1 module) : base(module)
.ActivateOnEnter<WaterIII>()
.Raw.Update = () =>
{
var enemies = module.Enemies(OID.Serpent);
for (var i = 0; i < enemies.Count; ++i)
var enemies = module.Enemies((uint)OID.Serpent);
var count = enemies.Count;
for (var i = 0; i < count; ++i)
{
var e = enemies[i];
if (!e.IsDeadOrDestroyed)
if (!enemies[i].IsDeadOrDestroyed)
return false;
}
return true;
Expand All @@ -69,19 +69,19 @@ public A30Trash1States(A30Trash1 module) : base(module)
if (!e.IsDeadOrDestroyed)
return false;
}
return module.Enemies(OID.Serpent).Count == 0;
return module.Enemies((uint)OID.Serpent).Count == 0;
};
}
}

[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "Malediktus, LTS", PrimaryActorOID = (uint)OID.Serpent, GroupType = BossModuleInfo.GroupType.CFC, GroupID = 962, NameID = 12478, SortOrder = 1)]
public class A30Trash1(WorldState ws, Actor primary) : BossModule(ws, primary, new(-800, -800), new ArenaBoundsCircle(20))
public class A30Trash1(WorldState ws, Actor primary) : BossModule(ws, primary, new(-800f, -800f), new ArenaBoundsCircle(20f))
{
public static readonly uint[] Trash = [(uint)OID.Triton, (uint)OID.DivineSprite, (uint)OID.WaterSprite];

protected override void DrawEnemies(int pcSlot, Actor pc)
{
Arena.Actors(Enemies(OID.Serpent));
Arena.Actors(Enemies((uint)OID.Serpent));
Arena.Actors(Enemies(Trash));
}
}
44 changes: 34 additions & 10 deletions BossMod/Modules/Endwalker/Alliance/A30Trash/A30Trash2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public enum AID : uint
Skylight = 35446 // AngelosMikros->self, 3.0s cast, range 6 circle
}

class RingOfSkylight(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.RingOfSkylight), new AOEShapeDonut(8, 30));
class RingOfSkylight(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.RingOfSkylight), new AOEShapeDonut(8f, 30f));
class RingOfSkylightInterruptHint(BossModule module) : Components.CastInterruptHint(module, ActionID.MakeSpell(AID.RingOfSkylight));
class SkylightCross(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.SkylightCross), new AOEShapeCross(60, 4));
class SkylightCross(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.SkylightCross), new AOEShapeCross(60f, 4f));
class SkylightCrossInterruptHint(BossModule module) : Components.CastInterruptHint(module, ActionID.MakeSpell(AID.SkylightCross));
class Skylight(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.Skylight), 6);
class Skylight(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.Skylight), 6f);

public class A30Trash2Pack1States : StateMachineBuilder
{
Expand All @@ -32,22 +32,36 @@ public A30Trash2Pack1States(A30Trash2Pack1 module) : base(module)
.ActivateOnEnter<SkylightCross>()
.ActivateOnEnter<SkylightCrossInterruptHint>()
.ActivateOnEnter<Skylight>()
.Raw.Update = () => Module.PrimaryActor.IsDeadOrDestroyed && module.Enemies(OID.AngelosMikros).All(e => e.IsDead);
.Raw.Update = () =>
{
var allDeadOrDestroyed = true;
var enemies = module.Enemies((uint)OID.AngelosMikros);
var count = enemies.Count;
for (var i = 0; i < count; ++i)
{
if (!enemies[i].IsDeadOrDestroyed)
{
allDeadOrDestroyed = false;
break;
}
}
return module.PrimaryActor.IsDeadOrDestroyed && allDeadOrDestroyed;
};
}
}

[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "Malediktus", PrimaryActorOID = (uint)OID.AngelosPack1, GroupType = BossModuleInfo.GroupType.CFC, GroupID = 962, NameID = 12481, SortOrder = 5)]
public class A30Trash2Pack1(WorldState ws, Actor primary) : BossModule(ws, primary, arena.Center, arena)
{
private static readonly Shape[] union = [new Rectangle(new(800, 786), 21, 13.5f), new Rectangle(new(800, 767), 7.5f, 10), new Rectangle(new(800, 758), 10, 4)];
private static readonly Shape[] difference = [new Square(new(811.25f, 787), 1.5f), new Square(new(811.25f, 777.4f), 1.5f), new Square(new(788.75f, 787), 1.5f), new Square(new(788.75f, 777.4f), 1.5f),
private static readonly Shape[] union = [new Rectangle(new(800f, 786f), 21f, 13.5f), new Rectangle(new(800f, 767f), 7.5f, 10f), new Rectangle(new(800f, 758f), 10f, 4f)];
private static readonly Shape[] difference = [new Square(new(811.25f, 787f), 1.5f), new Square(new(811.25f, 777.4f), 1.5f), new Square(new(788.75f, 787f), 1.5f), new Square(new(788.75f, 777.4f), 1.5f),
new Circle(new(793.4f, 762.75f), 1.25f), new Circle(new(806.6f, 762.75f), 1.25f)];
private static readonly ArenaBoundsComplex arena = new(union, difference);

protected override void DrawEnemies(int pcSlot, Actor pc)
{
Arena.Actor(PrimaryActor);
Arena.Actors(Enemies(OID.AngelosMikros));
Arena.Actors(Enemies((uint)OID.AngelosMikros));
}
}

Expand All @@ -58,15 +72,25 @@ public A30Trash2Pack2States(A30Trash2Pack2 module) : base(module)
TrivialPhase()
.ActivateOnEnter<RingOfSkylight>()
.ActivateOnEnter<SkylightCross>()
.Raw.Update = () => module.Enemies(OID.AngelosPack2).All(e => e.IsDead);
.Raw.Update = () =>
{
var enemies = module.Enemies((uint)OID.AngelosPack2);
var count = enemies.Count;
for (var i = 0; i < count; ++i)
{
if (!enemies[i].IsDeadOrDestroyed)
return false;
}
return true;
};
}
}

[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "Malediktus", PrimaryActorOID = (uint)OID.AngelosPack2, GroupType = BossModuleInfo.GroupType.CFC, GroupID = 962, NameID = 12481, SortOrder = 6)]
public class A30Trash2Pack2(WorldState ws, Actor primary) : BossModule(ws, primary, new(800, 909.75f), new ArenaBoundsSquare(19.5f))
public class A30Trash2Pack2(WorldState ws, Actor primary) : BossModule(ws, primary, new(800f, 909.75f), new ArenaBoundsSquare(19.5f))
{
protected override void DrawEnemies(int pcSlot, Actor pc)
{
Arena.Actors(Enemies(OID.AngelosPack2));
Arena.Actors(Enemies((uint)OID.AngelosPack2));
}
}
6 changes: 3 additions & 3 deletions BossMod/Modules/Endwalker/Alliance/A31Thaliak/A31Thaliak.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace BossMod.Endwalker.Alliance.A31Thaliak;

class Katarraktes(BossModule module) : Components.CastCounter(module, ActionID.MakeSpell(AID.KatarraktesAOE));
class Thlipsis(BossModule module) : Components.StackWithCastTargets(module, ActionID.MakeSpell(AID.ThlipsisAOE), 6, 8);
class Hydroptosis(BossModule module) : Components.SpreadFromCastTargets(module, ActionID.MakeSpell(AID.HydroptosisAOE), 6);
class Rhyton(BossModule module) : Components.BaitAwayIcon(module, new AOEShapeRect(70, 3), (uint)IconID.Rhyton, ActionID.MakeSpell(AID.RhytonAOE), 6);
class Thlipsis(BossModule module) : Components.StackWithCastTargets(module, ActionID.MakeSpell(AID.ThlipsisAOE), 6f, 8);
class Hydroptosis(BossModule module) : Components.SpreadFromCastTargets(module, ActionID.MakeSpell(AID.HydroptosisAOE), 6f);
class Rhyton(BossModule module) : Components.BaitAwayIcon(module, new AOEShapeRect(70, 3), (uint)IconID.Rhyton, ActionID.MakeSpell(AID.RhytonAOE), 6f);

class Bank(BossModule module, AID aid) : Components.SimpleAOEs(module, ActionID.MakeSpell(aid), new AOEShapeCone(60, 90.Degrees()));
class LeftBank(BossModule module) : Bank(module, AID.LeftBank);
Expand Down
Loading

0 comments on commit 2064a5d

Please sign in to comment.