RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
JaxXil.java
1package com.osroyale.content.activity.infernomobs;
2
3import com.osroyale.game.Animation;
4import com.osroyale.game.UpdatePriority;
5import com.osroyale.game.world.entity.combat.attack.FightType;
6import com.osroyale.game.world.entity.combat.hit.CombatHit;
7import com.osroyale.game.world.entity.combat.strategy.CombatStrategy;
8import com.osroyale.game.world.entity.combat.strategy.npc.MultiStrategy;
9import com.osroyale.game.world.entity.combat.strategy.npc.NpcMeleeStrategy;
10import com.osroyale.game.world.entity.combat.strategy.npc.NpcRangedStrategy;
11import com.osroyale.game.world.entity.mob.Mob;
12import com.osroyale.game.world.entity.mob.npc.Npc;
13
14import static com.osroyale.game.world.entity.combat.CombatUtil.createStrategyArray;
15import static com.osroyale.game.world.entity.combat.projectile.CombatProjectile.getDefinition;
16
45
46public class JaxXil extends MultiStrategy {
47
48 private static final Melee MELEE = new Melee();
49 private static final Ranged RANGED = new Ranged();
50
51 private static final CombatStrategy<Npc>[] STRATEGIES = createStrategyArray(RANGED, MELEE);
52
53 public JaxXil() {
54 currentStrategy = RANGED;
55 }
56
57 @Override
58 public boolean canAttack(Npc attacker, Mob defender) {
59 if (!currentStrategy.withinDistance(attacker, defender)) {
60 currentStrategy = MELEE;
61 }
62 return currentStrategy.canAttack(attacker, defender);
63 }
64
65 private static class Melee extends NpcMeleeStrategy {
66 private static final Animation ANIMATION = new Animation(7604, UpdatePriority.HIGH);
67
68 @Override
69 public int getAttackDistance(Npc attacker, FightType fightType) {
70 return 2;
71 }
72
73 @Override
74 public Animation getAttackAnimation(Npc attacker, Mob defender) {
75 return ANIMATION;
76 }
77
78 @Override
79 public CombatHit[] getHits(Npc attacker, Mob defender) {
80 return new CombatHit[] { nextMeleeHit(attacker, defender) };
81 }
82 }
83
84 private static class Ranged extends NpcRangedStrategy {
85
86 private static final Animation ANIMATION = new Animation(7605, UpdatePriority.HIGH);
87
88 private Ranged() {
89 super(getDefinition("xil"));
90 }
91
92 @Override
93 public Animation getAttackAnimation(Npc attacker, Mob defender) {
94 return ANIMATION;
95 }
96
97 @Override
98 public CombatHit[] getHits(Npc attacker, Mob defender) {
99 return new CombatHit[] { nextMagicHit(attacker, defender, 46) };
100 }
101 }
102}