-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace BossMod; | ||
|
||
// Utility for automatically cancelling casts in some conditions (when target dies, when ai wants it, etc). | ||
// Since the game API is sending a packet, this implements some rate limiting. | ||
public sealed class CancelCastTweak(WorldState ws) | ||
{ | ||
private readonly ActionTweaksConfig _config = Service.Config.Get<ActionTweaksConfig>(); | ||
private readonly WorldState _ws = ws; | ||
private DateTime _nextCancelAllowed; | ||
|
||
public bool ShouldCancel(DateTime currentTime, bool force) | ||
{ | ||
if (currentTime < _nextCancelAllowed) | ||
return false; | ||
|
||
var cancel = force || _config.CancelCastOnDeadTarget && (_ws.Actors.Find(_ws.Party.Player()?.CastInfo?.TargetID ?? 0)?.IsDead ?? false); | ||
if (!cancel) | ||
return false; | ||
|
||
_nextCancelAllowed = currentTime.AddSeconds(0.2f); | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters