Class Combat

java.lang.Object
net.storm.sdk.game.Combat

public class Combat extends Object
Provides static utility methods for combat-related operations and queries. This class offers functionality for checking combat status effects (poison, venom, antifire), managing special attacks, finding attackable NPCs, and retrieving health information.

All methods in this class are static and delegate to the underlying ICombat implementation.

Example usage:


 // Check health status
 int currentHp = Combat.getCurrentHealth();
 double healthPercent = Combat.getHealthPercent();
 int missing = Combat.getMissingHealth();

 // Check for poison/venom and protections
 if (Combat.isPoisoned() && !Combat.isAntiPoisoned()) {
     // Need to drink antipoison
 }

 // Manage special attack
 int specEnergy = Combat.getSpecEnergy();
 if (specEnergy >= 50 && !Combat.isSpecEnabled()) {
     Combat.toggleSpec();
 }

 // Find an NPC to attack
 INPC target = Combat.getAttackableNPC("Goblin", "Guard");
 if (target != null) {
     target.interact("Attack");
 }

 // Set attack style
 Combat.setAttackStyle(AttackStyle.ACCURATE);
 
See Also:
  • Constructor Details

    • Combat

      public Combat()
  • Method Details

    • isPoisoned

      public static boolean isPoisoned()
      Checks whether the player is currently poisoned.
      Returns:
      true if the player is poisoned, false otherwise
    • isVenomed

      public static boolean isVenomed()
      Checks whether the player is currently venomed. Venom is a stronger form of poison that increases in damage over time.
      Returns:
      true if the player is venomed, false otherwise
    • isAntiPoisoned

      public static boolean isAntiPoisoned()
      Checks whether the player has antipoison protection active.
      Returns:
      true if antipoison is active, false otherwise
    • isAntiVenomed

      public static boolean isAntiVenomed()
      Checks whether the player has antivenom protection active.
      Returns:
      true if antivenom is active, false otherwise
    • getSpecEnergy

      public static int getSpecEnergy()
      Gets the current special attack energy. Special attack energy ranges from 0 to 100.
      Returns:
      the special attack energy percentage
    • getMissingHealth

      public static int getMissingHealth()
      Gets the amount of hitpoints the player is missing from their maximum.
      Returns:
      the number of missing hitpoints
    • isRetaliating

      public static boolean isRetaliating()
      Checks whether auto-retaliate is currently enabled.
      Returns:
      true if auto-retaliate is on, false otherwise
    • isSpecEnabled

      public static boolean isSpecEnabled()
      Checks whether the special attack orb is currently enabled/toggled on.
      Returns:
      true if special attack is enabled, false otherwise
    • getAxeEnergy

      public static int getAxeEnergy()
      Gets the current Forestry axe special attack energy.
      Returns:
      the axe special energy value
    • isAntifired

      public static boolean isAntifired()
      Checks whether the player has antifire protection active.
      Returns:
      true if antifire is active, false otherwise
    • isSuperAntifired

      public static boolean isSuperAntifired()
      Checks whether the player has super antifire protection active. Super antifire provides stronger protection against dragonfire.
      Returns:
      true if super antifire is active, false otherwise
    • toggleAutoRetaliate

      public static void toggleAutoRetaliate()
      Toggles the auto-retaliate setting. If on, turns it off; if off, turns it on.
    • toggleAutoRetaliate

      public static void toggleAutoRetaliate(Boolean active)
      Sets the auto-retaliate setting to a specific state.
      Parameters:
      active - true to enable auto-retaliate, false to disable, or null to toggle
    • toggleSpec

      public static void toggleSpec()
      Toggles the special attack orb. This enables or disables special attack for the next attack.
    • getAttackStyle

      public static AttackStyle getAttackStyle()
      Gets the currently selected attack style.
      Returns:
      the current AttackStyle
    • setAttackStyle

      public static void setAttackStyle(AttackStyle attackStyle)
      Sets the attack style to the specified style.
      Parameters:
      attackStyle - the AttackStyle to set
    • getAttackableNPC

      public static INPC getAttackableNPC(int... ids)
      Finds an attackable NPC matching any of the specified IDs. An NPC is considered attackable if it can be attacked and is not already in combat.
      Parameters:
      ids - the NPC IDs to search for
      Returns:
      the nearest attackable INPC, or null if none found
    • getAttackableNPC

      public static INPC getAttackableNPC(String... names)
      Finds an attackable NPC matching any of the specified names. An NPC is considered attackable if it can be attacked and is not already in combat.
      Parameters:
      names - the NPC names to search for
      Returns:
      the nearest attackable INPC, or null if none found
    • getAttackableNPC

      public static INPC getAttackableNPC(Predicate<INPC> filter)
      Finds an attackable NPC matching the specified filter predicate. An NPC is considered attackable if it can be attacked and is not already in combat.
      Parameters:
      filter - the predicate to filter NPCs
      Returns:
      the nearest attackable INPC matching the filter, or null if none found
    • getCurrentHealth

      public static int getCurrentHealth()
      Gets the player's current hitpoints.
      Returns:
      the current hitpoints value
    • getHealthPercent

      public static double getHealthPercent()
      Gets the player's current health as a percentage of maximum.
      Returns:
      the health percentage (0.0 to 100.0)
    • getTombWorldPoint

      public static net.runelite.api.coords.WorldPoint getTombWorldPoint()
      Gets the world point location of the player's gravestone/tomb.
      Returns:
      the WorldPoint of the tomb, or null if none exists
    • getCannonWorldPoint

      public static net.runelite.api.coords.WorldPoint getCannonWorldPoint()
      Gets the world point location of the player's cannon.
      Returns:
      the WorldPoint of the cannon, or null if none placed
    • getCurrentWeaponStyle

      public static WeaponStyle getCurrentWeaponStyle()
      Gets the current weapon's combat style category.
      Returns:
      the current WeaponStyle