Skip to content

Commit

Permalink
Merge pull request #402 from FFXIV-CombatReborn/mergeWIP
Browse files Browse the repository at this point in the history
bardams mettle ai improvement
  • Loading branch information
CarnifexOptimus authored Oct 13, 2024
2 parents d1d5449 + 6fc6c43 commit 24d7c48
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 29 deletions.
2 changes: 1 addition & 1 deletion BossMod/Components/BaitAway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public override void OnCastFinished(Actor caster, ActorCastInfo spell)
}

// a variation of baits with tethers for charges that end at target
public class BaitAwayChargeTether(BossModule module, float halfWidth, float activationDelay, uint tetherIDBad, uint tetherIDGood, ActionID aidGood, ActionID aidBad = default, uint enemyOID = default, float minimumDistance = default)
public class BaitAwayChargeTether(BossModule module, float halfWidth, float activationDelay, ActionID aidGood, ActionID aidBad = default, uint tetherIDBad = 57, uint tetherIDGood = 1, uint enemyOID = default, float minimumDistance = default)
: StretchTetherDuo(module, minimumDistance, activationDelay, tetherIDBad, tetherIDGood, new AOEShapeRect(default, halfWidth), default, enemyOID)
{
public ActionID AidGood = aidGood;
Expand Down
17 changes: 8 additions & 9 deletions BossMod/Components/LineOfSightAOE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
// generic component that shows line-of-sight cones for arbitrary origin and blocking shapes
// TODO: add support for multiple AOE sources at the same time (I simplified Hermes from 4 AOEs into one)
// add support for blockers that spawn or get destroyed after cast already started (Hermes: again a cheat here by only using that meteor that exists for the whole mechanic)
public abstract class GenericLineOfSightAOE(BossModule module, ActionID aid, float maxRange, bool blockersImpassable, bool rect = false) : GenericAOEs(module, aid, "Hide behind obstacle!")
public abstract class GenericLineOfSightAOE(BossModule module, ActionID aid, float maxRange, bool blockersImpassable = false, bool rect = false, bool safeInsideHitbox = true) : GenericAOEs(module, aid, "Hide behind obstacle!")
{
public DateTime NextExplosion;
public bool BlockersImpassable = blockersImpassable;
public bool SafeInsideHitbox = safeInsideHitbox;
public float MaxRange { get; private set; } = maxRange;
public bool Rect { get; private set; } = rect; // if the AOE is a rectangle instead of a circle
public WPos? Origin { get; private set; } // inactive if null
Expand All @@ -15,7 +16,6 @@ public abstract class GenericLineOfSightAOE(BossModule module, ActionID aid, flo
public List<AOEInstance> Safezones = [];
public List<Shape> UnionShapes = [];
public List<Shape> DifferenceShapes = [];
private const float PCHitBoxRadius = 0.5f;

public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor) => Safezones.Take(1);
public void Modify(WPos? origin, IEnumerable<(WPos Center, float Radius)> blockers, DateTime nextExplosion = default)
Expand Down Expand Up @@ -56,19 +56,18 @@ public void AddSafezone(DateTime activation, Angle rotation = default)
{
foreach (var v in Visibility)
UnionShapes.Add(new DonutSegmentHA(Origin.Value, v.Distance + 0.2f, MaxRange, v.Dir, v.HalfWidth));
if (BlockersImpassable)
foreach (var b in Blockers)
DifferenceShapes.Add(new Circle(b.Center, b.Radius + PCHitBoxRadius));
}
else if (Rect)
{
foreach (var b in Blockers)
{
UnionShapes.Add(new RectangleSE(b.Center, b.Center + MaxRange * rotation.ToDirection(), b.Radius));
if (BlockersImpassable)
DifferenceShapes.Add(new Circle(b.Center, b.Radius + PCHitBoxRadius));
var dir = rotation.ToDirection();
UnionShapes.Add(new RectangleSE(b.Center + 0.2f * dir, b.Center + MaxRange * dir, b.Radius));
}
}
if (BlockersImpassable || !SafeInsideHitbox)
foreach (var b in Blockers)
DifferenceShapes.Add(new Circle(b.Center, !SafeInsideHitbox ? b.Radius : b.Radius + 0.5f));
Safezones.Add(new(new AOEShapeCustom(CopyShapes(UnionShapes), CopyShapes(DifferenceShapes), InvertForbiddenZone: true), Arena.Center, default, activation, Colors.SafeFromAOE));
UnionShapes.Clear();
}
Expand All @@ -94,7 +93,7 @@ public abstract class CastLineOfSightAOE : GenericLineOfSightAOE
public readonly List<Actor> Casters = [];
public Actor? ActiveCaster => Casters.MinBy(c => c.CastInfo!.RemainingTime);

protected CastLineOfSightAOE(BossModule module, ActionID aid, float maxRange, bool blockersImpassable, bool rect = false) : base(module, aid, maxRange, blockersImpassable, rect)
protected CastLineOfSightAOE(BossModule module, ActionID aid, float maxRange, bool blockersImpassable = false, bool rect = false, bool safeInsideHitbox = true) : base(module, aid, maxRange, blockersImpassable, rect, safeInsideHitbox)
{
Refresh();
}
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/Dawntrail/Quest/RoleQuests/AHunterTrue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class NinefoldCurse(BossModule module) : Components.RaidwideCastDelay(module, Ac
class NinetyNinefoldCurse(BossModule module) : Components.RaidwideCast(module, ActionID.MakeSpell(AID.NinetyNinefoldCurse));
class Roar(BossModule module) : Components.RaidwideCast(module, ActionID.MakeSpell(AID.Roar));
class SonicStorm(BossModule module) : Components.SpreadFromCastTargets(module, ActionID.MakeSpell(AID.SonicStorm), 6);
class RushBait(BossModule module) : Components.BaitAwayChargeTether(module, 4, 8.3f, (uint)TetherID.TetherBad, (uint)TetherID.TetherGood, ActionID.MakeSpell(AID.RushBait), ActionID.MakeSpell(AID.RushBaitFail), (uint)OID.Dzo, 30);
class RushBait(BossModule module) : Components.BaitAwayChargeTether(module, 4, 8.3f, ActionID.MakeSpell(AID.RushBait), ActionID.MakeSpell(AID.RushBaitFail), (uint)TetherID.TetherBad, (uint)TetherID.TetherGood, (uint)OID.Dzo, 30);
class RushLineStack(BossModule module) : Components.LineStack(module, ActionID.MakeSpell(AID.RushLineStackMarker), ActionID.MakeSpell(AID.RushLineStack), 4.9f, markerIsFinalTarget: false);
class Trample(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.Trample), new AOEShapeCircle(15));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class DarkForte(BossModule module) : Components.SingleTargetCast(module, ActionI
class Entracte(BossModule module) : Components.RaidwideCast(module, ActionID.MakeSpell(AID.Entracte));
class DreamsOfIce(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.DreamsOfIce), new AOEShapeCircle(6));

class CurtainCall(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.CurtainCall), 60, false)
class CurtainCall(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.CurtainCall), 60)
{
public override IEnumerable<Actor> BlockerActors() => Module.Enemies(OID.Ice);
public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class IcyThroesSpread(BossModule module) : Components.SpreadFromCastTargets(modu
class LeftSlam(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.LeftSlam), new AOEShapeRect(20, 80, 0, 90.Degrees())); // full width = half width in this case + angle is detected incorrectly, length and width are also switched
class AlbionsEmbrace(BossModule module) : Components.SingleTargetCast(module, ActionID.MakeSpell(AID.AlbionsEmbrace));

class RoarOfAlbion(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.RoarOfAlbion), 60, false)
class RoarOfAlbion(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.RoarOfAlbion), 60)
{
public override IEnumerable<Actor> BlockerActors() => Module.Enemies(OID.IcyCrystal);
}
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/Endwalker/Savage/P9SKokytos/Charibdys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public override void OnEventCast(Actor caster, ActorCastEvent spell)
}
}

