Skip to content

Commit

Permalink
Core: BlacklistTargetGoal: After detecting a possible blacklisted tar…
Browse files Browse the repository at this point in the history
…get 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 committed Jan 9, 2025
1 parent 594e4f2 commit d6df5cb
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 d6df5cb

Please sign in to comment.