RuneHive-Game
Loading...
Searching...
No Matches
TwistedBowListener.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.combat.attack.listener.item;
2
3import com.runehive.game.world.entity.combat.attack.listener.ItemCombatListenerSignature;
4import com.runehive.game.world.entity.combat.attack.listener.SimplifiedListener;
5import com.runehive.game.world.entity.mob.Mob;
6import com.runehive.game.world.entity.mob.player.Player;
7import com.runehive.game.world.entity.skill.Skill;
8
9/**
10 * Handles the twisted bow modifiers.
11 * @author Michael | Chex
12 */
13@ItemCombatListenerSignature(requireAll = false, items = {20997})
15
16 @Override
17 public int modifyAccuracy(Player attacker, Mob defender, int roll) {
18 int level = defender.skills.getMaxLevel(Skill.MAGIC);
19 if (level > 360) level = 360;
20 int a = (3 * level) / 10 - 100;
21 int mod = 140 + (3 * level - 10) / 100 - (a * a) / 100;
22 if (mod > 140) mod = 140;
23 return roll * mod / 100;
24 }
25
26 @Override
27 public int modifyDamage(Player attacker, Mob defender, int roll) {
28 int level = defender.skills.getMaxLevel(Skill.MAGIC);
29 if (level > 360) level = 360;
30 int a = (3 * level) / 10 - 140;
31 int mod = 250 + (3 * level - 14) / 100 - (a * a) / 100;
32 if (mod > 250) mod = 250;
33 return roll * mod / 100;
34 }
35
36}
Handles the mob class.
Definition Mob.java:66
This class represents a character controlled by a player.
Definition Player.java:125
Represents a trainable and usable skill.
Definition Skill.java:18
static final int MAGIC
The magic skill id.
Definition Skill.java:39
int getMaxLevel(int id)
Gets the highest possible level of a skill.