Skip to content

Commit

Permalink
Merge pull request #434 from FFXIV-CombatReborn/mergeWIP
Browse files Browse the repository at this point in the history
xelphatol trash mob modules
  • Loading branch information
CarnifexOptimus authored Nov 11, 2024
2 parents bc7421a + 4da5524 commit 9b71c13
Show file tree
Hide file tree
Showing 32 changed files with 699 additions and 69 deletions.
3 changes: 2 additions & 1 deletion BossMod/Components/CastHint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ public CastInterruptHint(BossModule module, ActionID aid, bool canBeInterrupted

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
{
foreach (var c in Casters)
for (var i = 0; i < Casters.Count; ++i)
{
var c = Casters[i];
var e = hints.PotentialTargets.Find(e => e.Actor == c);
if (e != null)
{
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Components/Gaze.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public record struct Eye(
private const float _eyeOuterR = (_eyeOuterH * _eyeOuterH + _eyeOuterV * _eyeOuterV) / (2 * _eyeOuterV);
private const float _eyeOffsetV = _eyeOuterR - _eyeOuterV;

private static readonly float _eyeHalfAngle = MathF.Asin(_eyeOuterH / _eyeOuterR);
private static readonly float _eyeHalfAngle = (float)Math.Asin(_eyeOuterH / _eyeOuterR);
private static readonly Vector2 offset = new(0, _eyeOffsetV);
private static readonly float halfPIHalfAngleP = Angle.HalfPi + _eyeHalfAngle;
private static readonly float halfPIHalfAngleM = Angle.HalfPi - _eyeHalfAngle;
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Data/Actor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public sealed class Actor(ulong instanceID, uint oid, int spawnIndex, string nam
public bool IsDeadOrDestroyed => IsDead || IsDestroyed;
public static readonly Actor FakeActor = new(0, 0, -1, "dummy", 0, ActorType.None, Class.None, 0, new(100, 0, 100, 0));

private static readonly HashSet<uint> ignoreNPC = [0x2EFE]; // friendly NPCs that should not count as party members
private static readonly HashSet<uint> ignoreNPC = [0x2EFE, 0x418F]; // friendly NPCs that should not count as party members
public bool IsFriendlyNPC => Type == ActorType.Enemy && IsAlly && IsTargetable && !ignoreNPC.Contains(OID);

public ActorStatus? FindStatus(uint sid)
Expand Down
6 changes: 3 additions & 3 deletions BossMod/Data/PartyState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void assign(ulong instanceID, Actor? actor)
// select non-null and optionally alive raid members
public IEnumerable<Actor> WithoutSlot(bool includeDead = false, bool excludeAlliance = false, bool excludeNPCs = false)
{
for (int i = 0; i < MaxAllies; ++i)
for (var i = 0; i < MaxAllies; ++i)
{
if (excludeNPCs && i >= MaxAllianceSize)
break;
Expand All @@ -68,7 +68,7 @@ public IEnumerable<Actor> WithoutSlot(bool includeDead = false, bool excludeAlli

public IEnumerable<(int, Actor)> WithSlot(bool includeDead = false, bool excludeAlliance = false)
{
for (int i = 0; i < MaxAllies; ++i)
for (var i = 0; i < MaxAllies; ++i)
{
if (excludeAlliance && i is >= MaxPartySize and < MaxAllianceSize)
continue;
Expand All @@ -87,7 +87,7 @@ public IEnumerable<Actor> WithoutSlot(bool includeDead = false, bool excludeAlli
// find a slot index containing specified player (by name); returns -1 if not found
public int FindSlot(ReadOnlySpan<char> name, StringComparison cmp = StringComparison.CurrentCultureIgnoreCase)
{
for (int i = 0; i < Members.Length; ++i)
for (var i = 0; i < Members.Length; ++i)
if (name.Equals(Members[i].Name, cmp))
return i;
return -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,5 @@ public D051LiviaStates(BossModule module) : base(module)
[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "The Combat Reborn Team (Malediktus, LTS)", GroupType = BossModuleInfo.GroupType.CFC, GroupID = 786, NameID = 10290)]
public class D051Livia(WorldState ws, Actor primary) : BossModule(ws, primary, arena.Center, arena)
{
private static readonly ArenaBoundsComplex arena = new([new Polygon(new(-6, 471), 19.5f / MathF.Cos(MathF.PI / 36), 36)], [new Rectangle(new(-6, 491.8f), 20, 2)]);
private static readonly ArenaBoundsComplex arena = new([new Polygon(new(-6, 471), 19.5f * CosPI.Pi36th, 36)], [new Rectangle(new(-6, 491.8f), 20, 2)]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public enum AID : uint

class CurtainCallArenaChange(BossModule module) : BossComponent(module)
{
private static readonly Shape[] circle = [new Polygon(new(11, -490), 6.4f / MathF.Cos(MathF.PI / 20), 20, 9.Degrees())];
private static readonly Shape[] circle = [new Polygon(new(11, -490), 6.4f * CosPI.Pi20th, 20, 9.Degrees())];
public static readonly ArenaBoundsComplex CurtaincallArena = new(D053Amon.union, [.. D053Amon.difference, .. circle]);

public override void OnEventEnvControl(byte index, uint state)
Expand Down
9 changes: 4 additions & 5 deletions BossMod/Modules/Endwalker/FATE/Daivadipa.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,23 @@ class LitPath(BossModule module) : Components.GenericAOEs(module)
private bool redblue2;
private bool bluered1;
private bool bluered2;
private const float maxError = MathF.PI / 180;

public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
{
if (_activation != default)
{
foreach (var o in Module.Enemies(OID.OrbOfImmolationBlue))
{
if (bluered1 && (o.Rotation.AlmostEqual(90.Degrees(), maxError) || o.Rotation.AlmostEqual(180.Degrees(), maxError)))
if (bluered1 && (o.Rotation.AlmostEqual(90.Degrees(), Angle.DegToRad) || o.Rotation.AlmostEqual(180.Degrees(), Angle.DegToRad)))
yield return new(rect, o.Position, o.Rotation, _activation.AddSeconds(1.9f));
if (redblue2 && !redblue1 && (o.Rotation.AlmostEqual(90.Degrees(), maxError) || o.Rotation.AlmostEqual(180.Degrees(), maxError)))
if (redblue2 && !redblue1 && (o.Rotation.AlmostEqual(90.Degrees(), Angle.DegToRad) || o.Rotation.AlmostEqual(180.Degrees(), Angle.DegToRad)))
yield return new(rect, o.Position, o.Rotation, _activation.AddSeconds(4));
}
foreach (var o in Module.Enemies(OID.OrbOfImmolationRed))
{
if (bluered2 && !bluered1 && (o.Rotation.AlmostEqual(90.Degrees(), maxError) || o.Rotation.AlmostEqual(180.Degrees(), maxError)))
if (bluered2 && !bluered1 && (o.Rotation.AlmostEqual(90.Degrees(), Angle.DegToRad) || o.Rotation.AlmostEqual(180.Degrees(), Angle.DegToRad)))
yield return new(rect, o.Position, o.Rotation, _activation.AddSeconds(4));
if (redblue1 && (o.Rotation.AlmostEqual(90.Degrees(), maxError) || o.Rotation.AlmostEqual(180.Degrees(), maxError)))
if (redblue1 && (o.Rotation.AlmostEqual(90.Degrees(), Angle.DegToRad) || o.Rotation.AlmostEqual(180.Degrees(), Angle.DegToRad)))
yield return new(rect, o.Position, o.Rotation, _activation.AddSeconds(1.9f));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public override void Update()
var severDirEast = _severStartDir;
if (severDirEast.Rad < 0)
severDirEast += 180.Degrees();
var severDiagonalSE = severDirEast.Rad < MathF.PI / 2;
var severDiagonalSE = severDirEast.Rad < MathF.PI * 0.5f;
var chargeCW = _flares.ChargeAngle.Rad < 0;
_chargeEarly = severDiagonalSE == chargeCW;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public D111ZuroRoggoStates(BossModule module) : base(module)
[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "The Combat Reborn Team (Malediktus)", GroupType = BossModuleInfo.GroupType.CFC, GroupID = 141, NameID = 4805)]
public class D111ZuroRoggo(WorldState ws, Actor primary) : BossModule(ws, primary, arena.Center, arena)
{
private static readonly ArenaBoundsComplex arena = new([new Polygon(new(-365, -250), 19.5f / MathF.Cos(MathF.PI / 32), 32)], [new Rectangle(new(-365, -230), 20, 2.01f),
private static readonly ArenaBoundsComplex arena = new([new Polygon(new(-365, -250), 19.5f * CosPI.Pi32th, 32)], [new Rectangle(new(-365, -230), 20, 2.01f),
new Rectangle(new(-365, -270), 20, 1.75f)]);

protected override void DrawEnemies(int pcSlot, Actor pc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ public D112ZiggyStates(BossModule module) : base(module)
public class D112Ziggy(WorldState ws, Actor primary) : BossModule(ws, primary, arena.Center, arena)
{
public static readonly WPos ArenaCenter = new(185.8f, 137.5f);
private static readonly ArenaBoundsComplex arena = new([new Polygon(ArenaCenter, 20.06f / MathF.Cos(MathF.PI / 36), 36)], [new Rectangle(new(166, 138), 20, 1.1f, 90.Degrees()),
private static readonly ArenaBoundsComplex arena = new([new Polygon(ArenaCenter, 20.06f * CosPI.Pi36th, 36)], [new Rectangle(new(166, 138), 20, 1.1f, 90.Degrees()),
new Rectangle(new(207, 137), 20, 2.6f, 90.Degrees())]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public D113CalcabrinaStates(BossModule module) : base(module)
[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "The Combat Reborn Team (Malediktus)", GroupType = BossModuleInfo.GroupType.CFC, GroupID = 141, NameID = 4813)]
public class D113Calcabrina(WorldState ws, Actor primary) : BossModule(ws, primary, arena.Center, arena)
{
private static readonly ArenaBoundsComplex arena = new([new Polygon(new(232, -182), 19.5f / MathF.Cos(MathF.PI / 36), 36)], [new Rectangle(new(252, -182), 20, 1.15f, 90.Degrees())]);
private static readonly ArenaBoundsComplex arena = new([new Polygon(new(232, -182), 19.5f * CosPI.Pi36th, 36)], [new Rectangle(new(252, -182), 20, 1.15f, 90.Degrees())]);

protected override void DrawEnemies(int pcSlot, Actor pc)
{
Expand Down
Loading

0 comments on commit 9b71c13

Please sign in to comment.