RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
MeleeMaxHit.java
1package com.osroyale.game.world.entity.combat.maxhit;
2
3import com.osroyale.game.world.entity.combat.attack.FightStyle;
4import com.osroyale.game.world.entity.mob.Mob;
5import com.osroyale.game.world.entity.mob.prayer.Prayer;
6import com.osroyale.game.world.entity.skill.Skill;
7
48
49public class MeleeMaxHit {
50
51 public static int maxHit(Mob player) {
56
57 int maxHit = (int) Math.floor(getBaseDamage(player) * slayerPerkBonus(player));
58
62
63 /* if (CombatFactory.fullDharoks(player)) {
64 double lostHp = player.maxHp() - player.hp();
65 maxHit *= (1 + ((lostHp /100) * (player.maxHp() / 100)));
66 } */
67
68 return (int) Math.floor(maxHit);
69 }
70
71 public static int getBaseDamage(Mob player) {
72 return (int) (Math.floor(0.5 + (getEffectiveStrength(player)) * (getStrengthBonus(player) + 64) + 320) / 640.0);
73 }
74
75 public static int getStrengthBonus(Mob player) {
76 return player.getBonus(9);
77 }
78
79 public static int getStrengthLevel(Mob player) {
80 return player.skills.getLevel(Skill.STRENGTH);
81 }
82
83 private static double getPrayerBonus(Mob player) {
88 double prayerBonus = 1;
89 if (player.prayer.isActive(Prayer.THICK_SKIN))
90 prayerBonus += 1.05D; // 5% def level boost
91 else if (player.prayer.isActive(Prayer.ROCK_SKIN))
92 prayerBonus += 1.10D; // 10% def level boost
93 else if (player.prayer.isActive(Prayer.STEEL_SKIN))
94 prayerBonus += 1.15D; // 15% def level boost
95 else if (player.prayer.isActive(Prayer.CHIVALRY))
96 prayerBonus += 1.20D; // 20% def level boost
97 else if (player.prayer.isActive(Prayer.PIETY))
98 prayerBonus += 1.25D; // 25% def level boost
99 return prayerBonus;
100 }
101
102 public static int getStyleBonus(Mob player) {
103 FightStyle style = player.getCombat().getFightType().getStyle();
104 return style.equals(FightStyle.AGGRESSIVE) ? 3 : style.equals(FightStyle.ACCURATE) ? 1 : 0;
105 }
106
107 public static double slayerPerkBonus(Mob player) {
108 // SlayerTask target = player.getPlayer().slayer.getTask();
109
110 double slayerPerkBonus = 1.0;
111
115 return slayerPerkBonus;
116 }
117
118 public static double getOtherBonus(Mob player, boolean includeNpcMax) {
119
120 //FightStyle style = player.getCombat().getFightType().getStyle();
121 double otherBonus = 1;
122 //boolean target = player.getCombat().getDefender().isNpc();
123
128
129 /* if (FormulaUtils.voidMelee(player) || FormulaUtils.wearingEliteVoid(player)) {
130 otherBonus *= 1.10;
131 }
132
133 var wearingAnyBlackMask = FormulaUtils.wearingBlackMask(player) || FormulaUtils.wearingBlackMaskImbued(player) || player.getEquipment().wearingSlayerHelm();
134
135 if(wearingAnyBlackMask && target != null && target.isNpc() && includeNpcMax) {
136 NPC npc = target.getAsNpc();
137 if(npc.id() == NpcIdentifiers.COMBAT_DUMMY) {
138 otherBonus *= 1.1667;
139 }
140
141 if(Slayer.creatureMatches(player, npc.id())) {
142 otherBonus *= 1.1667;
143 }
144 }
145
146 if(player.getEquipment().hasAt(EquipSlot.AMULET, SALVE_AMULET) && !wearingAnyBlackMask && target != null && includeNpcMax) {
147 if(target.isNpc() && target.getAsNpc().id() == NpcIdentifiers.COMBAT_DUMMY) {
148 otherBonus *= 1.16;
149 }
150
151 if(FormulaUtils.isUndead(target)) {
152 otherBonus *= 1.16;
153 }
154 }
155
156 if(player.getEquipment().hasAt(EquipSlot.AMULET, SALVE_AMULETI) && !wearingAnyBlackMask && target != null && includeNpcMax) {
157 if(target.isNpc() && target.getAsNpc().id() == NpcIdentifiers.COMBAT_DUMMY) {
158 otherBonus *= 1.20;
159 }
160
161 if(FormulaUtils.isUndead(target)) {
162 otherBonus *= 1.20;
163 }
164 }
165
166 if(player.getEquipment().hasAt(EquipSlot.AMULET, SALVE_AMULET_E) && !wearingAnyBlackMask && target != null && includeNpcMax) {
167 if(target.isNpc() && target.getAsNpc().id() == NpcIdentifiers.COMBAT_DUMMY) {
168 otherBonus *= 1.20;
169 }
170
171 if(FormulaUtils.isUndead(target)) {
172 otherBonus *= 1.20;
173 }
174 }
175
176 if(player.getEquipment().hasAt(EquipSlot.AMULET, SALVE_AMULETEI) && !wearingAnyBlackMask && target != null && includeNpcMax) {
177 if(target.isNpc() && target.getAsNpc().id() == NpcIdentifiers.COMBAT_DUMMY) {
178 otherBonus *= 1.20;
179 }
180
181 if(FormulaUtils.isUndead(target)) {
182 otherBonus *= 1.20;
183 }
184 }
185
186 if (player.getEquipment().hasAt(EquipSlot.WEAPON, RED_SLAYER_HELMET_I) && target != null && target.isNpc() && includeNpcMax) {
187 otherBonus *= 1.10;
188 }
189
190 if (FormulaUtils.wearingTwistedSlayerHelmetI(player) && target != null && target.isNpc() && includeNpcMax) {
191 otherBonus *= 1.10;
192 }
193
194 if(player.getEquipment().hasAt(EquipSlot.WEAPON, ARCLIGHT) && target != null && includeNpcMax) {
195 if(target.isNpc() && target.getAsNpc().id() == NpcIdentifiers.COMBAT_DUMMY) {
196 otherBonus *= 1.70;
197 }
198
199 if(FormulaUtils.isDemon(target)) {
200 otherBonus *= 1.70;
201 }
202 }
203
204 if(player.getEquipment().hasAt(EquipSlot.WEAPON, DARKLIGHT) && target != null && includeNpcMax) {
205 if(target.isNpc() && target.getAsNpc().id() == NpcIdentifiers.COMBAT_DUMMY) {
206 otherBonus *= 1.60;
207 }
208
209 if(FormulaUtils.isDemon(target)) {
210 otherBonus *= 1.60;
211 }
212 }
213
214 if(player.getEquipment().hasAt(EquipSlot.WEAPON, DARKLIGHT) && target != null && includeNpcMax) {
215 if(target.isNpc() && target.getAsNpc().id() == NpcIdentifiers.COMBAT_DUMMY) {
216 otherBonus *= 1.175;
217 }
218
219 if(target.isNpc() && target.getAsNpc().def() != null && (target.getAsNpc().def().name.equalsIgnoreCase("Kurask") || target.getAsNpc().def().name.equalsIgnoreCase("Turoth"))) {
220 otherBonus *= 1.175;
221 }
222 }
223
224 if (FormulaUtils.obbyArmour(player) && FormulaUtils.hasObbyWeapon(player)) {
225 otherBonus *= 1.10;
226 }
227
228 if(FormulaUtils.berserkerNecklace(player) && FormulaUtils.hasObbyWeapon(player)) {
229 otherBonus *= 1.10;
230 }
231
232 if (player.getCombat().getFightType().getAttackType() == AttackType.CRUSH) {
233 if (player.getEquipment().hasAt(EquipSlot.HEAD, INQUISITORS_GREAT_HELM) || player.getEquipment().hasAt(EquipSlot.BODY, INQUISITORS_HAUBERK) || player.getEquipment().hasAt(EquipSlot.LEGS, INQUISITORS_PLATESKIRT)) {
234 otherBonus *= 1.05;
235 }
236 }
237
238 if(player.getEquipment().hasAt(EquipSlot.WEAPON, DRAGON_HUNTER_LANCE) && target != null && includeNpcMax) {
239 if(target.isNpc() && target.getAsNpc().id() == NpcIdentifiers.COMBAT_DUMMY) {
240 otherBonus *= 1.20;
241 }
242
243 if(FormulaUtils.isDragon(target)) {
244 otherBonus *= 1.20;
245 }
246 }
247
248 //• Gadderhammer: 1.25 or 2.0 vs shades
249 if(player.getEquipment().hasAt(EquipSlot.WEAPON, GADDERHAMMER)) {
250 if(target != null && target.isNpc()) {
251 NPC npc = target.getAsNpc();
252 NpcDefinition def = npc.def();
253 var isShade = def != null && def.name.equalsIgnoreCase("Shade");
254 otherBonus *= isShade ? 1.25 : 2.00;
255 }
256 }
257
258 if (FormulaUtils.hasViggorasChainMace(player) && target != null && target.isNpc() && includeNpcMax) {
259 otherBonus *= 1.50;
260 }*/
261
262 return otherBonus;
263 }
264
265 public static int getEffectiveStrength(Mob player) {
266 return (int) (Math.floor(((((getStrengthLevel(player)) * getPrayerBonus(player)) + getStyleBonus(player)) + 8) * getOtherBonus(player, true)));
267 }
268}
static double getOtherBonus(Mob player, boolean includeNpcMax)
abstract Combat<? extends Mob > getCombat()