From 35c3a4e4e1db1811043173b82c7913964cb9c9e6 Mon Sep 17 00:00:00 2001 From: Dani Date: Sun, 1 Sep 2024 13:51:14 +0200 Subject: [PATCH] feat: AutoBestAbility added all the abilities --- .../bestability/AutoBestAbility.java | 28 +++++---- .../bestability/BestAbilityConfig.java | 5 +- .../bestability/SupportedAbilities.java | 61 ------------------- 3 files changed, 19 insertions(+), 75 deletions(-) delete mode 100644 src/main/java/com/deeme/behaviours/bestability/SupportedAbilities.java diff --git a/src/main/java/com/deeme/behaviours/bestability/AutoBestAbility.java b/src/main/java/com/deeme/behaviours/bestability/AutoBestAbility.java index 6c4ff3de..1c49de7e 100644 --- a/src/main/java/com/deeme/behaviours/bestability/AutoBestAbility.java +++ b/src/main/java/com/deeme/behaviours/bestability/AutoBestAbility.java @@ -51,7 +51,8 @@ public class AutoBestAbility implements Behavior, Configurable allNPCs; private final ConditionsManagement conditionsManagement; - private final List DAMAGE_ABILITIES = Arrays.asList(Ability.SPEARHEAD_TARGET_MARKER, Ability.DIMINISHER, + private static final List DAMAGE_ABILITIES = Arrays.asList(Ability.SPEARHEAD_TARGET_MARKER, + Ability.DIMINISHER, Ability.GOLIATH_X_FROZEN_CLAW, Ability.VENOM, Ability.TARTARUS_RAPID_FIRE, Ability.DISRUPTOR_SHIELD_DISARRAY, Ability.HECATE_PARTICLE_BEAM, Ability.KERES_SPR, Ability.ZEPHYR_TBR, Ability.HOLO_ENEMY_REVERSAL, Ability.TARTARUS_PLUS_RAPID_FIRE, @@ -59,36 +60,37 @@ public class AutoBestAbility implements Behavior, Configurable DAMAGE_RANGE_ABILITIES = Arrays.asList(Ability.SOLARIS_INC, + private static final List DAMAGE_RANGE_ABILITIES = Arrays.asList(Ability.SOLARIS_INC, Ability.SOLARIS_PLUS_INCINERATE_PLUS, Ability.BASILISK_NOXIOUS_NEBULA, Ability.TEMPEST_VOLTAGE_LINK); - private final List SPEED_ABILITIES = Arrays.asList(Ability.CITADEL_TRAVEL, Ability.LIGHTNING, + private static final List SPEED_ABILITIES = Arrays.asList(Ability.CITADEL_TRAVEL, Ability.LIGHTNING, Ability.KERES_SLE, Ability.MIMESIS_PHASE_OUT, Ability.ZEPHYR_MMT, Ability.PUSAT_PLUS_SPEED_SAP, Ability.RETIARUS_SPC); - private final List HEALTH_ABILITIES_WITHOUT_LOCK = Arrays.asList(Ability.AEGIS_REPAIR_POD, + private static final List HEALTH_ABILITIES_WITHOUT_LOCK = Arrays.asList(Ability.AEGIS_REPAIR_POD, Ability.LIBERATOR_PLUS_SELF_REPAIR, Ability.SOLACE, Ability.SOLACE_PLUS_NANO_CLUSTER_REPAIRER_PLUS); - private final List HEALTH_ABILITIES_WITH_LOCK = Arrays.asList(Ability.AEGIS_HP_REPAIR, + private static final List HEALTH_ABILITIES_WITH_LOCK = Arrays.asList(Ability.AEGIS_HP_REPAIR, Ability.HAMMERCLAW_PLUS_REALLOCATE); - private final List EVADE_ABILITIES = Arrays.asList(Ability.SPEARHEAD_JAM_X, + private static final List EVADE_ABILITIES = Arrays.asList(Ability.SPEARHEAD_JAM_X, Ability.SPEARHEAD_ULTIMATE_CLOAK, Ability.BERSERKER_RVG, Ability.MIMESIS_SCRAMBLE, - Ability.DISRUPTOR_DDOL, Ability.SPEARHEAD_PLUS_NEUTRALIZING_MARKER); + Ability.DISRUPTOR_DDOL, Ability.SPEARHEAD_PLUS_NEUTRALIZING_MARKER, Ability.ADMIN_ULTIMATE_CLOAKING); - private final List EVADE_LAST_INSTANCE_ABILITIES = Arrays.asList(Ability.CITADEL_PLUS_PRISMATIC_ENDURANCE, + private static final List EVADE_LAST_INSTANCE_ABILITIES = Arrays.asList( + Ability.CITADEL_PLUS_PRISMATIC_ENDURANCE, Ability.CITADEL_FORTIFY, Ability.DISRUPTOR_REDIRECT, Ability.SPECTRUM, Ability.SPECTRUM_PLUS_PRISMATIC_REFLECTING, Ability.SENTINEL, Ability.BERSERKER_BSK); - private final List ALL_TIME_ABILITIES = Arrays.asList(Ability.SPEARHEAD_DOUBLE_MINIMAP); + private static final List ALL_TIME_ABILITIES = Arrays.asList(Ability.SPEARHEAD_DOUBLE_MINIMAP); - private final List TARTARUS_SPEED_ABILITIES = Arrays.asList(Ability.TARTARUS_SPEED_BOOST, + private static final List TARTARUS_SPEED_ABILITIES = Arrays.asList(Ability.TARTARUS_SPEED_BOOST, Ability.TARTARUS_PLUS_SPEED_BOOST); private long nextCheck = 0; - private final int ABILITY_DISTANCE = 650; + private static final int ABILITY_DISTANCE = 650; public AutoBestAbility(PluginAPI api) { this(api, api.requireAPI(AuthAPI.class), @@ -200,6 +202,8 @@ private Optional getTankAbility() { return Optional.of(Ability.CITADEL_DRAW_FIRE); } else if (isAvailable(Ability.CITADEL_PROTECTION)) { return Optional.of(Ability.CITADEL_PROTECTION); + } else if (isAvailable(Ability.BERSERKER_SHL)) { + return Optional.of(Ability.BERSERKER_SHL); } } @@ -340,7 +344,7 @@ private boolean shouldFocusHealth(boolean needLock) { } else if (this.heroapi.getHealth().hpPercent() <= this.config.minHealthToUseHealth) { return true; } else if (this.group.hasGroup()) { - return this.group.getMembers().stream().anyMatch((member) -> !member.isDead() && member.isAttacked() + return this.group.getMembers().stream().anyMatch(member -> !member.isDead() && member.isAttacked() && member.getMemberInfo().hpPercent() <= this.config.minHealthToUseHealth && (!needLock || (member.isLocked() && this.heroapi.distanceTo(member.getLocation()) < ABILITY_DISTANCE))); diff --git a/src/main/java/com/deeme/behaviours/bestability/BestAbilityConfig.java b/src/main/java/com/deeme/behaviours/bestability/BestAbilityConfig.java index 8535e4f5..98c0e3f5 100644 --- a/src/main/java/com/deeme/behaviours/bestability/BestAbilityConfig.java +++ b/src/main/java/com/deeme/behaviours/bestability/BestAbilityConfig.java @@ -8,6 +8,7 @@ import eu.darkbot.api.config.annotations.Option; import eu.darkbot.api.config.annotations.Number; import eu.darkbot.api.config.annotations.Percentage; +import eu.darkbot.api.game.items.SelectableItem.Ability; @Configuration("best_ability") public class BestAbilityConfig { @@ -28,11 +29,11 @@ public class BestAbilityConfig { @Option("best_ability.supported_abilities") @Dropdown(multi = true) - public Set supportedAbilities = EnumSet.allOf(SupportedAbilities.class); + public Set supportedAbilities = EnumSet.allOf(Ability.class); @Option("best_ability.abilities_to_use_everytime") @Dropdown(multi = true) - public Set abilitiesToUseEverytime = EnumSet.noneOf(SupportedAbilities.class); + public Set abilitiesToUseEverytime = EnumSet.noneOf(Ability.class); @Option("general.tick_stopped") public boolean tickStopped = false; diff --git a/src/main/java/com/deeme/behaviours/bestability/SupportedAbilities.java b/src/main/java/com/deeme/behaviours/bestability/SupportedAbilities.java deleted file mode 100644 index 58c53946..00000000 --- a/src/main/java/com/deeme/behaviours/bestability/SupportedAbilities.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.deeme.behaviours.bestability; - -import eu.darkbot.api.config.annotations.Configuration; - -@Configuration("supported_abilities") -public enum SupportedAbilities { - AEGIS_HP_REPAIR, - AEGIS_SHIELD_REPAIR, - AEGIS_REPAIR_POD, - BASILISK_NOXIOUS_NEBULA, - BASILISK_HEIGHTENED_VALOUR, - BERSERKER_BSK, - BERSERKER_RVG, - CITADEL_DRAW_FIRE, - CITADEL_TRAVEL, - CITADEL_PROTECTION, - CITADEL_FORTIFY, - CITADEL_PLUS_PRISMATIC_ENDURANCE, - DIMINISHER, - DISRUPTOR_DDOL, - DISRUPTOR_SHIELD_DISARRAY, - DISRUPTOR_REDIRECT, - GOLIATH_X_FROZEN_CLAW, - HAMMERCLAW_PLUS_REALLOCATE, - HECATE_PARTICLE_BEAM, - HECATE_PLUS_PARTICLE_BEAM_PLUS, - HOLO_ENEMY_REVERSAL, - KERES_SPR, - KERES_SLE, - LIBERATOR_PLUS_SELF_REPAIR, - LIGHTNING, - MIMESIS_PHASE_OUT, - MIMESIS_SCRAMBLE, - ORCUS_ASSIMILATE, - PUSAT_PLUS_SPEED_SAP, - RETIARUS_SPC, - RETIARUS_CHS, - SENTINEL, - SOLACE, - SOLACE_PLUS_NANO_CLUSTER_REPAIRER_PLUS, - SOLARIS_INC, - SOLARIS_PLUS_INCINERATE_PLUS, - SPEARHEAD_DOUBLE_MINIMAP, - SPEARHEAD_JAM_X, - SPEARHEAD_TARGET_MARKER, - SPEARHEAD_ULTIMATE_CLOAK, - SPEARHEAD_PLUS_JAMX_CREED, - SPEARHEAD_PLUS_NEUTRALIZING_MARKER, - SPECTRUM, - SPECTRUM_PLUS_PRISMATIC_REFLECTING, - TARTARUS_PLUS_RAPID_FIRE, - TARTARUS_PLUS_SPEED_BOOST, - TARTARUS_RAPID_FIRE, - TARTARUS_SPEED_BOOST, - TEMPEST_VOLTAGE_LINK, - TEMPEST_VOLT_DISCHARGE, - TEMPEST_VOLT_BACKUP, - VENOM, - ZEPHYR_MMT, - ZEPHYR_TBR; -} \ No newline at end of file