Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vanguard map fixes, manual targeting option for AI #505

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions BossMod/AI/AIBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@ public async Task Execute(Actor player, Actor master)
if (!forbidActions && (AIPreset != null || autorot.Preset != null))
{
target = SelectPrimaryTarget(player, master);
AdjustTargetPositional(player, ref target);
if (_config.ManualTarget)
{
var t = autorot.WorldState.Actors.Find(player.TargetID);
if (t != null)
target.Target = new AIHints.Enemy(t, false);
else
target = new();
}
if (target.Target != null || TargetIsForbidden(player.TargetID))
autorot.Hints.ForcedTarget ??= target.Target?.Actor;
AdjustTargetPositional(player, ref target);
}

var followTarget = _config.FollowTarget;
Expand Down Expand Up @@ -265,14 +273,16 @@ public void DrawDebug()
configModified |= ImGui.Checkbox("Forbid movement", ref _config.ForbidMovement);
ImGui.SameLine();
configModified |= ImGui.Checkbox("Follow during combat", ref _config.FollowDuringCombat);
ImGui.SameLine();
configModified |= ImGui.Checkbox("Override autorotation values", ref _config.OverrideAutorotation);
ImGui.Spacing();
configModified |= ImGui.Checkbox("Follow during active boss module", ref _config.FollowDuringActiveBossModule);
ImGui.SameLine();
configModified |= ImGui.Checkbox("Follow out of combat", ref _config.FollowOutOfCombat);
ImGui.SameLine();
configModified |= ImGui.Checkbox("Follow target", ref _config.FollowTarget);
ImGui.Spacing();
configModified |= ImGui.Checkbox("Manual targeting", ref _config.ManualTarget);
ImGui.SameLine();
configModified |= ImGui.Checkbox("Override autorotation values", ref _config.OverrideAutorotation);
ImGui.SameLine();
configModified |= ImGui.Checkbox("Allow outside bounds", ref _config.AllowAIToBeOutsideBounds);

Expand Down
3 changes: 3 additions & 0 deletions BossMod/AI/AIConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ sealed class AIConfig : ConfigNode
[PropertyDisplay("Forbid actions")]
public bool ForbidActions = false;

[PropertyDisplay("Manual targeting")]
public bool ManualTarget = false;

[PropertyDisplay("Forbid movement")]
public bool ForbidMovement = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ public D040VanguardAerostat1States(BossModule module) : base(module)
{
TrivialPhase()
.ActivateOnEnter<IncendiaryRing>()
.Raw.Update = () => module.Enemies(OID.Aerostat2).Concat([module.PrimaryActor]).All(e => e.IsDeadOrDestroyed);
.Raw.Update = () => module.Enemies(D040VanguardAerostat1.Trash).All(e => e.IsDeadOrDestroyed);
}
}

