1package com.runehive.game.world.entity.combat.accuracy;
3import com.runehive.content.skill.impl.slayer.SlayerTask;
4import com.runehive.game.world.entity.combat.CombatType;
5import com.runehive.game.world.entity.combat.FormulaUtils;
6import com.runehive.game.world.entity.mob.Mob;
7import com.runehive.game.world.entity.mob.npc.Npc;
8import com.runehive.game.world.entity.mob.player.Player;
9import com.runehive.game.world.entity.mob.prayer.Prayer;
10import com.runehive.game.world.entity.skill.Skill;
11import com.runehive.util.Items;
13import java.security.SecureRandom;
21 public static final SecureRandom
srand =
new SecureRandom();
28 if (attackRoll > defenceRoll)
29 chance = 1D - (defenceRoll + 2D) / (2D * (attackRoll + 1D));
31 chance = attackRoll / (2D * (defenceRoll + 1D));
33 double roll =
srand.nextDouble();
38 double prayerBonus = 1D;
65 if (((
Player) attacker).equipment.contains(27275)) {
71 if (attacker.
isNpc()) {
79 if (((
Player) attacker).equipment.contains(19720)) {
82 if (((
Player) attacker).equipment.contains(22555)) {
91 if (((
Player) attacker).equipment.contains(11865)) {
110 if (defender instanceof
Npc npc) {
112 bonus = npc.getBonus(8);
static double getDefenceRoll(Mob defender)
static double getAttackRoll(Mob attacker)
static int getMagicDefenceLevelNpc(Mob defender, CombatType style)
static int getEquipmentBonus(Mob attacker, CombatType style, SlayerTask task)
static double getAttackRoll(Mob attacker, CombatType style, SlayerTask task)
static double getEffectiveLevelAttacker(Mob attacker, CombatType style)
static double getEffectiveLevelDefender(Mob defender)
static final SecureRandom srand
static int getMagicLevel(Mob attacker)
static double getPrayerBonus(Mob attacker, CombatType style)
static double getDefenceRoll(Mob defender, CombatType style)
static int getMagicLevelNpc(Mob defender)
static boolean successful(Mob attacker, Mob defender, CombatType style)
final SkillManager skills
final boolean isNpc()
Check if an entity is an npc.
final boolean isPlayer()
Check if an entity is a player.
Represents a non-player character in the in-game world.
This class represents a character controlled by a player.
boolean isActive(Prayer... prayers)
Checks if all given prayers are active.
Represents a trainable and usable skill.
static final int MAGIC
The magic skill id.
int getLevel(int id)
Gets the level of a skill.
static final int RED_SLAYER_HELMET
static final int PURPLE_SLAYER_HELMET
static final int SLAYER_HELMET
static final int BLACK_SLAYER_HELMET
static final int SALVE_AMULET
static final int GREEN_SLAYER_HELMET
Holds all the slayer task data.