RuneHive-Game
Loading...
Searching...
No Matches
ZaryteCrossbow.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.combat.strategy.player.special.range;
2
3import com.runehive.game.Animation;
4import com.runehive.game.Projectile;
5import com.runehive.game.UpdatePriority;
6import com.runehive.game.world.entity.combat.accuracy.RangeAccuracy;
7import com.runehive.game.world.entity.combat.hit.CombatHit;
8import com.runehive.game.world.entity.combat.projectile.CombatProjectile;
9import com.runehive.game.world.entity.combat.strategy.player.PlayerRangedStrategy;
10import com.runehive.game.world.entity.mob.Mob;
11import com.runehive.game.world.entity.mob.player.Player;
12
13/**
14 * Handles the magic shortbow weapon special attack.
15 *
16 * @author Daniel
17 * @author Michaael | Chex
18 */
20
21 private static final ZaryteCrossbow INSTANCE = new ZaryteCrossbow();
22 private static final Animation ANIMATION = new Animation(9166, UpdatePriority.HIGH);
23 private static Projectile PROJECTILE;
24
25 static {
26 try {
28 } catch (Exception e) {
29 e.printStackTrace();
30 }
31 }
32
33 private ZaryteCrossbow() {
34 }
35
36 @Override
37 protected void sendStuff(Player attacker, Mob defender) {
38 attacker.animate(ANIMATION, true);
39 PROJECTILE.send(attacker, defender);
40 }
41
42 @Override
43 public CombatHit[] getHits(Player attacker, Mob defender) {
44 return new CombatHit[]{nextRangedHit(attacker, defender)};
45 }
46
47
48 /*
49 Handles x2 accuracy https://oldschool.runescape.wiki/w/Zaryte_crossbow
50 */
51 @Override
52 public int modifyAccuracy(Player attacker, Mob defender, int roll) {
53 return (int) (2 * RangeAccuracy.getAttackRoll(attacker));
54 }
55
57 if (!projectile.getProjectile().isPresent())
58 throw new NullPointerException("No Magic Shortbow projectile found.");
59 PROJECTILE = projectile.getProjectile().get();
60 }
61
62 public static ZaryteCrossbow get() {
63 return INSTANCE;
64 }
65
66}
Class that models a single animation used by an entity.
A wrapper for a Hit object, adding additional variables for hit and hitsplat delays.
final CombatHit nextRangedHit(T attacker, Mob defender)
Handles the mob class.
Definition Mob.java:66
This class represents a character controlled by a player.
Definition Player.java:125
Represents different priorities for updating.