Skip to content

Commit

Permalink
Merge branch 'awgil:master' into lab
Browse files Browse the repository at this point in the history
  • Loading branch information
Akechi-kun authored Feb 5, 2025
2 parents 181eb12 + e2c915c commit baf0901
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions BossMod/Modules/Dawntrail/Ultimate/FRU/FRUConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ public class FRUConfig() : ConfigNode()
[GroupPreset("Default", [0, 2, 5, 3, 4, 6, 7, 1])]
public GroupAssignmentUnique P2IntermissionClockSpots = new() { Assignments = [0, 2, 5, 3, 4, 6, 7, 1] };

[PropertyDisplay("P3 Apocalypse: dark water 1 direction for group 1 (group 2 is opposite)", tooltip: "Only used by AI")]
[PropertySlider(-180, 180)]
public float P3ApocalypseDarkWater1ReferenceDirection = -90;

[PropertyDisplay("P3 Darkest Dance: baiter", tooltip: "Only used by AI")]
[PropertyCombo("MT", "OT")]
public bool P3DarkestDanceOTBait;
Expand Down
4 changes: 2 additions & 2 deletions BossMod/Modules/Dawntrail/Ultimate/FRU/P2DiamondDust.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignme
{
// if we're behind boss, slide over to the safe point as opposite to the boss as possible
var farthestDir = Angle.FromDirection(-sourceOffset);
var bestRange = zoneList.Allowed(1.Degrees()).MinBy(r => farthestDir.Rad < r.min.Rad ? r.min.Rad - farthestDir.Rad : farthestDir.Rad > r.max.Rad ? farthestDir.Rad - r.max.Rad : 0);
var dir = farthestDir.Rad < bestRange.min.Rad ? bestRange.min : farthestDir.Rad > bestRange.max.Rad ? bestRange.max : farthestDir;
var bestRange = zoneList.Allowed(1.Degrees()).MinBy(r => farthestDir.DistanceToRange(r.min, r.max).Abs().Rad);
var dir = farthestDir.ClosestInRange(bestRange.min, bestRange.max);
hints.AddForbiddenZone(ShapeDistance.InvertedCircle(actor.Position + SlideDistance * dir.ToDirection(), 1), DateTime.MaxValue);
}
else
Expand Down
5 changes: 4 additions & 1 deletion BossMod/Modules/Dawntrail/Ultimate/FRU/P3Apocalypse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ public override void OnEventCast(Actor caster, ActorCastEvent spell)
// position for first dark water - note that this is somewhat arbitrary (range etc)
class P3ApocalypseAIWater1(BossModule module) : BossComponent(module)
{
private readonly FRUConfig _config = Service.Config.Get<FRUConfig>();
private readonly P3ApocalypseDarkWater? _water = module.FindComponent<P3ApocalypseDarkWater>();

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
Expand All @@ -409,7 +410,9 @@ public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignme
3 => (10.Degrees(), 8),
_ => (default, 0)
};
dir += (state.AssignedGroup == 1 ? -90 : 90).Degrees();
dir += _config.P3ApocalypseDarkWater1ReferenceDirection.Degrees();
if (state.AssignedGroup == 2)
dir += 180.Degrees();
hints.AddForbiddenZone(ShapeDistance.InvertedCircle(Module.Center + range * dir.ToDirection(), 1), _water.Stacks.Count > 0 ? _water.Stacks[0].Activation : DateTime.MaxValue);
}
}
Expand Down
8 changes: 8 additions & 0 deletions BossMod/Util/Angle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ public readonly Angle DistanceToRange(Angle min, Angle max)
return midDist.Rad > width.Rad ? midDist - width : midDist.Rad < -width.Rad ? midDist + width : default;
}

// closest direction in range to this angle
public readonly Angle ClosestInRange(Angle min, Angle max)
{
var width = (max - min) * 0.5f;
var midDist = DistanceToAngle((min + max) * 0.5f);
return midDist.Rad > width.Rad ? min : midDist.Rad < -width.Rad ? max : this;
}

public override readonly string ToString() => Deg.ToString("f0");
}

Expand Down

0 comments on commit baf0901

Please sign in to comment.