Skip to content

Commit

Permalink
Merge pull request #614 from FFXIV-CombatReborn/mergeWIP
Browse files Browse the repository at this point in the history
some cleanup
  • Loading branch information
CarnifexOptimus authored Feb 17, 2025
2 parents 0ff88ca + 7ed1cfb commit 3321292
Show file tree
Hide file tree
Showing 97 changed files with 2,684 additions and 1,235 deletions.
56 changes: 49 additions & 7 deletions BossMod/Components/BaitAway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,51 @@ public Bait(Actor source, Actor target, AOEShape shape, DateTime activation, Ang
public List<Bait> CurrentBaits = [];
public const string BaitAwayHint = "Bait away from raid!";

public IEnumerable<Bait> ActiveBaits => AllowDeadTargets ? CurrentBaits.Where(b => !b.Source.IsDead) : CurrentBaits.Where(b => !b.Source.IsDead && !b.Target.IsDead);
public IEnumerable<Bait> ActiveBaitsOn(Actor target) => ActiveBaits.Where(b => b.Target == target);
public IEnumerable<Bait> ActiveBaitsNotOn(Actor target) => ActiveBaits.Where(b => b.Target != target);
public List<Bait> ActiveBaits
{
get
{
var count = CurrentBaits.Count;
List<Bait> activeBaits = new(count);
for (var i = 0; i < count; ++i)
{
var bait = CurrentBaits[i];
if (!bait.Source.IsDead)
{
if (AllowDeadTargets || !bait.Target.IsDead)
activeBaits.Add(bait);
}
}
return activeBaits;
}
}

public List<Bait> ActiveBaitsOn(Actor target)
{
var count = CurrentBaits.Count;
List<Bait> activeBaitsOnTarget = new(count);
for (var i = 0; i < count; ++i)
{
var bait = CurrentBaits[i];
if (!bait.Source.IsDead && bait.Target == target)
activeBaitsOnTarget.Add(bait);
}
return activeBaitsOnTarget;
}

public List<Bait> ActiveBaitsNotOn(Actor target)
{
var count = CurrentBaits.Count;
List<Bait> activeBaitsNotOnTarget = new(count);
for (var i = 0; i < count; ++i)
{
var bait = CurrentBaits[i];
if (!bait.Source.IsDead && bait.Target != target)
activeBaitsNotOnTarget.Add(bait);
}
return activeBaitsNotOnTarget;
}

public WPos BaitOrigin(Bait bait) => (CenterAtTarget ? bait.Target : bait.Source).Position;
public bool IsClippedBy(Actor actor, Bait bait) => bait.Shape.Check(actor.Position, BaitOrigin(bait), bait.Rotation);
public IEnumerable<Actor> PlayersClippedBy(Bait bait) => Raid.WithoutSlot().Exclude(bait.Target).InShape(bait.Shape, BaitOrigin(bait), bait.Rotation);
Expand All @@ -42,7 +84,7 @@ public override void AddHints(int slot, Actor actor, TextHints hints)

if (ForbiddenPlayers[slot])
{
if (ActiveBaitsOn(actor).Any())
if (ActiveBaitsOn(actor).Count != 0)
hints.Add("Avoid baiting!");
}
else
Expand All @@ -57,7 +99,7 @@ public override void AddHints(int slot, Actor actor, TextHints hints)

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
{
if (!ActiveBaits.Any())
if (ActiveBaits.Count == 0)
return;

foreach (var bait in ActiveBaitsNotOn(actor))
Expand Down Expand Up @@ -90,7 +132,7 @@ private void AddTargetSpecificHints(Actor actor, Bait bait, AIHints hints)
}
}

public override PlayerPriority CalcPriority(int pcSlot, Actor pc, int playerSlot, Actor player, ref uint customColor) => ActiveBaitsOn(player).Any() ? BaiterPriority : PlayerPriority.Irrelevant;
public override PlayerPriority CalcPriority(int pcSlot, Actor pc, int playerSlot, Actor player, ref uint customColor) => ActiveBaitsOn(player).Count != 0 ? BaiterPriority : PlayerPriority.Irrelevant;

