Skip to content
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
5 changes: 1 addition & 4 deletions src/main/java/com/attacktimer/Attacking/Attack.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,11 @@ public final class Attack
@Getter
private final int animationId;
@Getter
private final boolean salamander;
@Getter
private final Actor target;

public Attack(final int animationId, final boolean salamander, final Actor target)
public Attack(final int animationId, final Actor target)
{
this.animationId = animationId;
this.salamander = salamander;
this.target = target;
}
}
42 changes: 34 additions & 8 deletions src/main/java/com/attacktimer/Attacking/Attacking.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,28 @@ public class Attacking
.add(AnimationData.MELEE_OBLIGATOR).add(AnimationData.MELEE_OBLIGATOR_FEMALE)
.add(AnimationData.MELEE_OBLIGATOR_MULTIHIT).add(AnimationData.MELEE_OBLIGATOR_MULTIHIT_FEMALE).build();

// Combat Dummy + Nightmare Pillars
private static final Set<Integer> SPECIAL_NPCS = new ImmutableSet.Builder<Integer>()
// Combat Dummy
public static final Set<Integer> COMBAT_DUMMY = new ImmutableSet.Builder<Integer>()
.add(NpcID.POH_COMBAT_DUMMY_UPGRADED_UNDEADSLAYER_NPC, NpcID.POH_COMBAT_DUMMY_UPGRADED_ETHER_NPC,
NpcID.POH_COMBAT_DUMMY_UPGRADED_KQ_NPC, NpcID.POH_COMBAT_DUMMY_UPGRADED_KURASK_NPC,
NpcID.POH_COMBAT_DUMMY_UPGRADED_VAMPIRE_NPC, NpcID.POH_COMBAT_DUMMY_UPGRADED_VORKATH_NPC,
NpcID.POH_COMBAT_DUMMY_NPC, NpcID.POH_COMBAT_DUMMY_UNDEADSLAYER_NPC,
NpcID.POH_COMBAT_DUMMY_UPGRADED_NPC, NpcID.NIGHTMARE_TOTEM_1_READY, NpcID.NIGHTMARE_TOTEM_2_READY,
NpcID.POH_COMBAT_DUMMY_UPGRADED_NPC)
.build();

// Combat Dummy + Nightmare Pillars
private static final Set<Integer> SPECIAL_NPCS = new ImmutableSet.Builder<Integer>()
.add(NpcID.NIGHTMARE_TOTEM_1_READY, NpcID.NIGHTMARE_TOTEM_2_READY,
NpcID.NIGHTMARE_TOTEM_3_READY, NpcID.NIGHTMARE_TOTEM_4_READY)
.addAll(COMBAT_DUMMY)
.build();