[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "The Combat Reborn Team (Malediktus)", GroupType = BossModuleInfo.GroupType.CFC, GroupID = 831, NameID = 12780, SortOrder = 3)]
[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 static readonly uint[] Trash = [(uint)OID.Boss, (uint)OID.Aerostat2];

protected override void DrawEnemies(int pcSlot, Actor pc)
{
Arena.Actor(PrimaryActor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,49 @@ public D040VanguardAerostat2States(BossModule module) : base(module)
.ActivateOnEnter<IncendiaryRing>()
.ActivateOnEnter<Electrobeam>()
.ActivateOnEnter<SpreadShot>()
.Raw.Update = () => module.Enemies(OID.Turret).Concat([module.PrimaryActor]).All(e => e.IsDeadOrDestroyed);
.Raw.Update = () => module.Enemies(D040VanguardAerostat2.Trash).All(e => e.IsDeadOrDestroyed);
}
}

[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "The Combat Reborn Team (Malediktus)", GroupType = BossModuleInfo.GroupType.CFC, GroupID = 831, NameID = 12780, SortOrder = 5)]
[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "The Combat Reborn Team (Malediktus)", GroupType = BossModuleInfo.GroupType.CFC, GroupID = 831, NameID = 12780, SortOrder = 6)]
public class D040VanguardAerostat2(WorldState ws, Actor primary) : BossModule(ws, primary, arena.Center, arena)
{
private static readonly WPos[] vertices = [new(-12.5f, -328.5f), new(12.5f, -328.5f), new(12.637f, -327.677f), new(21.5f, -327.759f),
new(21.649f, -321.3f), new(40.939f, -321.27f), new(41.304f, -327.909f), new(87.469f, -327.561f), new(87.57f, -312.112f), new(41.304f, -312.84f),
new(41.242f, -318.724f), new(21.684f, -318.724f), new(12.648f, -312.733f),
new(12.5f, -311.5f), new(4.283f, -311.468f), new(3.086f, -310.288f),
new(3, -302.5f), new(-3, -302.5f), new(-3.086f, -310.288f), new(-4.283f, -311.468f), new(-12.5f, -311.5f)];
private static readonly WPos[] vertices = [new(92.36f, -331.66f), new(97.65f, -331.36f), new(98.25f, -331.02f), new(100.54f, -328.46f), new(100.83f, -312.14f),
new(100.27f, -312.18f), new(99.64f, -312.33f), new(99.11f, -312.16f), new(98.67f, -311.78f), new(98.42f, -311.24f),
new(98.21f, -310.57f), new(82.13f, -310.57f), new(81.67f, -310.79f), new(81.6f, -311.38f), new(81.21f, -311.9f),
new(80.74f, -312.17f), new(80.08f, -312.17f), new(79.53f, -312.29f), new(78.93f, -312.07f), new(78.59f, -311.63f),
new(78.4f, -311.07f), new(78.28f, -310.57f), new(61.86f, -310.57f), new(61.32f, -311.79f), new(60.88f, -312.17f),
new(59.59f, -312.17f), new(58.99f, -312.1f), new(58.61f, -311.64f), new(58.4f, -311.08f), new(58.34f, -310.57f),
new(41.43f, -310.58f), new(41.2f, -311.05f), new(41.2f, -315.39f), new(40.9f, -315.99f), new(40.9f, -317.96f),
new(40.79f, -318.48f), new(39.81f, -318.6f), new(39.24f, -318.51f), new(39.1f, -317.1f), new(23.75f, -316.9f),
new(23.8f, -317.44f), new(23.77f, -318.05f), new(23.57f, -318.54f), new(23, -318.6f), new(22.34f, -318.6f),
new(21.94f, -318.29f), new(21.94f, -316.14f), new(21.69f, -315.46f), new(21.63f, -311.6f), new(21.17f, -311.4f),
new(4.69f, -311.4f), new(4.19f, -311.15f), new(3.19f, -310.25f), new(3.09f, -302.77f), new(2.53f, -302.42f),
new(2.33f, -301.46f), new(2.08f, -300.8f), new(1.92f, -300.12f), new(1.95f, -299.49f), new(2.25f, -298.26f),
new(2.48f, -297.68f), new(3.09f, -297.47f), new(3.09f, -279.62f), new(2.49f, -279.35f), new(2.32f, -277),
new(2.06f, -276.37f), new(2.05f, -275.85f), new(2.24f, -275.25f), new(2.5f, -274.68f), new(3.1f, -274.58f),
new(3.07f, -267.54f), new(2.97f, -266.92f), new(2.59f, -266.58f), new(1.25f, -266.16f), new(0.75f, -266.1f),
new(-2.76f, -266.38f), new(-3.02f, -267.01f), new(-3.1f, -267.7f), new(-3.07f, -274.25f), new(-2.55f, -274.62f),
new(-2.34f, -277.56f), new(-2.14f, -278.67f), new(-2.46f, -279.28f), new(-3.09f, -279.55f), new(-3.09f, -297.13f),
new(-2.62f, -297.59f), new(-2.34f, -298.03f), new(-2.34f, -300.8f), new(-2.2f, -301.46f), new(-2.28f, -302),
new(-2.62f, -302.4f), new(-3.1f, -309.82f), new(-3.26f, -310.33f), new(-4.26f, -311.24f), new(-12.49f, -311.44f),
new(-12.57f, -311.95f), new(-12.83f, -312.38f), new(-16.87f, -312.43f), new(-17.34f, -312.22f), new(-17.4f, -311.63f),
new(-21.05f, -311.4f), new(-21.8f, -311.5f), new(-21.77f, -328.31f), new(-18.23f, -328.6f), new(-17.53f, -328.56f),
new(-17.39f, -328.07f), new(-13.07f, -327.74f), new(-12.62f, -327.99f), new(-12.35f, -328.6f), new(12.41f, -328.6f),
new(12.58f, -328.12f), new(12.95f, -327.75f), new(16.22f, -327.75f), new(16.89f, -327.67f), new(17.35f, -327.94f),
new(17.54f, -328.59f), new(21.39f, -328.59f), new(21.64f, -327.48f), new(21.29f, -325.37f), new(21.85f, -324.27f),
new(21.94f, -321.8f), new(22.26f, -321.38f), new(23.43f, -321.41f), new(23.76f, -321.79f), new(23.76f, -322.86f),
new(38.79f, -323.09f), new(39.1f, -321.87f), new(39.51f, -321.4f), new(40.13f, -321.39f), new(40.74f, -321.48f),
new(40.91f, -323.92f), new(41.18f, -324.57f), new(41.22f, -329.01f), new(41.52f, -329.43f), new(57.95f, -329.4f),
new(58.39f, -328.86f), new(58.66f, -328.25f), new(59.56f, -327.34f), new(60.07f, -327.28f), new(61.18f, -328.06f),
new(61.52f, -328.58f), new(61.6f, -329.2f), new(77.89f, -329.41f), new(78.4f, -329.07f), new(79.09f, -328.99f),
new(79.64f, -329.19f), new(81.05f, -329.4f), new(81.55f, -329.7f), new(81.51f, -330.3f), new(81.03f, -331),
new(92.36f, -331.66f)];
private static readonly ArenaBoundsComplex arena = new([new PolygonCustom(vertices)]);
public static readonly uint[] Trash = [(uint)OID.Boss, (uint)OID.SentryR7, (uint)OID.SentryS7, (uint)OID.Turret];

protected override void DrawEnemies(int pcSlot, Actor pc)
{
Arena.Actor(PrimaryActor);
Arena.Actors(Enemies(OID.Turret).Concat(Enemies(OID.SentryR7)).Concat(Enemies(OID.SentryS7)));
Arena.Actors(Enemies(Trash));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
namespace BossMod.Dawntrail.Dungeon.D04Vanguard.D040VanguardLeptocyon;

public enum OID : uint
{
Boss = 0x447A, // R2.7
VanguardLeptocyon = 0x41D9, // R2.7
VanguardSentryS7 = 0x41D6, // R0.5
VanguardSentryG7 = 0x4478 // R0.5
}

public enum AID : uint
{
AutoAttack1 = 871, // Boss/VanguardLeptocyon->player, no cast, single-target
AutoAttack2 = 873, // VanguardSentryG7->player, no cast, single-target
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
}

class SpreadShot(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.SpreadShot), new AOEShapeCone(12, 45.Degrees()));

class D040VanguardLeptocyonStates : StateMachineBuilder
{
public D040VanguardLeptocyonStates(BossModule module) : base(module)
{
TrivialPhase()
.ActivateOnEnter<SpreadShot>()
.Raw.Update = () => module.Enemies(D040VanguardLeptocyon.Trash).All(e => e.IsDeadOrDestroyed);
}
}

[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "The Combat Reborn Team (Malediktus)", GroupType = BossModuleInfo.GroupType.CFC, GroupID = 831, NameID = 12778, SortOrder = 1)]
public class D040VanguardLeptocyon(WorldState ws, Actor primary) : BossModule(ws, primary, arena.Center, arena)
{
private static readonly WPos[] vertices = [new(0.34f, 358), new(2.53f, 358.04f), new(2.56f, 358.59f), new(2.29f, 359.02f), new(1.51f, 359.94f),
new(1.27f, 360.52f), new(1.13f, 361.2f), new(0.91f, 361.83f), new(0.65f, 362.44f), new(-0.01f, 363.53f),
new(-0.27f, 364.13f), new(-0.72f, 366.75f), new(-0.67f, 367.41f), new(-0.46f, 368.05f), new(0.12f, 369.18f),
new(0.55f, 370.58f), new(0.75f, 371.56f), new(1.31f, 372.86f), new(1.33f, 373.89f), new(2.03f, 375.98f),
new(2.32f, 376.52f), new(2.8f, 376.71f), new(2.09f, 379.25f), new(2.05f, 379.91f), new(2.77f, 382.59f),
new(3.22f, 383.13f), new(2.65f, 384.65f), new(2.49f, 385.28f), new(2.82f, 385.75f), new(3.05f, 386.44f),
new(2.93f, 388.34f), new(2.65f, 388.77f), new(2.33f, 389.15f), new(1.92f, 389.7f), new(1.85f, 390.36f),
new(1.52f, 390.75f), new(1.23f, 391.38f), new(0.98f, 392.07f), new(0.85f, 392.68f), new(0.77f, 393.34f),
new(0.91f, 394.02f), new(1.23f, 394.59f), new(1.42f, 395.08f), new(0.71f, 395.86f), new(-0.15f, 397.41f),
new(-0.32f, 397.99f), new(0.09f, 398.38f), new(0.59f, 398.74f), new(1.16f, 399.21f), new(0.91f, 399.7f),
new(0.71f, 400.3f), new(0.57f, 401.02f), new(0.23f, 401.58f), new(0.31f, 402.15f), new(0.59f, 402.73f),
new(0.62f, 403.9f), new(1.07f, 404.35f), new(1.52f, 404.88f), new(1.82f, 405.53f), new(1.97f, 406.02f),
new(2.66f, 409.98f), new(2.92f, 410.55f), new(3.25f, 411.1f), new(3.55f, 411.77f), new(3.56f, 412.45f),
new(3.78f, 413.1f), new(4.09f, 414.61f), new(4.42f, 415.07f), new(4.64f, 415.54f), new(4.86f, 416.23f),
new(5.13f, 416.83f), new(4.83f, 426.64f), new(4.89f, 427.23f), new(5.34f, 427.68f), new(5.78f, 428.19f),
new(5.91f, 428.85f), new(6.57f, 430.15f), new(6.95f, 433.61f), new(7.09f, 434.24f), new(7.65f, 434.57f),
new(7.98f, 435.03f), new(7.4f, 435.19f), new(6.66f, 435.25f), new(5.97f, 435.14f), new(5.43f, 435.4f),
new(4.84f, 435.8f), new(4.39f, 435.52f), new(3.75f, 435.3f), new(3.04f, 435.28f), new(2.34f, 435.48f),
new(0.99f, 436.18f), new(0.41f, 436.63f), new(-0.24f, 437.43f), new(-0.49f, 437.95f), new(0.57f, 439.62f),
new(1.02f, 439.92f), new(1.73f, 439.92f), new(1.36f, 440.3f), new(0.96f, 440.89f), new(0.74f, 441.55f),
new(0.65f, 442.2f), new(1.05f, 442.73f), new(1.38f, 443.31f), new(2.29f, 445.73f), new(2.34f, 446.45f),
new(2.95f, 447.49f), new(3.46f, 447.78f), new(4.08f, 447.93f), new(4.54f, 448.17f), new(4.61f, 448.67f),
new(4.53f, 449.36f), new(4.25f, 449.96f), new(3.95f, 450.94f), new(4.06f, 451.57f), new(4.83f, 454.32f),
new(4.78f, 455.57f), new(4.89f, 456.61f), new(5.07f, 457.24f), new(5.63f, 458.58f), new(5.8f, 459.28f),
new(5.47f, 459.73f), new(5.03f, 460), new(4.33f, 460.22f), new(-2.75f, 461.33f), new(-15.27f, 459.98f),
new(-15.83f, 460.33f), new(-16.1f, 459.79f), new(-15.46f, 458.8f), new(-14.76f, 457.1f), new(-14.12f, 454.53f),
new(-14.1f, 451.92f), new(-14.02f, 451.3f), new(-14.76f, 449.49f), new(-14.83f, 448.99f), new(-14.69f, 448.44f),
new(-15.43f, 446.6f), new(-15.48f, 445.93f), new(-14.89f, 444.76f), new(-15, 444.25f), new(-15.49f, 443.05f),
new(-15.77f, 442.5f), new(-16.2f, 442.14f), new(-15.72f, 441.75f), new(-15.2f, 440.5f), new(-15.13f, 439.97f),
new(-16.04f, 438.21f), new(-16.56f, 437.79f), new(-16.72f, 436.45f), new(-16.93f, 435.92f), new(-17.19f, 435.47f),
new(-17.08f, 434.14f), new(-16.22f, 433.15f), new(-16, 432.62f), new(-15.91f, 432.1f), new(-16.38f, 431.68f),
new(-16.95f, 431.31f), new(-17.49f, 431.1f), new(-17.61f, 430.51f), new(-17.54f, 429.88f), new(-17.53f, 429.18f),
new(-17.25f, 428.57f), new(-16.88f, 428.04f), new(-16.55f, 427.49f), new(-16.31f, 426.9f), new(-16.39f, 426.38f),
new(-17.04f, 425.27f), new(-17.83f, 424.17f), new(-17.93f, 423.55f), new(-17.55f, 423.03f), new(-17.31f, 422.5f),
new(-16.93f, 420.69f), new(-16.39f, 419.5f), new(-16, 417.08f), new(-15.99f, 416.46f), new(-16.12f, 415.78f),
new(-15.29f, 414.15f), new(-14.22f, 413.35f), new(-13.94f, 412.76f), new(-13.5f, 412.34f), new(-13.27f, 411.74f),
new(-12.48f, 410.58f), new(-12.62f, 410.01f), new(-13.14f, 409.59f), new(-13.08f, 409.08f), new(-12.41f, 407.79f),
new(-12.36f, 407.23f), new(-12.46f, 406.68f), new(-12.92f, 406.28f), new(-12.91f, 405.57f), new(-12.58f, 404.21f),
new(-11.68f, 402.48f), new(-10.92f, 400.48f), new(-10.78f, 399.1f), new(-10.43f, 398.71f), new(-10.36f, 398.07f),
new(-10.43f, 397.32f), new(-10.59f, 396.66f), new(-10.63f, 397.38f), new(-11.34f, 394.85f), new(-11.69f, 394.22f),
new(-11.79f, 393.15f), new(-11.93f, 392.5f), new(-12.07f, 391.08f), new(-12.19f, 390.46f), new(-12.77f, 389.18f),
new(-13.46f, 389), new(-14.1f, 388.72f), new(-14.31f, 388.07f), new(-14.25f, 387.41f), new(-14.35f, 386.05f),
new(-14.57f, 385.53f), new(-14.92f, 384.93f), new(-15.06f, 384.28f), new(-15.33f, 383.64f), new(-15.7f, 383.14f),
new(-15.9f, 382.67f), new(-15.71f, 382.2f), new(-16.95f, 379.14f), new(-17.26f, 378.69f), new(-17.95f, 377.49f),
new(-17.62f, 377.06f), new(-17.33f, 376.49f), new(-16.53f, 375.37f), new(-16.67f, 374.87f), new(-16.74f, 374.19f),
new(-16.47f, 373.58f), new(-16.09f, 373.02f), new(-15.76f, 372.44f), new(-15.46f, 372.03f), new(-14.92f, 371.64f),
new(-14.49f, 371.12f), new(-14.18f, 370.58f), new(-13.96f, 369.89f), new(-13.05f, 368.19f), new(-12.92f, 367.58f),
new(-12.47f, 367.33f), new(-11.43f, 366.51f), new(-11.03f, 366.02f), new(-9.76f, 363.78f), new(-9.67f, 363.18f),
new(-9.76f, 361.18f), new(-9.84f, 360.58f), new(-10.64f, 358.79f), new(-10.75f, 358), new(0.34f, 358)];
private static readonly ArenaBoundsComplex arena = new([new PolygonCustom(vertices)]);
public static readonly uint[] Trash = [(uint)OID.Boss, (uint)OID.VanguardSentryS7, (uint)OID.VanguardSentryG7, (uint)OID.VanguardLeptocyon];

protected override void DrawEnemies(int pcSlot, Actor pc)
{
Arena.Actors(Enemies(Trash));
}
}
Loading