public override void DrawArenaBackground(int pcSlot, Actor pc)
{
Expand Down Expand Up @@ -289,7 +331,7 @@ public override void OnEventCast(Actor caster, ActorCastEvent spell)

public override void AddHints(int slot, Actor actor, TextHints hints)
{
if (!ActiveBaits.Any())
if (ActiveBaits.Count == 0)
return;
base.AddHints(slot, actor, hints);
if (ActiveBaitsOn(actor).Any(b => PlayersClippedBy(b).Any()))
Expand Down
8 changes: 4 additions & 4 deletions BossMod/Components/StackSpread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ public override void OnCastFinished(Actor caster, ActorCastInfo spell)

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
{
if (!ActiveBaits.Any())
if (ActiveBaits.Count == 0)
return;
var isBaitTarget = ActiveBaits.Any(x => x.Target == actor);
var isBaitNotTarget = ActiveBaits.Any(x => x.Target != actor);
Expand Down Expand Up @@ -501,7 +501,7 @@ public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignme

public override void AddHints(int slot, Actor actor, TextHints hints)
{
if (!ActiveBaits.Any())
if (ActiveBaits.Count == 0)
return;

var isBaitTarget = ActiveBaits.Any(x => x.Target == actor);
Expand All @@ -513,7 +513,7 @@ public override void AddHints(int slot, Actor actor, TextHints hints)
else if ((isBaitNotTarget || isBaitTarget) && isInBaitShape)
hints.Add(HintStack, false);

if (ActiveBaits.Count() > 1 && isBaitTarget)
if (ActiveBaits.Count > 1 && isBaitTarget)
{
var isInOtherBaitShape = ActiveBaits.Any(x => x.Target != actor && actor.Position.InRect(x.Source.Position, x.Rotation, Range, 0, 2 * HalfWidth));
if (isInOtherBaitShape)
Expand All @@ -526,7 +526,7 @@ public override void AddHints(int slot, Actor actor, TextHints hints)

public override void DrawArenaBackground(int pcSlot, Actor pc)
{
if (!ActiveBaits.Any())
if (ActiveBaits.Count == 0)
return;

var isBaitTarget = ActiveBaits.Any(x => x.Target == pc);
Expand Down
8 changes: 4 additions & 4 deletions BossMod/Components/Tethers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public override void OnStatusLose(Actor actor, ActorStatus status)
public override void DrawArenaForeground(int pcSlot, Actor pc)
{
base.DrawArenaForeground(pcSlot, pc);
if (!ActiveBaits.Any())
if (ActiveBaits.Count == 0)
return;
if (!IsImmune(pcSlot, ActiveBaits.FirstOrDefault(x => x.Target == pc).Activation))
{
Expand Down Expand Up @@ -471,12 +471,12 @@ public override void AddHints(int slot, Actor actor, TextHints hints)

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
{
if (!ActiveBaits.Any())
if (ActiveBaits.Count == 0)
return;
var immunity = IsImmune(slot, ActiveBaits.FirstOrDefault(x => x.Target == actor).Activation);
var isImmune = immunity && KnockbackImmunity;
var couldBeImmune = !immunity && KnockbackImmunity;
if (couldBeImmune && ActivationDelayOnActor.Any(x => x.Item1 == actor && x.Item2.AddSeconds(-6) <= WorldState.CurrentTime))
if (couldBeImmune && ActivationDelayOnActor.Any(x => x.Item1 == actor && x.Item2.AddSeconds(-6d) <= WorldState.CurrentTime))
{
hints.ActionsToExecute.Push(ActionID.MakeSpell(ClassShared.AID.ArmsLength), actor, ActionQueue.Priority.High);
hints.ActionsToExecute.Push(ActionID.MakeSpell(ClassShared.AID.Surecast), actor, ActionQueue.Priority.High);
Expand All @@ -495,7 +495,7 @@ public class StretchTetherSingle(BossModule module, uint tetherID, float minimum
{
public override void AddHints(int slot, Actor actor, TextHints hints)
{
if (!ActiveBaits.Any())
if (ActiveBaits.Count == 0)
return;
if (needToKite && TetherOnActor.Contains((actor, TIDBad)))
hints.Add("Kite the add!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,29 @@ public D040VanguardAerostat1States(BossModule module) : base(module)
{
TrivialPhase()
.ActivateOnEnter<IncendiaryRing>()
.Raw.Update = () => module.Enemies(D040VanguardAerostat1.Trash).All(e => e.IsDeadOrDestroyed);
.Raw.Update = () =>
{
var enemies = module.Enemies(D040VanguardAerostat1.Trash);
var count = enemies.Count;
for (var i = 0; i < count; ++i)
{
var enemy = enemies[i];
if (!enemy.IsDeadOrDestroyed)
return false;
}
return true;
};
}
}

[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "The Combat Reborn Team (Malediktus)", GroupType = BossModuleInfo.GroupType.CFC, GroupID = 831, NameID = 12780, SortOrder = 4)]
public class D040VanguardAerostat1(WorldState ws, Actor primary) : BossModule(ws, primary, new(-50, -15), new ArenaBoundsRect(7.7f, 25))
public class D040VanguardAerostat1(WorldState ws, Actor primary) : BossModule(ws, primary, new(-50f, -15f), new ArenaBoundsRect(7.7f, 25f))
{
public static readonly uint[] Trash = [(uint)OID.Boss, (uint)OID.Aerostat2];

protected override void DrawEnemies(int pcSlot, Actor pc)
{
Arena.Actor(PrimaryActor);
Arena.Actors(Enemies(OID.Aerostat2));
Arena.Actors(Enemies((uint)OID.Aerostat2));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public enum AID : uint
SpreadShot = 39017, // SentryS7->self, 4.0s cast, range 12 90-degree cone
}

class IncendiaryRing(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.IncendiaryRing), new AOEShapeDonut(3, 12));
class Electrobeam(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.Electrobeam), new AOEShapeRect(50, 2));
class SpreadShot(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.SpreadShot), new AOEShapeCone(12, 45.Degrees()));
class IncendiaryRing(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.IncendiaryRing), new AOEShapeDonut(3f, 12f));
class Electrobeam(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.Electrobeam), new AOEShapeRect(50f, 2f));
class SpreadShot(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.SpreadShot), new AOEShapeCone(12f, 45f.Degrees()));

class D040VanguardAerostat2States : StateMachineBuilder
{
Expand All @@ -32,7 +32,18 @@ public D040VanguardAerostat2States(BossModule module) : base(module)
.ActivateOnEnter<IncendiaryRing>()
.ActivateOnEnter<Electrobeam>()
.ActivateOnEnter<SpreadShot>()
.Raw.Update = () => module.Enemies(D040VanguardAerostat2.Trash).All(e => e.IsDeadOrDestroyed);
.Raw.Update = () =>
{
var enemies = module.Enemies(D040VanguardAerostat2.Trash);
var count = enemies.Count;
for (var i = 0; i < count; ++i)
{
var enemy = enemies[i];
if (!enemy.IsDeadOrDestroyed)
return false;
}
return true;
};
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public enum AID : uint
AutoAttack3 = 870, // VanguardSentryS7->player, no cast, single-target

Levinbite = 39019, // Boss->player, no cast, single-target
SpreadShot = 39017, // VanguardSentryG7->self, 4.0s cast, range 12 90,000-degree cone
SpreadShot = 39017, // VanguardSentryG7->self, 4.0s cast, range 12 90-degree cone
}

class SpreadShot(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.SpreadShot), new AOEShapeCone(12, 45.Degrees()));
Expand All @@ -26,7 +26,18 @@ public D040VanguardLeptocyonStates(BossModule module) : base(module)
{
TrivialPhase()
.ActivateOnEnter<SpreadShot>()
.Raw.Update = () => module.Enemies(D040VanguardLeptocyon.Trash).All(e => e.IsDeadOrDestroyed);
.Raw.Update = () =>
{
var enemies = module.Enemies(D040VanguardLeptocyon.Trash);
var count = enemies.Count;
for (var i = 0; i < count; ++i)
{
var enemy = enemies[i];
if (!enemy.IsDeadOrDestroyed)
return false;
}
return true;
};
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public enum AID : uint
}

class Swoop(BossModule module) : Components.ChargeAOEs(module, ActionID.MakeSpell(AID.Swoop), 2.5f);
class FloaterTurn(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.FloaterTurn), new AOEShapeDonut(4, 10));
class SpinningAxle(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.SpinningAxle), 6);
class FloaterTurn(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.FloaterTurn), new AOEShapeDonut(4f, 10f));
class SpinningAxle(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.SpinningAxle), 6f);

class D040VanguardSentryR7States : StateMachineBuilder
{
Expand All @@ -27,7 +27,18 @@ public D040VanguardSentryR7States(BossModule module) : base(module)
.ActivateOnEnter<Swoop>()
.ActivateOnEnter<FloaterTurn>()
.ActivateOnEnter<SpinningAxle>()
.Raw.Update = () => module.Enemies(D040VanguardSentryR7.Trash).All(e => e.IsDeadOrDestroyed);
.Raw.Update = () =>
{
var enemies = module.Enemies(D040VanguardSentryR7.Trash);
var count = enemies.Count;
for (var i = 0; i < count; ++i)
{
var enemy = enemies[i];
if (!enemy.IsDeadOrDestroyed)
return false;
}
return true;
};
}
}

Expand All @@ -52,7 +63,7 @@ public class D040VanguardSentryR7(WorldState ws, Actor primary) : BossModule(ws,
new(-63.71f, 337.46f), new(-64.16f, 337.69f), new(-64.88f, 337.86f), new(-66.28f, 337.76f), new(-66.94f, 337.83f),
new(-68.31f, 337.72f), new(-70.32f, 337.8f), new(-70.92f, 337.87f), new(-71.61f, 337.81f), new(-72.24f, 338.11f),
new(-72.51f, 339.51f), new(-74.39f, 339.68f), new(-82.01f, 339.66f), new(-82.7f, 339.51f), new(-85.92f, 336.18f),
new(-96.32f, 335.99f), new(-96.94f, 335.95f), new(-97.81f, 335.96f), new(-98, 333.99f), new(-97.9f, 333.37f),
new(-96.32f, 335.99f), new(-96.94f, 335.95f), new(-97.81f, 335.96f), new(-98f, 333.99f), new(-97.9f, 333.37f),
new(-97.88f, 332.78f), new(-97.94f, 332.15f), new(-98.06f, 331.57f), new(-105.24f, 331.38f), new(-105.63f, 331.06f),
new(-108.96f, 326.19f), new(-109.2f, 311.78f), new(-109.26f, 311.13f), new(-110.74f, 310.93f), new(-110.74f, 310.1f),
new(-110.51f, 309.02f), new(-110.79f, 308.4f), new(-111.16f, 308.03f), new(-110.61f, 306.2f), new(-110.59f, 295.17f),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@ public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
if (_avoid.ActiveSpreads.Count != 0)
{
shape = IsGhostly(actor) ? circlesInverted : circlesAvoid;
activation = _avoid.ActiveSpreads.First().Activation;
activation = _avoid.ActiveSpreads[0].Activation;
}
else if (fleshbuster.isActive)
{
shape = IsGhostly(actor) ? circlesAvoid : circlesInverted;
activation = fleshbuster.activation;
}
else if (_seek.ActiveBaits.Any())
else if (_seek.ActiveBaits.Count != 0)
shape = IsGhostly(actor) ? circlesAvoid : circlesInverted;

yield return new(shape, Module.Center, default, activation, shape == circlesInverted ? Colors.SafeFromAOE : Colors.AOE);
yield return new(shape, Module.Center, default, activation, shape == circlesInverted ? Colors.SafeFromAOE : 0);
}

public override void OnEventEnvControl(byte index, uint state)
Expand All @@ -130,7 +130,7 @@ public override void OnCastFinished(Actor caster, ActorCastInfo spell)
public override void AddHints(int slot, Actor actor, TextHints hints)
{
var isGhostly = IsGhostly(actor);
if (fleshbuster.isActive || _seek.ActiveBaits.Any())
if (fleshbuster.isActive || _seek.ActiveBaits.Count != 0)
hints.Add(GhostHint, !isGhostly);
else if (_avoid.ActiveSpreads.Count != 0)
hints.Add(FleshHint, isGhostly);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public enum AID : uint
LineVoltage = 40665 // Electrogolem2->self, 4.0s cast, range 14 width 4 rect
}

class FlashFlood(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.SweepingGouge), new AOEShapeCone(9, 45.Degrees()));
class LineVoltage(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.LineVoltage), new AOEShapeRect(14, 2));
class FlashFlood(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.SweepingGouge), new AOEShapeCone(9f, 45f.Degrees()));
class LineVoltage(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.LineVoltage), new AOEShapeRect(14f, 2f));

class D90ForestBatStates : StateMachineBuilder
{
Expand All @@ -28,7 +28,6 @@ public D90ForestBatStates(BossModule module) : base(module)
.ActivateOnEnter<LineVoltage>()
.Raw.Update = () =>
{
var allDeadOrDestroyed = true;
var enemies = module.Enemies(D90ForestBat.Trash);
var center = module.Arena.Center;
var radius = module.Bounds.Radius;
Expand All @@ -37,12 +36,9 @@ public D90ForestBatStates(BossModule module) : base(module)
{
var enemy = enemies[i];
if (!enemy.IsDeadOrDestroyed && enemy.Position.AlmostEqual(center, radius))
{
allDeadOrDestroyed = false;
break;
}
return false;
}
return allDeadOrDestroyed;
return true;
};
}
}
Expand Down
Loading

0 comments on commit 3321292

Please sign in to comment.