From a5f4e9b7f6009632164c095a44cf7ea9491a7c97 Mon Sep 17 00:00:00 2001 From: CarnifexOptimus <156172553+CarnifexOptimus@users.noreply.github.com> Date: Tue, 11 Feb 2025 00:17:43 +0100 Subject: [PATCH] fix maulskull --- .../Dawntrail/Alliance/A10Trash/A10Despot.cs | 14 +--- .../Dungeon/D03SkydeepCenote/D033Maulskull.cs | 75 ++++++++++--------- .../EurekaOrthos/DD40TwintaniasClone.cs | 2 +- .../EurekaOrthos/DD80ProtoKaliya.cs | 2 +- BossMod/Modules/Endwalker/FATE/Daivadipa.cs | 2 +- 5 files changed, 43 insertions(+), 52 deletions(-) diff --git a/BossMod/Modules/Dawntrail/Alliance/A10Trash/A10Despot.cs b/BossMod/Modules/Dawntrail/Alliance/A10Trash/A10Despot.cs index a81985c1e6..1e791a10cb 100644 --- a/BossMod/Modules/Dawntrail/Alliance/A10Trash/A10Despot.cs +++ b/BossMod/Modules/Dawntrail/Alliance/A10Trash/A10Despot.cs @@ -33,11 +33,7 @@ class ScraplineStorm(BossModule module) : Components.KnockbackFromCastTarget(mod public override bool DestinationUnsafe(int slot, Actor actor, WPos pos) { var aoes = _aoe.AOEs; - var aoe = aoes[0]; - if (aoes.Count != 0 && aoe.Shape.Check(pos, aoe.Origin, aoe.Rotation)) - return true; - else - return false; + return aoes.Count != 0 && aoes[0].Check(pos); } public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints) @@ -54,13 +50,7 @@ class ScraplineTyphoon(BossModule module) : Components.GenericAOEs(module) private static readonly AOEShapeCircle circle = new(10f); private static readonly AOEShapeDonut donut = new(8f, 40f); - public override IEnumerable ActiveAOEs(int slot, Actor actor) - { - if (AOEs.Count != 0) - return [AOEs[0]]; - else - return []; - } + public override IEnumerable ActiveAOEs(int slot, Actor actor) => AOEs.Count != 0 ? [AOEs[0]] : []; public override void OnCastStarted(Actor caster, ActorCastInfo spell) { diff --git a/BossMod/Modules/Dawntrail/Dungeon/D03SkydeepCenote/D033Maulskull.cs b/BossMod/Modules/Dawntrail/Dungeon/D03SkydeepCenote/D033Maulskull.cs index 63b20b949e..0eb416db7a 100644 --- a/BossMod/Modules/Dawntrail/Dungeon/D03SkydeepCenote/D033Maulskull.cs +++ b/BossMod/Modules/Dawntrail/Dungeon/D03SkydeepCenote/D033Maulskull.cs @@ -69,19 +69,19 @@ public enum AID : uint class Stonecarver(BossModule module) : Components.GenericAOEs(module) { - private readonly List _aoes = new(2); + public readonly List AOEs = new(2); private static readonly AOEShapeRect rect = new(40f, 10f); private static readonly WDir offset = new(0f, 20f); public override IEnumerable ActiveAOEs(int slot, Actor actor) { - var count = _aoes.Count; + var count = AOEs.Count; if (count == 0) return []; var aoes = new AOEInstance[count]; for (var i = 0; i < count; ++i) { - var aoe = _aoes[i]; + var aoe = AOEs[i]; if (i == 0) aoes[i] = count != 1 ? aoe with { Color = Colors.Danger } : aoe; else @@ -98,23 +98,23 @@ public override void OnCastStarted(Actor caster, ActorCastInfo spell) case (uint)AID.Stonecarver2: case (uint)AID.Stonecarver3: case (uint)AID.Stonecarver4: - _aoes.Add(new(rect, spell.LocXZ, spell.Rotation, Module.CastFinishAt(spell))); - if (_aoes.Count == 2) - _aoes.SortBy(x => x.Activation); + AOEs.Add(new(rect, spell.LocXZ, spell.Rotation, Module.CastFinishAt(spell))); + if (AOEs.Count == 2) + AOEs.SortBy(x => x.Activation); break; } } public override void OnCastFinished(Actor caster, ActorCastInfo spell) { - if (_aoes.Count != 0) + if (AOEs.Count != 0) switch (spell.Action.ID) { case (uint)AID.Stonecarver1: case (uint)AID.Stonecarver2: case (uint)AID.Stonecarver3: case (uint)AID.Stonecarver4: - _aoes.RemoveAt(0); + AOEs.RemoveAt(0); break; } } @@ -122,8 +122,8 @@ public override void OnCastFinished(Actor caster, ActorCastInfo spell) public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints) { base.AddAIHints(slot, actor, assignment, hints); - if (_aoes.Count != 0) - hints.AddForbiddenZone(ShapeDistance.InvertedRect(Arena.Center + offset, Arena.Center - offset, 2f), _aoes[0].Activation); + if (AOEs.Count != 0) + hints.AddForbiddenZone(ShapeDistance.InvertedRect(Arena.Center + offset, Arena.Center - offset, 2f), AOEs[0].Activation); } } @@ -148,17 +148,17 @@ public override IEnumerable ActiveAOEs(int slot, Actor actor) public override void OnCastFinished(Actor caster, ActorCastInfo spell) { - var activation = Module.CastFinishAt(spell, 15.1f); + void AddAOE(AOEShape shape, WPos pos, Angle rot) => _aoes.Add(new(shape, WPos.ClampToGrid(pos), rot, Module.CastFinishAt(spell, 15.1f))); switch (spell.Action.ID) { case (uint)AID.MaulworkFirstCenter: case (uint)AID.MaulworkSecondCenter: - _aoes.Add(new(rectCenter, caster.Position, spell.Rotation, activation)); + AddAOE(rectCenter, caster.Position, spell.Rotation); break; case (uint)AID.MaulworkFirstSides: case (uint)AID.MaulworkSecondSides: - _aoes.Add(new(rectSides, new(91.564f, caster.Position.Z), -17.004f.Degrees(), activation)); - _aoes.Add(new(rectSides, new(108.436f, caster.Position.Z), 16.999f.Degrees(), activation)); + AddAOE(rectSides, new(91.564f, caster.Position.Z), -17.004f.Degrees()); + AddAOE(rectSides, new(108.436f, caster.Position.Z), 16.999f.Degrees()); break; case (uint)AID.ShatterCenter: case (uint)AID.ShatterLR1: @@ -169,43 +169,44 @@ public override void OnCastFinished(Actor caster, ActorCastInfo spell) } } -abstract class Impact(BossModule module, AID aid, int distance) : Components.KnockbackFromCastTarget(module, ActionID.MakeSpell(aid), distance, stopAfterWall: true); +abstract class Impact(BossModule module, AID aid, float distance) : Components.KnockbackFromCastTarget(module, ActionID.MakeSpell(aid), distance, stopAfterWall: true); -class Impact1(BossModule module) : Impact(module, AID.Impact1, 18) +class Impact1(BossModule module) : Impact(module, AID.Impact1, 18f) { - private static readonly Angle halfAngle = 30.Degrees(); + private static readonly Angle halfAngle = 30f.Degrees(); public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints) { - var source = Sources(slot, actor).FirstOrDefault(); - if (source != default) - hints.AddForbiddenZone(ShapeDistance.InvertedDonutSector(source.Origin, 10f, 12f, default, halfAngle), source.Activation); + var source = Casters.Count != 0 ? Casters[0] : null; + if (source != null) + hints.AddForbiddenZone(ShapeDistance.InvertedDonutSector(source.Position, 10f, 12f, default, halfAngle), Module.CastFinishAt(source.CastInfo)); } } -class Impact2(BossModule module) : Impact(module, AID.Impact2, 18) +class Impact2(BossModule module) : Impact(module, AID.Impact2, 18f) { - private static readonly Angle halfAngle = 20.Degrees(); + private static readonly Angle halfAngle = 20f.Degrees(); + private readonly Stonecarver _aoe = module.FindComponent()!; - public override bool DestinationUnsafe(int slot, Actor actor, WPos pos) => (Module.FindComponent()?.ActiveAOEs(slot, actor).Any(z => z.Shape.Check(pos, z.Origin, z.Rotation) && z.Risky) ?? false) || !Arena.InBounds(pos); + public override bool DestinationUnsafe(int slot, Actor actor, WPos pos) => _aoe.AOEs.Count != 0 && _aoe.AOEs[0].Check(pos) || !Module.InBounds(pos); public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints) { - var source = Sources(slot, actor).FirstOrDefault(); - if (source != default) - hints.AddForbiddenZone(ShapeDistance.InvertedDonutSector(source.Origin, 10f, 12f, default, halfAngle), source.Activation); + var source = Casters.Count != 0 ? Casters[0] : null; + if (source != null) + hints.AddForbiddenZone(ShapeDistance.InvertedDonutSector(source.Position, 10f, 12f, default, halfAngle), Module.CastFinishAt(source.CastInfo)); } } -class Impact3(BossModule module) : Impact(module, AID.Impact3, 20) +class Impact3(BossModule module) : Impact(module, AID.Impact3, 20f) { private static readonly Angle halfAngle = 10f.Degrees(), direction = 135f.Degrees(); public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints) { - var source = Sources(slot, actor).FirstOrDefault(); - if (source != default) - hints.AddForbiddenZone(ShapeDistance.InvertedDonutSector(source.Origin, 10f, 15f, (source.Origin.X == 90f ? 1f : -1f) * direction, halfAngle), source.Activation); + var source = Casters.Count != 0 ? Casters[0] : null; + if (source != null) + hints.AddForbiddenZone(ShapeDistance.InvertedDonutSector(source.Position, 10f, 15f, (source.Position.X == 90f ? 1f : -1f) * direction, halfAngle), Module.CastFinishAt(source.CastInfo)); } } @@ -225,16 +226,16 @@ public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignme { if (Spreads.Count != 0) { - var source1 = _kb1.Sources(slot, actor).FirstOrDefault(); - var source2 = _kb2.Sources(slot, actor).FirstOrDefault(); - var source3 = _kb3.Sources(slot, actor).FirstOrDefault(); - var knockback = source1 != default || source2 != default || source3 != default; + var source1 = _kb1.Casters.Count != 0 ? _kb1.Casters[0] : null; + var source2 = _kb2.Casters.Count != 0 ? _kb2.Casters[0] : null; + var source3 = _kb3.Casters.Count != 0 ? _kb3.Casters[0] : null; + var knockback = source1 != null || source2 != null || source3 != null; if (source1 != default) origin = new(100f, -400f); else if (source2 != default) - origin = source2.Origin; + origin = source2.Position; else if (source3 != default) - origin = source3.Origin; + origin = source3.Position; if (!knockback) { base.AddAIHints(slot, actor, assignment, hints); @@ -246,7 +247,7 @@ public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignme } } -class Landing(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.Landing), 8); +class Landing(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.Landing), 8f); abstract class DeepThunder(BossModule module, AID aid) : Components.CastTowers(module, ActionID.MakeSpell(aid), 6f, 4, 4); class DeepThunder1(BossModule module) : DeepThunder(module, AID.DeepThunderTower1); diff --git a/BossMod/Modules/Endwalker/DeepDungeon/EurekaOrthos/DD40TwintaniasClone.cs b/BossMod/Modules/Endwalker/DeepDungeon/EurekaOrthos/DD40TwintaniasClone.cs index f1e302ae32..c9241fe1e0 100644 --- a/BossMod/Modules/Endwalker/DeepDungeon/EurekaOrthos/DD40TwintaniasClone.cs +++ b/BossMod/Modules/Endwalker/DeepDungeon/EurekaOrthos/DD40TwintaniasClone.cs @@ -84,7 +84,7 @@ public override bool DestinationUnsafe(int slot, Actor actor, WPos pos) { foreach (var aoe in _aoe.ActiveAOEs(slot, actor)) { - if (aoe.Shape.Check(pos, aoe.Origin, aoe.Rotation)) + if (aoe.Check(pos)) return true; } return !Arena.InBounds(pos); diff --git a/BossMod/Modules/Endwalker/DeepDungeon/EurekaOrthos/DD80ProtoKaliya.cs b/BossMod/Modules/Endwalker/DeepDungeon/EurekaOrthos/DD80ProtoKaliya.cs index 5bedc91a81..0162faa5ec 100644 --- a/BossMod/Modules/Endwalker/DeepDungeon/EurekaOrthos/DD80ProtoKaliya.cs +++ b/BossMod/Modules/Endwalker/DeepDungeon/EurekaOrthos/DD80ProtoKaliya.cs @@ -66,7 +66,7 @@ public override bool DestinationUnsafe(int slot, Actor actor, WPos pos) for (var i = 0; i < count; ++i) { var aoe = _aoe1.AOEs[i]; - if (aoe.Shape.Check(pos, aoe.Origin, aoe.Rotation)) + if (aoe.Check(pos)) return true; } diff --git a/BossMod/Modules/Endwalker/FATE/Daivadipa.cs b/BossMod/Modules/Endwalker/FATE/Daivadipa.cs index c04d2b3ce7..9e1e28df12 100644 --- a/BossMod/Modules/Endwalker/FATE/Daivadipa.cs +++ b/BossMod/Modules/Endwalker/FATE/Daivadipa.cs @@ -173,7 +173,7 @@ public override bool DestinationUnsafe(int slot, Actor actor, WPos pos) for (var i = 0; i < count; ++i) { var aoe = _lit.AOEs[i]; - if (aoe.Shape.Check(pos, aoe.Origin, aoe.Rotation)) + if (aoe.Check(pos)) return true; } return false;