Package net.storm.sdk.game
Class Combat
java.lang.Object
net.storm.sdk.game.Combat
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic INPCgetAttackableNPC(int... ids) Finds an attackable NPC matching any of the specified IDs.static INPCgetAttackableNPC(String... names) Finds an attackable NPC matching any of the specified names.static INPCgetAttackableNPC(Predicate<INPC> filter) Finds an attackable NPC matching the specified filter predicate.static AttackStyleGets the currently selected attack style.static intGets the current Forestry axe special attack energy.static net.runelite.api.coords.WorldPointGets the world point location of the player's cannon.static intGets the player's current hitpoints.static WeaponStyleGets the current weapon's combat style category.static doubleGets the player's current health as a percentage of maximum.static intGets the amount of hitpoints the player is missing from their maximum.static intGets the current special attack energy.static net.runelite.api.coords.WorldPointGets the world point location of the player's gravestone/tomb.static booleanChecks whether the player has antifire protection active.static booleanChecks whether the player has antipoison protection active.static booleanChecks whether the player has antivenom protection active.static booleanChecks whether the player is currently poisoned.static booleanChecks whether auto-retaliate is currently enabled.static booleanChecks whether the special attack orb is currently enabled/toggled on.static booleanChecks whether the player has super antifire protection active.static booleanChecks whether the player is currently venomed.static voidsetAttackStyle(AttackStyle attackStyle) Sets the attack style to the specified style.static voidToggles the auto-retaliate setting.static voidtoggleAutoRetaliate(Boolean active) Sets the auto-retaliate setting to a specific state.static voidToggles the special attack orb.
-
Constructor Details
-
Combat
public Combat()
-
-
Method Details
-
isPoisoned
public static boolean isPoisoned()Checks whether the player is currently poisoned.- Returns:
trueif the player is poisoned,falseotherwise
-
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:
trueif the player is venomed,falseotherwise
-
isAntiPoisoned
public static boolean isAntiPoisoned()Checks whether the player has antipoison protection active.- Returns:
trueif antipoison is active,falseotherwise
-
isAntiVenomed
public static boolean isAntiVenomed()Checks whether the player has antivenom protection active.- Returns:
trueif antivenom is active,falseotherwise
-
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:
trueif auto-retaliate is on,falseotherwise
-
isSpecEnabled
public static boolean isSpecEnabled()Checks whether the special attack orb is currently enabled/toggled on.- Returns:
trueif special attack is enabled,falseotherwise
-
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:
trueif antifire is active,falseotherwise
-
isSuperAntifired
public static boolean isSuperAntifired()Checks whether the player has super antifire protection active. Super antifire provides stronger protection against dragonfire.- Returns:
trueif super antifire is active,falseotherwise
-
toggleAutoRetaliate
public static void toggleAutoRetaliate()Toggles the auto-retaliate setting. If on, turns it off; if off, turns it on. -
toggleAutoRetaliate
Sets the auto-retaliate setting to a specific state.- Parameters:
active-trueto enable auto-retaliate,falseto disable, ornullto toggle
-
toggleSpec
public static void toggleSpec()Toggles the special attack orb. This enables or disables special attack for the next attack. -
getAttackStyle
Gets the currently selected attack style.- Returns:
- the current
AttackStyle
-
setAttackStyle
Sets the attack style to the specified style.- Parameters:
attackStyle- theAttackStyleto set
-
getAttackableNPC
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, ornullif none found
-
getAttackableNPC
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, ornullif none found
-
getAttackableNPC
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
INPCmatching the filter, ornullif 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
WorldPointof the tomb, ornullif none exists
-
getCannonWorldPoint
public static net.runelite.api.coords.WorldPoint getCannonWorldPoint()Gets the world point location of the player's cannon.- Returns:
- the
WorldPointof the cannon, ornullif none placed
-
getCurrentWeaponStyle
Gets the current weapon's combat style category.- Returns:
- the current
WeaponStyle
-