public static boolean isPlayerAttacking(final Client client, final NPCManager npcManager, final Map<GameObject, Tile> sailingCannons)
{
final Player localPlayer = client.getLocalPlayer();
final int animationId = localPlayer.getAnimation();
if (AnimationData.isBlockListAnimation(animationId))
// Most weapons overwrite blockList animations, apart from the zorya tome, how odd.
if (AnimationData.isBlockListAnimation(animationId) && !getZoryaAttack(localPlayer))
{
return false;
}
Expand All @@ -93,7 +100,7 @@ public static boolean isPlayerAttacking(final Client client, final NPCManager np

// Not walking is either ANY player animation or the edge cases which don't trigger an animation,
// e.g Salamander.
final boolean notWalking = animationId != -1 || getSalamanderAttack(client);
final boolean notWalking = animationId != -1 || getSpotAnimAttack(localPlayer);

// Testing if we are attacking by checking the target is more future proof to new weapons which don't
// need custom code and the weapon stats are enough.
Expand Down Expand Up @@ -135,14 +142,33 @@ public static Attack PlayerAttack(final Client client)
final Player localPlayer = client.getLocalPlayer();
final int animationId = localPlayer.getAnimation();
final Actor target = localPlayer.getInteracting();
return new Attack(animationId, getSalamanderAttack(client), target);
return new Attack(animationId, target);
}

private static boolean getSpotAnimAttack(final Player lp)
{
return getSalamanderAttack(lp) || getZoryaAttack(lp);
}

private static boolean getSalamanderAttack(final Player lp)
{
return lp.hasSpotAnim(SpotanimID.FIREBREATH);
}

private static boolean getSalamanderAttack(final Client client)
private static boolean getZoryaAttack(final Player lp)
{
return client.getLocalPlayer().hasSpotAnim(SpotanimID.FIREBREATH);
return lp.hasSpotAnim(SpotanimID.VFX_ZORYA_TOME_STANDARD_SPOTANIM)
|| lp.hasSpotAnim(SpotanimID.VFX_ZORYA_TOME_STANDARD_SPOTANIM_FEMALE)
|| getZoryaSpecAttack(lp);
}

public static boolean getZoryaSpecAttack(final Player lp)
{
return lp.hasSpotAnim(SpotanimID.VFX_ZORYA_TOME_SPEC_SPOTANIM)
|| lp.hasSpotAnim(SpotanimID.VFX_ZORYA_TOME_SPEC_SPOTANIM_FEMALE);
}


private static boolean sailingAttack(final Client client, final Map<GameObject, Tile> sailingCannons, final AnimationData anim)
{
// Normal combat (e.g. shooting a bow) from a boat does follow all the normal rules and therefore
Expand Down
67 changes: 59 additions & 8 deletions src/main/java/com/attacktimer/VariableSpeed/FracturedArchive.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

/*
* Copyright (c) 2026, Richardant <https://github.com/Richardant>
* Copyright (c) 2026, Lexer747 <https://github.com/Lexer747>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,10 +28,14 @@

import com.attacktimer.AnimationData;
import com.attacktimer.AttackProcedure;
import com.attacktimer.Attacking.Attacking;
import com.attacktimer.ClientUtils.Utils;
import com.attacktimer.Spellbook;
import com.attacktimer.VariableSpeed.State.TickCount;
import net.runelite.api.Actor;
import net.runelite.api.Client;
import net.runelite.api.NPC;
import net.runelite.api.Player;
import net.runelite.api.gameval.ItemID;

// Weapons from The Fractured Archive.
Expand Down Expand Up @@ -63,23 +68,53 @@ public int apply(final Client client, final AnimationData curAnimation, final At
return curSpeed;
}
final int weaponId = Utils.getWeaponId(client);
switch (curAnimation)
if (isObligator(weaponId))
{
switch (curAnimation)
{
case MELEE_OBLIGATOR:
case MELEE_OBLIGATOR_FEMALE:
return isObligator(weaponId) ? 3 : curSpeed;
return 3;
case MELEE_OBLIGATOR_MULTIHIT:
case MELEE_OBLIGATOR_MULTIHIT_FEMALE:
return isObligator(weaponId) ? 5 : curSpeed;
return 5;
default:
// 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 from the attack option.
final var option = Utils.getAttackStyle(client);
switch (option)
{
case ACCURATE:
return 3;
case AGGRESSIVE:
default:
return 5;
}
}
}
else if (isZoryasTome(weaponId))
{
final boolean hit = successfulHit(client, damageDealt);
switch (curAnimation)
{
case MAGIC_ZORYA_TOME_SPEC:
case MAGIC_ZORYA_TOME_SPEC_FEMALE:
return isZoryasTome(weaponId) ? zoryaAttackSpeed(true, damageDealt) : curSpeed;
return zoryaAttackSpeed(hit);
case MAGIC_ZORYA_TOME:
case MAGIC_ZORYA_TOME_FEMALE:
return isZoryasTome(weaponId) ? zoryaAttackSpeed(false, damageDealt) : curSpeed;
return zoryaAttackSpeed(false);
default:
return curSpeed;
// 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));
return zoryaAttackSpeed(specAndHit);
// Since we know the weapon ID we should always use `zoryaAttackSpeed` to track fast attacks
// accurately
}
}

return curSpeed;
}

private static boolean isObligator(final int weaponId)
Expand All @@ -92,7 +127,7 @@ private static boolean isZoryasTome(final int weaponId)
return weaponId == ItemID.ZORYAS_TOME || weaponId == ItemID.ZORYAS_TOME_UNCHARGED;
}

private int zoryaAttackSpeed(final boolean isSpec, final int damageDealt)
private int zoryaAttackSpeed(final boolean isSpecAndHit)
{
// https://oldschool.runescape.wiki/w/Zorya%27s_tome
// A landed spec buffs the next 3 attacks (2t instead of 3t). A spec used while buffed is itself a
Expand All @@ -110,11 +145,27 @@ private int zoryaAttackSpeed(final boolean isSpec, final int damageDealt)
remaining--;
speed = 2;
}
if (isSpec && damageDealt > 0)
if (isSpecAndHit)
{
remaining += ZORYA_FAST_ATTACKS;
}
zoryaFastAttacksRemaining = remaining;
return speed;
}

private boolean successfulHit(final Client client, final int damageDealt)
{
if (damageDealt > 0)
{
return true;
}
final Actor target = client.getLocalPlayer().getInteracting();
if (target != null && (target instanceof NPC))
{
final NPC npc = (NPC) target;
// These don't compute damage normally (zero exp)
return Attacking.COMBAT_DUMMY.contains(npc.getId());
}
return false;
}
}
Loading