diff --git a/README.md b/README.md index 06accee..08ffcc5 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,13 @@ Ticks until next attack may be enabled over your player's head. ## Updates -## 1.3.5 - 1.3.7 +## 1.3.5 - 1.3.8 * Support for The Fractured Archive weapons * Obligator (3 tick, 5 tick thrust) * Ascension crossbows (2 tick on rapid) * Zorya's tome (3 tick). A landed special attack makes the next 3 attacks 2 tick, or the next 5 if two specials in a row land + * Buffed attacks expiry after 30 seconds or if the player teleports. * Fix the timer not showing with weapons from new weapon categories (e.g. Zorya's tome) * Fixes for Doom and Volatile earth with demonbane weapons setting cooldown to 1 incorrectly * Support more than one overlay layer for the attack bar (see [#202](https://github.com/ngraves95/attacktimer/issues/202)) diff --git a/runelite-plugin.properties b/runelite-plugin.properties index d5ab36a..fa54d52 100644 --- a/runelite-plugin.properties +++ b/runelite-plugin.properties @@ -1,7 +1,7 @@ displayName=AttackTimer author=ngraves95,Lexer747 build=standard -version=1.3.7 +version=1.3.8 description=A plugin to countdown until your next attack tags=pvm,timer,attack,combat,weapon plugins=com.attacktimer.AttackTimerMetronomePlugin \ No newline at end of file diff --git a/src/main/java/com/attacktimer/AttackSpeed.java b/src/main/java/com/attacktimer/AttackSpeed.java index 29f514b..2167b00 100644 --- a/src/main/java/com/attacktimer/AttackSpeed.java +++ b/src/main/java/com/attacktimer/AttackSpeed.java @@ -55,6 +55,7 @@ public class AttackSpeed } private ArrayDeque specialPercentageEvents = new ArrayDeque(); + private int specChangedTick = -1; private final Damage damage = new Damage(); @Getter private int dmgDealt = -1; @@ -94,7 +95,7 @@ public int compute(final Client client, final AnimationData curAnimation, final // We are currently dealing with a staves in which case we can make decisions based on the // spellbook flag. We can only improve this by using a deprecated API to check the projectile // matches the stave rather than a manual spell, but this is good enough for now. - return VariableSpeed.compute(client, curAnimation, AttackProcedure.POWERED_STAVE, spellbook, dmgDealt, specDelta, 4); + return VariableSpeed.compute(client, curAnimation, AttackProcedure.POWERED_STAVE, spellbook, dmgDealt, specDelta, specChangedTick, 4); } if (matchesSpellbook(client, curAnimation, spellbook) @@ -102,7 +103,7 @@ public int compute(final Client client, final AnimationData curAnimation, final { isUsingMagic = true; // You can cast with anything equipped in which case we shouldn't look to invent for speed. - return VariableSpeed.compute(client, curAnimation, AttackProcedure.MANUAL_AUTO_CAST, spellbook, dmgDealt, specDelta, getMagicBaseSpeed(weaponId)); + return VariableSpeed.compute(client, curAnimation, AttackProcedure.MANUAL_AUTO_CAST, spellbook, dmgDealt, specDelta, specChangedTick, getMagicBaseSpeed(weaponId)); } isUsingMagic = false; @@ -112,12 +113,12 @@ public int compute(final Client client, final AnimationData curAnimation, final // For now we assume the only sailing specific weapon is // https://oldschool.runescape.wiki/w/Cannon_(facility) if they add other facilities which can // "attack" that assumption obviously needs re-visiting. The cannons currently are all 7-tick. - return VariableSpeed.compute(client, curAnimation, AttackProcedure.MELEE_OR_RANGE, spellbook, dmgDealt, specDelta, 7); + return VariableSpeed.compute(client, curAnimation, AttackProcedure.MELEE_OR_RANGE, spellbook, dmgDealt, specDelta, specChangedTick, 7); } final int aspeed = Utils.getWeaponSpeed(client, itemManager, weaponId); // Deadline for next available attack. - return VariableSpeed.compute(client, curAnimation, AttackProcedure.MELEE_OR_RANGE, spellbook, dmgDealt, specDelta, aspeed); + return VariableSpeed.compute(client, curAnimation, AttackProcedure.MELEE_OR_RANGE, spellbook, dmgDealt, specDelta, specChangedTick, aspeed); } public void onTick() @@ -132,6 +133,7 @@ public void onTick() public void varbitSpecialAttackChanged(final int value) { specialPercentageEvents.addLast(value); + specChangedTick = tickCount.get(); } public boolean onXpDrop(final FakeXpDrop event) @@ -197,6 +199,7 @@ public void reset() soundEffectTick = -1; isUsingMagic = false; specialPercentageEvents.clear(); + specChangedTick = -1; damage.reset(); } } diff --git a/src/main/java/com/attacktimer/AttackTimerMetronomeConfig.java b/src/main/java/com/attacktimer/AttackTimerMetronomeConfig.java index bed5e05..3eeb6b4 100644 --- a/src/main/java/com/attacktimer/AttackTimerMetronomeConfig.java +++ b/src/main/java/com/attacktimer/AttackTimerMetronomeConfig.java @@ -324,7 +324,7 @@ default boolean debugLogs() @ConfigItem( position = 10000, keyName = "attacktimerVersion", - name = "Plugin version: v1.3.7", + name = "Plugin version: v1.3.8", description = "" ) default void version() diff --git a/src/main/java/com/attacktimer/VariableSpeed/Amoxliatl.java b/src/main/java/com/attacktimer/VariableSpeed/Amoxliatl.java index eaead2c..aa6aca4 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/Amoxliatl.java +++ b/src/main/java/com/attacktimer/VariableSpeed/Amoxliatl.java @@ -45,8 +45,8 @@ public class Amoxliatl implements IVariableSpeed private static final int AMOXLIATL_REGION_ID = 5446; public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed, - final int curSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, + final int baseSpeed, final int curSpeed) { final WorldPoint location = Utils.getLocalLocation(client); final int targetId = Utils.getTargetId(client); diff --git a/src/main/java/com/attacktimer/VariableSpeed/BloodMoonSet.java b/src/main/java/com/attacktimer/VariableSpeed/BloodMoonSet.java index 91d43c2..687a2d7 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/BloodMoonSet.java +++ b/src/main/java/com/attacktimer/VariableSpeed/BloodMoonSet.java @@ -34,8 +34,8 @@ public class BloodMoonSet implements IVariableSpeed { public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed, - final int curSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, + final int baseSpeed, final int curSpeed) { if (client.getLocalPlayer().hasSpotAnim(SpotanimID.SPECIAL_DUAL_MACUAHUITL_SPOTANIM)) { diff --git a/src/main/java/com/attacktimer/VariableSpeed/DoomOfMokhaiotl.java b/src/main/java/com/attacktimer/VariableSpeed/DoomOfMokhaiotl.java index a626302..2ac666a 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/DoomOfMokhaiotl.java +++ b/src/main/java/com/attacktimer/VariableSpeed/DoomOfMokhaiotl.java @@ -185,8 +185,8 @@ else if (npcId == NpcID.DOM_BOSS) // Take care here to ensure no infinite loop or affect on the speed as the onRender does call this via variable speed public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed, - final int curSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, + final int baseSpeed, final int curSpeed) { final int targetId = Utils.getTargetId(client); final boolean inDoom = Utils.isInRegionId(client, DOOM_REGION_IDS); diff --git a/src/main/java/com/attacktimer/VariableSpeed/EyeOfAyak.java b/src/main/java/com/attacktimer/VariableSpeed/EyeOfAyak.java index 13ee161..3da81af 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/EyeOfAyak.java +++ b/src/main/java/com/attacktimer/VariableSpeed/EyeOfAyak.java @@ -33,8 +33,8 @@ public class EyeOfAyak implements IVariableSpeed { public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed, - final int curSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, + final int baseSpeed, final int curSpeed) { // https://oldschool.runescape.wiki/w/Eye_of_ayak#Charged // https://oldschool.runescape.wiki/w/Eye_of_ayak#Special_attack diff --git a/src/main/java/com/attacktimer/VariableSpeed/FracturedArchive.java b/src/main/java/com/attacktimer/VariableSpeed/FracturedArchive.java index 0e80f25..bb40844 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/FracturedArchive.java +++ b/src/main/java/com/attacktimer/VariableSpeed/FracturedArchive.java @@ -31,6 +31,7 @@ import com.attacktimer.Attacking.Attacking; import com.attacktimer.ClientUtils.Utils; import com.attacktimer.Spellbook; +import com.attacktimer.VariableSpeed.State.Teleported; import com.attacktimer.VariableSpeed.State.TickCount; import net.runelite.api.Actor; import net.runelite.api.Client; @@ -45,8 +46,16 @@ public class FracturedArchive implements IVariableSpeed { private static final int ZORYA_FAST_ATTACKS = 3; + // The buff only last for 30 seconds after landing (30 * 0.6 = 50) + private static final int ZORYA_TIMEOUT_TICKS = 50; private final TickCount tickCount; + // Tome attacks expire when the player teleports so use the tracker + private final Teleported tp; + + // In order to track if the buff has timed out store when the spec lands (or is refreshed). + private int zoryaSpecTick = -1; + // Buffed (2t) Zorya's tome attacks left after the current attack. private int zoryaFastAttacksRemaining = 0; // The speed can be computed more than once for the same attack (again when the xp drop arrives), so the @@ -54,23 +63,26 @@ public class FracturedArchive implements IVariableSpeed private int zoryaAttackTick = -1; private int zoryaFastAttacksBeforeAttack = 0; - FracturedArchive(final TickCount tc) + FracturedArchive(final TickCount tc, final Teleported tp) { this.tickCount = tc; + this.tp = tp; } public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed, - final int curSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, + final int baseSpeed, final int curSpeed) { - if (curAnimation == null) - { - return curSpeed; - } + // There is a specific edge case with the tome if you attack on the tick that the death charge (other + // spells may also trigger this) animation ends, you end on a null animation and the attack for the + // tome only has spot anim. Therefore to ensure that the later switch statements can fall into the + // `default` cases, we set some arbitrary animation here. With java21 we could do this a bit nicer + // with `case null ->` alas. + final var safeCurAnimation = curAnimation == null ? AnimationData.MAGIC_WARPED_SCEPTRE : curAnimation; final int weaponId = Utils.getWeaponId(client); if (isObligator(weaponId)) { - switch (curAnimation) + switch (safeCurAnimation) { case MELEE_OBLIGATOR: case MELEE_OBLIGATOR_FEMALE: @@ -95,7 +107,7 @@ public int apply(final Client client, final AnimationData curAnimation, final At else if (isZoryasTome(weaponId)) { final boolean hit = successfulHit(client, damageDealt); - switch (curAnimation) + switch (safeCurAnimation) { case MAGIC_ZORYA_TOME_SPEC: case MAGIC_ZORYA_TOME_SPEC_FEMALE: @@ -107,7 +119,9 @@ else if (isZoryasTome(weaponId)) // A player may be attacking but also summoning a thrall, (or some other way to hide the // animation) in which case we should infer speed/spec from delta final Player localPlayer = client.getLocalPlayer(); - final boolean specAndHit = hit && (lastSpecDelta == -500 || Attacking.getZoryaSpecAttack(localPlayer)); + // Ensure the delta was within a tick, otherwise consecutive attacks all look like specs. + final boolean fromDelta = lastSpecDelta == -500 && tickCount.isWithinNTicks(specChangedTick, 1); + final boolean specAndHit = hit && (fromDelta || Attacking.getZoryaSpecAttack(localPlayer)); return zoryaAttackSpeed(specAndHit); // Since we know the weapon ID we should always use `zoryaAttackSpeed` to track fast attacks // accurately @@ -138,16 +152,25 @@ private int zoryaAttackSpeed(final boolean isSpecAndHit) zoryaAttackTick = tick; zoryaFastAttacksBeforeAttack = zoryaFastAttacksRemaining; } + if (specExpired(tick)) + { + zoryaFastAttacksRemaining = 0; + zoryaFastAttacksBeforeAttack = 0; + zoryaSpecTick = -1; + } int remaining = zoryaFastAttacksBeforeAttack; int speed = 3; if (remaining > 0) { remaining--; speed = 2; + // the 30 second window is refreshed each time it's used + zoryaSpecTick = tick; } if (isSpecAndHit) { remaining += ZORYA_FAST_ATTACKS; + zoryaSpecTick = tick; // note when the spec happened to time it out properly } zoryaFastAttacksRemaining = remaining; return speed; @@ -168,4 +191,10 @@ private boolean successfulHit(final Client client, final int damageDealt) } return false; } + + private boolean specExpired(final int tick) + { + final int end = zoryaSpecTick + ZORYA_TIMEOUT_TICKS; + return tick > end || tp.TeleportedInWindow(zoryaSpecTick, end); + } } diff --git a/src/main/java/com/attacktimer/VariableSpeed/IVariableSpeed.java b/src/main/java/com/attacktimer/VariableSpeed/IVariableSpeed.java index 1a84846..4ed225a 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/IVariableSpeed.java +++ b/src/main/java/com/attacktimer/VariableSpeed/IVariableSpeed.java @@ -39,18 +39,19 @@ public interface IVariableSpeed extends IStateTracker * attacking and hence a new cooldown. to ensure a new IVariableSpeed implementation is used ensure * to add a new instance of that class in {@see VariableSpeed.toApply}. * - * @param client the RuneScape client. - * @param curAnimation the animation currently being used to attack. - * @param atkType the overarching "attack type" for this attack, this is based on all the - * inference made about manual casts, etc. For more details about the attack - * {@see com.attacktimer.ClientUtils.Utils}. - * @param damageDealt the amount of damage being dealt by this attack (still WIP) - * @param lastSpecDelta the amount of spec consumed or generated by this attack (in 100s of percent, - * so consuming 25% spec would be -250.) - * @param baseSpeed the speed at which the attack speed started before any other variable speeds - * have changed it. - * @param curSpeed the current speed at which the attack is now after variable speeds have been - * applied, e.g. rapid with range style. + * @param client the RuneScape client. + * @param curAnimation the animation currently being used to attack. + * @param atkType the overarching "attack type" for this attack, this is based on all the + * inference made about manual casts, etc. For more details about the attack + * {@see com.attacktimer.ClientUtils.Utils}. + * @param damageDealt the amount of damage being dealt by this attack (still WIP) + * @param lastSpecDelta the amount of spec consumed or generated by this attack (in 100s of + * percent, so consuming 25% spec would be -250.) + * @param specChangedTick the tick on which the `lastSpecDelta` changed + * @param baseSpeed the speed at which the attack speed started before any other variable + * speeds have changed it. + * @param curSpeed the current speed at which the attack is now after variable speeds have + * been applied, e.g. rapid with range style. * @return the new attack speed if the pre-conditions for this variable attack speed where met. */ public int apply( @@ -60,6 +61,7 @@ public int apply( final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, + final int specChangedTick, final int baseSpeed, final int curSpeed ); diff --git a/src/main/java/com/attacktimer/VariableSpeed/PurgingStaffSpec.java b/src/main/java/com/attacktimer/VariableSpeed/PurgingStaffSpec.java index 172c987..6303617 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/PurgingStaffSpec.java +++ b/src/main/java/com/attacktimer/VariableSpeed/PurgingStaffSpec.java @@ -46,8 +46,8 @@ public class PurgingStaffSpec implements IVariableSpeed // https://oldschool.runescape.wiki/w/Purging_staff#Special_attack public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed, - final int curSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, + final int baseSpeed, final int curSpeed) { // For now the plugin only works for yama if (!this.yama.inYamaRegion) diff --git a/src/main/java/com/attacktimer/VariableSpeed/RapidAttackStyle.java b/src/main/java/com/attacktimer/VariableSpeed/RapidAttackStyle.java index db63b9b..d383e8d 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/RapidAttackStyle.java +++ b/src/main/java/com/attacktimer/VariableSpeed/RapidAttackStyle.java @@ -37,8 +37,8 @@ public class RapidAttackStyle implements IVariableSpeed { public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed, - final int curSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, + final int baseSpeed, final int curSpeed) { // index 1 == rapid final boolean isRapid = client.getVarpValue(VarPlayerID.COM_MODE) == 1; diff --git a/src/main/java/com/attacktimer/VariableSpeed/RedKerisSpec.java b/src/main/java/com/attacktimer/VariableSpeed/RedKerisSpec.java index b5bf541..f4081cc 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/RedKerisSpec.java +++ b/src/main/java/com/attacktimer/VariableSpeed/RedKerisSpec.java @@ -33,8 +33,8 @@ public class RedKerisSpec implements IVariableSpeed { public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed, - final int curSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, + final int baseSpeed, final int curSpeed) { // https://oldschool.runescape.wiki/w/Keris_partisan_of_corruption#Special_attack if (lastSpecDelta != -750 || curAnimation != AnimationData.MELEE_RED_KERIS_SPEC) diff --git a/src/main/java/com/attacktimer/VariableSpeed/RoyalTitans.java b/src/main/java/com/attacktimer/VariableSpeed/RoyalTitans.java index 502f9e6..9ebc70a 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/RoyalTitans.java +++ b/src/main/java/com/attacktimer/VariableSpeed/RoyalTitans.java @@ -75,8 +75,8 @@ public class RoyalTitans implements IVariableSpeed @Override public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed, - final int curSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, + final int baseSpeed, final int curSpeed) { if (earlyExit(client, atkType, damageDealt, spellbook)) { diff --git a/src/main/java/com/attacktimer/VariableSpeed/Scurrius.java b/src/main/java/com/attacktimer/VariableSpeed/Scurrius.java index 3b6319e..f859f3d 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/Scurrius.java +++ b/src/main/java/com/attacktimer/VariableSpeed/Scurrius.java @@ -61,8 +61,8 @@ private static boolean attackingGiantRatWithBoneWeapon(final int equipped, final } public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed, - final int curSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, + final int baseSpeed, final int curSpeed) { final WorldPoint location = Utils.getLocalLocation(client); final int weaponId = Utils.getWeaponId(client); diff --git a/src/main/java/com/attacktimer/VariableSpeed/State/Teleported.java b/src/main/java/com/attacktimer/VariableSpeed/State/Teleported.java new file mode 100644 index 0000000..8842dfe --- /dev/null +++ b/src/main/java/com/attacktimer/VariableSpeed/State/Teleported.java @@ -0,0 +1,84 @@ +package com.attacktimer.VariableSpeed.State; + +/* + * Copyright (c) 2026, Lexer747 + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import net.runelite.api.Client; +import net.runelite.api.coords.WorldPoint; +import net.runelite.api.events.GameTick; + +public class Teleported implements IStateTracker +{ + private final TickCount tc; + private WorldPoint lastWorldPoint = null; + private boolean teleported = false; + private int tpTick = -1; + + public Teleported(final TickCount tc) + { + this.tc = tc; + } + + public void onGameTick(final Client client, final GameTick tick) + { + // Track player location to detect teleports + final var lp = client.getLocalPlayer(); + if (lp == null) return; + final var pos = lp.getWorldLocation(); + if (pos == null) return; + if (lastWorldPoint == null) + { + lastWorldPoint = pos; + return; + } + // this will be too naive for some bosses + teleported = lastWorldPoint.distanceTo2D(pos) > 2; + if (teleported) + { + tpTick = tc.get(); + } + lastWorldPoint = pos; + } + + /** + * HasTeleported returns true if the player has teleported this tick. + * @return false if the player hasn't teleported, true if the player has + */ + public boolean HasTeleported() + { + return teleported; + } + + /** + * TeleportedInWindow returns true if the player has teleported within the given tick window + * @param start the starting tick to check + * @param stop the final tick to check + * @return true if the player teleported within the window, false otherwise. + */ + public boolean TeleportedInWindow(final int start, final int stop) + { + return tpTick >= start && tpTick <= stop; + } +}; diff --git a/src/main/java/com/attacktimer/VariableSpeed/TombsOfAmascut.java b/src/main/java/com/attacktimer/VariableSpeed/TombsOfAmascut.java index fe7cb76..94c5f73 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/TombsOfAmascut.java +++ b/src/main/java/com/attacktimer/VariableSpeed/TombsOfAmascut.java @@ -41,8 +41,8 @@ public class TombsOfAmascut implements IVariableSpeed { public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed, - final int curSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, + final int baseSpeed, final int curSpeed) { final int targetId = Utils.getTargetId(client); final AttackType attkType = Utils.getAttackType(client); diff --git a/src/main/java/com/attacktimer/VariableSpeed/TormentedDemons.java b/src/main/java/com/attacktimer/VariableSpeed/TormentedDemons.java index e11434e..b04e811 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/TormentedDemons.java +++ b/src/main/java/com/attacktimer/VariableSpeed/TormentedDemons.java @@ -69,8 +69,8 @@ public class TormentedDemons implements IVariableSpeed } public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed, - final int curSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, + final int baseSpeed, final int curSpeed) { final int targetId = Utils.getTargetId(client); if (!isTormentedDemon(targetId)) diff --git a/src/main/java/com/attacktimer/VariableSpeed/VariableSpeed.java b/src/main/java/com/attacktimer/VariableSpeed/VariableSpeed.java index 8d6360d..2690879 100644 --- a/src/main/java/com/attacktimer/VariableSpeed/VariableSpeed.java +++ b/src/main/java/com/attacktimer/VariableSpeed/VariableSpeed.java @@ -31,6 +31,7 @@ import com.attacktimer.Spellbook; import com.attacktimer.VariableSpeed.State.IStateTracker; import com.attacktimer.VariableSpeed.State.MarkOfDarkness; +import com.attacktimer.VariableSpeed.State.Teleported; import com.attacktimer.VariableSpeed.State.Yama; import net.runelite.api.Client; import net.runelite.api.events.ChatMessage; @@ -45,12 +46,12 @@ public class VariableSpeed * classes which can affect the base speed of a weapon. See implementations of IVariableSpeed. */ public static int compute(final Client client, final AnimationData curAnimation, final AttackProcedure atkType, - final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int baseSpeed) + final Spellbook spellbook, final int damageDealt, final int lastSpecDelta, final int specChangedTick, final int baseSpeed) { int newSpeed = baseSpeed; for (final IVariableSpeed i : TO_APPLY) { - newSpeed = i.apply(client, curAnimation, atkType, spellbook, damageDealt, lastSpecDelta, baseSpeed, newSpeed); + newSpeed = i.apply(client, curAnimation, atkType, spellbook, damageDealt, lastSpecDelta, specChangedTick, baseSpeed, newSpeed); } return newSpeed; } @@ -105,6 +106,7 @@ public static void onNpcDespawned(final Client client, final NpcDespawned npcDes private static final Yama YAMA = new Yama(); private static final MarkOfDarkness MARK_OF_DARKNESS = new MarkOfDarkness(); + private static final Teleported TELEPORTED = new Teleported(AttackTimerMetronomePlugin.TC); // Variable speed that doesn't neatly fit in to the IVariable speed pattern (it's not weapon related // but boss related). @@ -118,6 +120,7 @@ public static void onNpcDespawned(final Client client, final NpcDespawned npcDes AttackTimerMetronomePlugin.TC, YAMA, MARK_OF_DARKNESS, + TELEPORTED, }; private static final IVariableSpeed[] TO_APPLY = { // Order matters, apply leagues first, then any incremental modifications like rapid, or set @@ -130,7 +133,7 @@ public static void onNpcDespawned(final Client client, final NpcDespawned npcDes new RedKerisSpec(), new PurgingStaffSpec(YAMA), new EyeOfAyak(), - new FracturedArchive(AttackTimerMetronomePlugin.TC), + new FracturedArchive(AttackTimerMetronomePlugin.TC, TELEPORTED), new TormentedDemons(AttackTimerMetronomePlugin.TC), new RoyalTitans(),