RuneHive-Game
Loading...
Searching...
No Matches
RangeMaxHit.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.combat.maxhit;
2
3import com.runehive.game.world.entity.combat.CombatType;
4import com.runehive.game.world.entity.combat.FormulaUtils;
5import com.runehive.game.world.entity.combat.attack.FightStyle;
6import com.runehive.game.world.entity.mob.Mob;
7import com.runehive.game.world.entity.mob.player.Player;
8import com.runehive.game.world.entity.mob.prayer.Prayer;
9import com.runehive.game.world.entity.skill.Skill;
10import com.runehive.game.world.items.containers.equipment.Equipment;
11
12/**
13 * @Author Origin
14 */
15public class RangeMaxHit {
16
17 public static double getBaseDamage(Mob player) {
18 int rangestr = player.getBonus(Equipment.RANGED_STRENGTH);
19 return (1.3 + (getEffectiveRanged(player) / 10) + (rangestr / 80D) + (getEffectiveRanged(player) * rangestr / 640));
20 }
21
22 public static int getRangedlevel(Mob player) {
23 return player.skills.getLevel(Skill.RANGED);
24 }
25
26 public static double getEffectiveRanged(Mob player) {
27 return Math.floor(((getRangedlevel(player)) * getPrayerBonus(player)) * getOtherBonus(player)) + getStyleBonus(player);
28 }
29
30 public static double getPrayerBonus(Mob player) {
31 double prayerBonus = 1;
32 if (player.getStrategy().getCombatType().equals(CombatType.RANGED)) {
33 if (player.prayer.isActive(Prayer.SHARP_EYE))
34 prayerBonus *= 1.05D; // 5% range level boost
35 else if (player.prayer.isActive(Prayer.HAWK_EYE))
36 prayerBonus *= 1.10D; // 10% range level boost
37 else if (player.prayer.isActive(Prayer.EAGLE_EYE))
38 prayerBonus *= 1.15D; // 15% range level boost
39 else if (player.prayer.isActive(Prayer.RIGOUR))
40 prayerBonus *= 1.20D; // 20% range level boost
41 }
42 return prayerBonus;
43 }
44
45 public static int getStyleBonus(Mob player) {
46 FightStyle style = player.getCombat().getFightType().getStyle();
47 return style.equals(FightStyle.ACCURATE) ? 3 : 0;
48 }
49
50 public static double getOtherBonus(Mob player) {
51 double otherBonus = 1.0;
52
53
54
55 Mob target = player.getCombat().getDefender();
56
57
58 if (FormulaUtils.voidRanger((Player) player)) {
59 otherBonus *= 1.10;
60 }
61
62
63 if (FormulaUtils.wearingEliteVoid((Player) player)) {
64 otherBonus *= 1.125;
65 }
66
67 /*
68 * BOWFA, MIGHT ADD COLORED ONES INTO IT. IF SO, ADD HERE.
69 */
70
71 if (((Player) player).equipment.contains(23971) && ((Player) player).equipment.contains(25865)) {
72 otherBonus *= 1.025;//2.5% damage boost
73 }
74
75 if (((Player) player).equipment.contains(23975) && ((Player) player).equipment.contains(25865)) {
76 otherBonus *= 1.075;//7.5% damage boost
77 }
78
79 if (((Player) player).equipment.contains(23979) && ((Player) player).equipment.contains(25865)) {
80 otherBonus *= 1.05;//5.0% damage boost
81 }
82
83 if (FormulaUtils.hasCrawsBow((Player) player) && target != null && target.isNpc()) {
84 otherBonus += 0.50;
85 }
86
87 return otherBonus;
88 }
89
90 public static int maxHit(Mob player) {
91 int maxHit;
92 maxHit = (int) getBaseDamage(player);
93 return maxHit;
94 }
95}
Handles the mob class.
Definition Mob.java:66
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.
Definition Mob.java:550
This class represents a character controlled by a player.
Definition Player.java:125
boolean isActive(Prayer... prayers)
Checks if all given prayers are active.
Represents a trainable and usable skill.
Definition Skill.java:18
static final int RANGED
The ranged skill id.
Definition Skill.java:33
int getLevel(int id)
Gets the level of a skill.
The container that manages the equipment for a player.
The enumerated type whose elements represent the fighting styles.