class EclipticMeteor(BossModule module) : Components.GenericLineOfSightAOE(module, ActionID.MakeSpell(AID.EclipticMeteorAOE), 60, false)
class EclipticMeteor(BossModule module) : Components.GenericLineOfSightAOE(module, ActionID.MakeSpell(AID.EclipticMeteorAOE), 60, safeInsideHitbox: false)
{
public override void OnEventIcon(Actor actor, uint iconID)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public override void OnCastFinished(Actor caster, ActorCastInfo spell)

class FlashOfSteel1(BossModule module) : Components.RaidwideCast(module, ActionID.MakeSpell(AID.FlashOfSteel1), "Raidwide");
class FlashOfSteel2(BossModule module) : Components.RaidwideCast(module, ActionID.MakeSpell(AID.FlashOfSteel2), "Raidwide");
class ShatteringSteelMeteor(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.ShatteringSteel), 60, false)
class ShatteringSteelMeteor(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.ShatteringSteel), 60)
{
public override IEnumerable<Actor> BlockerActors() => Module.Enemies(OID.AntiqueBoulder).Where(a => !a.IsDead);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Rootstorm(BossModule module) : Components.RaidwideCast(module, ActionID.Ma
class Ambush(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.Ambush), new AOEShapeCircle(9));
class AmbushKnockback(BossModule module) : Components.KnockbackFromCastTarget(module, ActionID.MakeSpell(AID.Ambush), 30, stopAtWall: true, kind: Kind.TowardsOrigin);

class ShockwaveStomp(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.ShockwaveStomp), 70, false)
class ShockwaveStomp(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.ShockwaveStomp), 70)
{
public override IEnumerable<Actor> BlockerActors() => Module.Enemies(OID.Irminsul).Where(a => !a.IsDead);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace BossMod.RealmReborn.Alliance.A13KingBehemoth;

class EclipticMeteor(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.EclipticMeteor), 60, false)
class EclipticMeteor(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.EclipticMeteor), 60)
{
public override IEnumerable<Actor> BlockerActors() => Module.Enemies(OID.Comet).Where(a => !a.IsDead);
}
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/RealmReborn/Alliance/A23Amon/A23Amon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class BlizzagaForte(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.BlizzagaForte), new AOEShapeCircle(10));
class Darkness(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.Darkness), new AOEShapeCone(6, 22.5f.Degrees()));

