Skip to content

Commit

Permalink
Merge pull request #654 from Xian55/fix/after-blacklist-detected-wait…
Browse files Browse the repository at this point in the history
…-for-update

Fix: Core: BlacklistTargetGoal: After detecting a possible blacklisted target and pressing the clear target button be sure to wait one update so other Goals would not attempt to go with former state of the game.
  • Loading branch information
Xian55 authored Jan 9, 2025
2 parents 594e4f2 + d6df5cb commit 92e45b6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions Core/AddonComponent/AddonBits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public void Update(IAddonDataProvider reader)

public bool Grounded() => !Flying() && !Falling();

public bool Any_AutoAttack() => AutoShot() || Auto_Attack() || Shoot();

// -- value3 based flags
public bool SoftInteract() => v3[Mask._0];
Expand Down
10 changes: 7 additions & 3 deletions Core/Goals/BlacklistTargetGoal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ public sealed class BlacklistTargetGoal : GoapGoal
private readonly PlayerReader playerReader;
private readonly AddonBits bits;
private readonly ConfigurableInput input;
private readonly Wait wait;
private readonly IBlacklist targetBlacklist;

public BlacklistTargetGoal(PlayerReader playerReader,
AddonBits bits,
ConfigurableInput input, IBlacklist blacklist)
ConfigurableInput input, IBlacklist blacklist, Wait wait)
: base(nameof(BlacklistTargetGoal))
{
this.playerReader = playerReader;
this.bits = bits;
this.input = input;
this.targetBlacklist = blacklist;
this.bits = bits;
this.wait = wait;
}

public override bool CanRun()
Expand All @@ -30,10 +32,12 @@ public override void OnEnter()
{
if (playerReader.PetTarget() ||
playerReader.IsCasting() ||
bits.Auto_Attack() || bits.AutoShot() ||
bits.Shoot())
bits.Any_AutoAttack())
{
input.PressStopAttack();
}

input.PressClearTarget();
wait.Update();
}
}
4 changes: 1 addition & 3 deletions Core/Goals/PullTargetGoal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ public override void Update()
}
else if (PullPrevention() &&
(playerReader.IsCasting() ||
bits.Auto_Attack() ||
bits.AutoShot() ||
bits.Shoot()))
bits.Any_AutoAttack()))
{
Log("Preventing pulling possible tagged target!");
input.PressStopAttack();
Expand Down
5 changes: 1 addition & 4 deletions Core/GoalsComponent/ReactCastError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ static void MinRangeChanges(int duration, Wait wait,
break;
case UI_ERROR.ERR_BADATTACKFACING:

bool wasAnyAuto =
bits.AutoShot() ||
bits.Auto_Attack() ||
bits.Shoot();
bool wasAnyAuto = bits.Any_AutoAttack();

float beforeDir = playerReader.Direction;

Expand Down

0 comments on commit 92e45b6

Please sign in to comment.