RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Blowpipe.java
1package com.osroyale.game.world.entity.combat.strategy.player.special.range;
2
3import com.osroyale.game.Animation;
4import com.osroyale.game.Projectile;
5import com.osroyale.game.world.entity.combat.CombatType;
6import com.osroyale.game.world.entity.combat.attack.FightType;
7import com.osroyale.game.world.entity.combat.hit.CombatHit;
8import com.osroyale.game.world.entity.combat.hit.Hit;
9import com.osroyale.game.world.entity.combat.strategy.basic.RangedStrategy;
10import com.osroyale.game.world.entity.combat.strategy.player.custom.ToxicBlowpipeStrategy;
11import com.osroyale.game.world.entity.mob.Mob;
12import com.osroyale.game.world.entity.mob.player.Player;
13import com.osroyale.game.world.entity.mob.player.PlayerRight;
14
15public class Blowpipe extends RangedStrategy<Player> {
16 private static final Blowpipe INSTANCE = new Blowpipe();
17 private static final Projectile SPECIAL_PROJ = new Projectile(1043);
18
19 @Override
20 public boolean canAttack(Player attacker, Mob defender) {
21 return ToxicBlowpipeStrategy.get().canAttack(attacker, defender);
22 }
23
24 @Override
25 public void start(Player attacker, Mob defender, Hit[] hits) {
26 attacker.animate(getAttackAnimation(attacker, defender), true);
27 SPECIAL_PROJ.send(attacker, defender);
28
29 if (!defender.isPlayer() || !PlayerRight.isIronman(attacker)) {
30 addCombatExperience(attacker, hits);
31 }
32
33 attacker.getCombatSpecial().drain(attacker);
34 for (Hit hit : hits) {
35 attacker.heal((int) Math.floor(hit.getDamage() / 2));
36 }
37 }
38
39 @Override
40 public void attack(Player attacker, Mob defender, Hit hit) {
41 ToxicBlowpipeStrategy.get().attack(attacker, defender, hit);
42 }
43
44 @Override
45 public Animation getAttackAnimation(Player attacker, Mob defender) {
46 return ToxicBlowpipeStrategy.get().getAttackAnimation(attacker, defender);
47 }
48
49 @Override
50 public int getAttackDelay(Player attacker, Mob defender, FightType fightType) {
51 return ToxicBlowpipeStrategy.get().getAttackDelay(attacker, defender, fightType);
52 }
53
54 @Override
55 public int getAttackDistance(Player attacker, FightType fightType) {
56 return ToxicBlowpipeStrategy.get().getAttackDistance(attacker, fightType);
57 }
58
59 @Override
60 public CombatHit[] getHits(Player attacker, Mob defender) {
61 return new CombatHit[]{nextRangedHit(attacker, defender)};
62 }
63
64 @Override
65 public CombatType getCombatType() {
66 return CombatType.RANGED;
67 }
68
69 public static Blowpipe get() {
70 return INSTANCE;
71 }
72
73}