class CurtainCall(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.CurtainCall), 60, false)
class CurtainCall(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.CurtainCall), 60)
{
public override IEnumerable<Actor> BlockerActors() => Module.Enemies(OID.IceCage).Where(a => !a.IsDead);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public enum AID : uint
HeavenswardRoar = 29593, // Boss->self, 5.0s cast, range 50 60-degree cone
}

class LunarCry(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.LunarCry), 80, false)
class LunarCry(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.LunarCry), 80)
{
public override IEnumerable<Actor> BlockerActors() => Module.Enemies(OID.Icicle).Where(x => x.ModelState.AnimState1 != 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignme
}
}

class TheFinalSky(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.TheFinalSky), 70, false)
class TheFinalSky(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.TheFinalSky), 70, safeInsideHitbox: false)
{
public override IEnumerable<Actor> BlockerActors() => Module.Enemies(OID.FallenStar);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public enum IconID : uint
class ResonantFrequencyDim(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.ResonantFrequencyDim), new AOEShapeCircle(6));
class ResonantFrequencyCorrupted(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.ResonantFrequencyCorrupted), new AOEShapeCircle(6));

class CrystallineStingers(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.CrystallineStingers), 60, false)
class CrystallineStingers(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.CrystallineStingers), 60)
{
public override IEnumerable<Actor> BlockerActors() => Module.Enemies(OID.DimCrystal).Where(a => !a.IsDead);
}

class AetherialStingers(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.AetherialStingers), 60, false)
class AetherialStingers(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.AetherialStingers), 60)
{
public override IEnumerable<Actor> BlockerActors() => Module.Enemies(OID.CorruptedCrystal).Where(a => !a.IsDead);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignme
}
}

class LunarCry(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.LunarCry), 80, false)
class LunarCry(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.LunarCry), 80)
{
private readonly List<Actor> _safePillars = [];
private readonly BracingWind? _knockback = module.FindComponent<BracingWind>();
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/Shadowbringers/Ultimate/TEA/TEA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class P2Photon(BossModule module) : Components.CastCounter(module, ActionID.Make
class P2SpinCrusher(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.SpinCrusher), new AOEShapeCone(10, 45.Degrees()));
class P2Drainage(BossModule module) : Components.PersistentVoidzone(module, 8, m => m.Enemies(OID.LiquidRage)); // TODO: verify distance

class P2PropellerWind(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.PropellerWind), 50, false)
class P2PropellerWind(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.PropellerWind), 50)
{
public override IEnumerable<Actor> BlockerActors() => Module.Enemies(OID.GelidGaol);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public enum AID : uint
class CrumblingCrust(BossModule module) : Components.LocationTargetedAOEs(module, ActionID.MakeSpell(AID.CrumblingCrust), 3);
class Heave(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.Heave), new AOEShapeCone(13, 60.Degrees()));
class WideBlaster(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.WideBlaster), new AOEShapeCone(29.15f, 60.Degrees()));
class Rush(BossModule module) : Components.BaitAwayChargeCast(module, ActionID.MakeSpell(AID.Rush), 4);
class RushTether(BossModule module) : Components.StretchTetherDuo(module, 16, 10.1f)
class Rush(BossModule module) : Components.BaitAwayChargeTether(module, 4, 10.1f, ActionID.MakeSpell(AID.Rush), minimumDistance: 23)
{
public override void Update()
{
base.Update();
if (Module.PrimaryActor.CastInfo == null)
CurrentBaits.Clear();
}
Expand All @@ -50,7 +50,6 @@ public D031GarulaStates(BossModule module) : base(module)
.ActivateOnEnter<Heave>()
.ActivateOnEnter<WideBlaster>()
.ActivateOnEnter<Rush>()
.ActivateOnEnter<RushTether>()
.ActivateOnEnter<RushYamaa>()
.ActivateOnEnter<Lullaby>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public enum IconID : uint
class CometFirst(BossModule module) : Components.LocationTargetedAOEs(module, ActionID.MakeSpell(AID.CometFirst), 4);
class CometRest(BossModule module) : Components.LocationTargetedAOEs(module, ActionID.MakeSpell(AID.CometRest), 4);

class MeteorImpact(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.MeteorImpact), 50, false)
class MeteorImpact(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.MeteorImpact), 50, safeInsideHitbox: false)
{
private DateTime activation;

Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/Stormblood/Dungeon/D13Burn/D131Hedetet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public override void AddHints(int slot, Actor actor, TextHints hints)
}

class CrystalNeedle(BossModule module) : Components.SingleTargetCast(module, ActionID.MakeSpell(AID.CrystalNeedle));
class Shardfall(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.Shardfall), 40, false)
class Shardfall(BossModule module) : Components.CastLineOfSightAOE(module, ActionID.MakeSpell(AID.Shardfall), 40)
{
public override IEnumerable<Actor> BlockerActors() => Module.Enemies(OID.DimCrystal).Where(e => !e.IsDead);
}
Expand Down

0 comments on commit 24d7c48

Please sign in to comment.