1package com.runehive.game.world.entity.combat.attack;
3import com.runehive.game.world.entity.combat.CombatType;
4import com.runehive.game.world.entity.combat.FormulaModifier;
5import com.runehive.game.world.entity.combat.accuracy.*;
6import com.runehive.game.world.entity.combat.hit.Hit;
7import com.runehive.game.world.entity.combat.hit.HitIcon;
8import com.runehive.game.world.entity.combat.hit.Hitsplat;
9import com.runehive.game.world.entity.combat.maxhit.MeleeMaxHit;
10import com.runehive.game.world.entity.combat.maxhit.RangeMaxHit;
11import com.runehive.game.world.entity.combat.strategy.CombatStrategy;
12import com.runehive.game.world.entity.mob.Mob;
13import com.runehive.util.RandomUtils;
47 if (
strategy.toString().contains(
"ScytheOfVitur") && totalHits > 1) {
48 final Hit[] hits =
new Hit[totalHits];
50 for (
int index = 0; index < hits.length; index++) {
51 final Hit hit = hits[index] =
new Hit(max < 0 ? -1 : 0, hitsplat, icon,
71 hit.setDamage(verdict);
78 final Hit hit =
new Hit(max < 0 ? -1 : 0, hitsplat, icon,
88 hit.setDamage(verdict);
101 boolean isNpc = attacker.
isNpc();
119 int roll =
formula.modifyAccuracy(attacker, defender, 0);
120 int bonus =
formula.modifyOffensiveBonus(attacker, defender, 0);
121 return attacker.
getCombat().modifyAccuracy(defender, roll * (bonus + 64));
125 int roll =
formula.modifyDefensive(attacker, defender, 0);
126 int bonus =
formula.modifyDefensiveBonus(attacker, defender, 0);
127 return attacker.
getCombat().modifyDefensive(defender, roll * (bonus + 64));
132 int level =
formula.modifyAggressive(attacker, defender, 0);
133 int bonus =
formula.modifyAggressiveBonus(attacker, defender, 0);
137 return maxHit(level, bonus);
142 int level =
formula.modifyAggressive(attacker, defender, 0);
143 int bonus =
formula.modifyAggressiveBonus(attacker, defender, 0);
150 return formula.modifyDamage(attacker, defender,
maxHit(level, bonus));
153 private static int maxHit(
int level,
int bonus) {
154 return (320 + level * (bonus + 64)) / 640;
static boolean successful(Mob attacker, Mob defender)
static boolean successful(Mob attacker, Mob defender, CombatType style)
static boolean successful(Mob attacker, Mob defender)
static boolean successful(Mob attacker, Mob defender)
static boolean successful(Mob attacker, Mob defender, CombatType style)
A Hit object holds the damage amount and hitsplat data.
static int maxHit(Mob player)
static int maxHit(Mob player)
abstract< T extends Mob > CombatStrategy<? super T > getStrategy()
The combat strategy of the mob.
abstract Combat<? extends Mob > getCombat()
The combat of the mob.
final boolean isNpc()
Check if an entity is an npc.
A static-util class that provides additional functionality for generating pseudo-random numbers.
static int inclusive(int min, int max)
Returns a pseudo-random int value between inclusive min and inclusive max.
static boolean success(double value)
Determines if a pseudorandomly generated double rounded to two decimal places is below or equal to va...
FormulaModifier< Mob > getFormula()
The enumerated type whose elements represent the hit icon of a Hit.
MELEE
Represents the melee sword hit icon.
RANGED
Represents the ranged bow hit icon.
MAGIC
Represents the magic hat hit icon.
NORMAL
Represents a normal hit type.