Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
revert HitSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-mc committed Jun 10, 2024
1 parent ffc59db commit b015aaf
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@

public class HitSelect extends Module {
private static long attackTime = -1;
private final SliderSetting delay;
private final SliderSetting chance;
private static boolean currentShouldAttack = false;

public HitSelect() {
super("HitSelect", category.combat);
this.registerSetting(new DescriptionSetting("chooses the best time to hit."));
this.registerSetting(delay = new SliderSetting("Delay", 420, 200, 750, 1));
this.registerSetting(chance = new SliderSetting("Chance", 80, 0, 100, 1));
}

Expand All @@ -29,7 +31,7 @@ public void onAttack(@NotNull AttackEntityEvent event) {

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPreUpdate(PreUpdateEvent event) {
currentShouldAttack = Math.random() > hitSelect.chance.getInput() || System.currentTimeMillis() - HitSelect.attackTime >= 400;
currentShouldAttack = Math.random() > hitSelect.chance.getInput() || System.currentTimeMillis() - HitSelect.attackTime >= hitSelect.delay.getInput();
}

public static boolean canAttack() {
Expand Down

0 comments on commit b015aaf

Please sign in to comment.