diff --git a/src/main/java/com/attacktimer/VariableSpeed/DoomOfMokhaiotl.java b/src/main/java/com/attacktimer/VariableSpeed/DoomOfMokhaiotl.java index fafd880..a626302 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/DoomOfMokhaiotl.java +++ b/src/main/java/com/attacktimer/VariableSpeed/DoomOfMokhaiotl.java @@ -51,20 +51,30 @@ public class DoomOfMokhaiotl implements IVariableSpeed .add(13668) // Delve 2 - 5 .add(14180) // Delve 5+ .build(); - // All larvae and the volatile earth work the same: + // All larvae work the same: // - if you attack them with demon bane you get no CD. // - else non demonbane overwrites you're current CD // - you can attack them whilst on CD. - private static final Set COOLDOWN_OVERWRITES_IDS = new ImmutableSet.Builder() + private static final Set LARVAE = new ImmutableSet.Builder() .add(NpcID.DOM_DEMONIC_ENERGY) .add(NpcID.DOM_DEMONIC_ENERGY_GIANT_MAGE) .add(NpcID.DOM_DEMONIC_ENERGY_GIANT_RANGE) .add(NpcID.DOM_DEMONIC_ENERGY_MAGE) .add(NpcID.DOM_DEMONIC_ENERGY_RANGE) .add(NpcID.DOM_DEMONIC_ENERGY_MELEE) + .build(); + // Volatile earth work similar to larvae: + // - you can attack them whilst on CD. + private static final Set VOLATILE_EARTH = new ImmutableSet.Builder() .add(NpcID.DOM_SHOCKWAVE_PATH_NODE) .build(); + // These NPCs can all interrupt normal cooldown setting your current hit delay to some new value even if on cooldown. + private static final Set COOLDOWN_OVERWRITES_IDS = new ImmutableSet.Builder() + .addAll(LARVAE) + .addAll(VOLATILE_EARTH) + .build(); + // There's no actual demonbane stat anywhere in the runelite API so this list has to be hardcoded private static final Set NO_COOLDOWN_WEAPON = new ImmutableSet.Builder() .add(ItemID.SILVERLIGHT) @@ -118,15 +128,18 @@ public boolean onRender(final Client client, final ItemManager itemManager, fina return false; } final int weaponId = Utils.getWeaponId(client); - final boolean isDemonbaneSpell = spellbook == Spellbook.ARCEUUS && AnimationData.isManualCasting(anim) && anim == AnimationData.MAGIC_ARCEUUS_DEMONBANE; - if (NO_COOLDOWN_WEAPON.contains(weaponId) || isDemonbaneSpell) + if (LARVAE.contains(npcId)) { - return false; + if (NO_COOLDOWN_WEAPON.contains(weaponId) || isDemonbaneSpell(anim, spellbook)) + { + return false; + } } - + // Volatile earth or grub with normal weapon if (debugLogs) { - log.debug("DoomOfMokhaiotl success, attacking larvae with normal weapon"); + final var target = LARVAE.contains(npcId) ? "larvae" : "volatile earth"; + log.debug("DoomOfMokhaiotl success, attacking "+target+" with normal weapon"); } larvaeConsumed = tickCount.get(); return true; @@ -177,11 +190,10 @@ public int apply(final Client client, final AnimationData curAnimation, final At { final int targetId = Utils.getTargetId(client); final boolean inDoom = Utils.isInRegionId(client, DOOM_REGION_IDS); - if (inDoom && COOLDOWN_OVERWRITES_IDS.contains(targetId)) + if (inDoom && LARVAE.contains(targetId)) { final int weaponId = Utils.getWeaponId(client); - final boolean isDemonbaneSpell = spellbook == Spellbook.ARCEUUS && AnimationData.isManualCasting(curAnimation) && curAnimation == AnimationData.MAGIC_ARCEUUS_DEMONBANE; - if (NO_COOLDOWN_WEAPON.contains(weaponId) || isDemonbaneSpell) + if (NO_COOLDOWN_WEAPON.contains(weaponId) || isDemonbaneSpell(curAnimation, spellbook)) { log.debug("DoomOfMokhaiotl success, zero delay grub"); return 1; @@ -189,4 +201,11 @@ public int apply(final Client client, final AnimationData curAnimation, final At } return curSpeed; } + + private boolean isDemonbaneSpell(final AnimationData curAnimation, final Spellbook spellbook) + { + return spellbook == Spellbook.ARCEUUS && + AnimationData.isManualCasting(curAnimation) && + curAnimation == AnimationData.MAGIC_ARCEUUS_DEMONBANE; + } }