Skip to content

Commit

Permalink
Removed weird dependency from actor to aihints.
Browse files Browse the repository at this point in the history
  • Loading branch information
awgil committed Jan 26, 2025
1 parent 5d27986 commit cde4c70
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 2 additions & 4 deletions BossMod/Autorotation/RotationModule.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static BossMod.AIHints;

namespace BossMod.Autorotation;
namespace BossMod.Autorotation;

public enum RotationModuleQuality
{
Expand Down Expand Up @@ -121,7 +119,7 @@ public bool TraitUnlocked(uint id)
return status != null ? (StatusDuration(status.Value.ExpireAt), status.Value.Extra & 0xFF) : (0, 0);
}
protected (float Left, int Stacks) StatusDetails<SID>(Actor? actor, SID sid, ulong sourceID, float pendingDuration = 1000) where SID : Enum => StatusDetails(actor, (uint)(object)sid, sourceID, pendingDuration);
protected (float Left, int Stacks) StatusDetails<SID>(Enemy? enemy, SID sid, ulong sourceID, float pendingDuration = 1000) where SID : Enum => StatusDetails(enemy?.Actor, (uint)(object)sid, sourceID, pendingDuration);
protected (float Left, int Stacks) StatusDetails<SID>(AIHints.Enemy? enemy, SID sid, ulong sourceID, float pendingDuration = 1000) where SID : Enum => StatusDetails(enemy?.Actor, (uint)(object)sid, sourceID, pendingDuration);
protected (float Left, int Stacks) SelfStatusDetails(uint sid, float pendingDuration = 1000) => StatusDetails(Player, sid, Player.InstanceID, pendingDuration);
protected (float Left, int Stacks) SelfStatusDetails<SID>(SID sid, float pendingDuration = 1000) where SID : Enum => StatusDetails(Player, sid, Player.InstanceID, pendingDuration);

Expand Down
3 changes: 2 additions & 1 deletion BossMod/Autorotation/xan/Basexan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ private void EstimateCastTime()
{
MaxCastTime = Hints.MaxCastTimeEstimate;

if (Player.PendingKnockbacks.Count > 0)
if (Player.PendingKnockbacks > 0)
{
MaxCastTime = 0f;
return;
Expand Down Expand Up @@ -522,4 +522,5 @@ public static RotationModuleDefinition.ConfigRef<OffensiveStrategy> DefineSimple
public static OffensiveStrategy Simple<Index>(this StrategyValues strategy, Index track) where Index : Enum => strategy.Option(track).As<OffensiveStrategy>();
public static bool BuffsOk(this StrategyValues strategy) => strategy.Option(SharedTrack.Buffs).As<OffensiveStrategy>() != OffensiveStrategy.Delay;
public static bool AOEOk(this StrategyValues strategy) => strategy.AOE() is AOEStrategy.AOE or AOEStrategy.ForceAOE;
public static float DistanceToHitbox(this Actor actor, Enemy? other) => actor.DistanceToHitbox(other?.Actor);
}
5 changes: 1 addition & 4 deletions BossMod/Data/Actor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static BossMod.AIHints;

namespace BossMod;
namespace BossMod;

// objkind << 8 + objsubkind
public enum ActorType : ushort
Expand Down Expand Up @@ -168,7 +166,6 @@ public sealed class Actor(ulong instanceID, uint oid, int spawnIndex, string nam
public Angle AngleTo(Actor other) => Angle.FromDirection(other.Position - Position);

public float DistanceToHitbox(Actor? other) => other == null ? float.MaxValue : (other.Position - Position).Length() - other.HitboxRadius - HitboxRadius;
public float DistanceToHitbox(Enemy? other) => DistanceToHitbox(other?.Actor);

public override string ToString() => $"{OID:X} '{Name}' <{InstanceID:X}>";
}

0 comments on commit cde4c70

Please sign in to comment.