Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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. #654

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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