RuneHive-Game
Loading...
Searching...
No Matches
JaxXil.java
Go to the documentation of this file.
1package com.runehive.content.activity.infernomobs;
2
3import com.runehive.game.Animation;
4import com.runehive.game.UpdatePriority;
5import com.runehive.game.world.entity.combat.attack.FightType;
6import com.runehive.game.world.entity.combat.hit.CombatHit;
7import com.runehive.game.world.entity.combat.strategy.CombatStrategy;
8import com.runehive.game.world.entity.combat.strategy.npc.MultiStrategy;
9import com.runehive.game.world.entity.combat.strategy.npc.NpcMeleeStrategy;
10import com.runehive.game.world.entity.combat.strategy.npc.NpcRangedStrategy;
11import com.runehive.game.world.entity.mob.Mob;
12import com.runehive.game.world.entity.mob.npc.Npc;
13
14import static com.runehive.game.world.entity.combat.CombatUtil.createStrategyArray;
15import static com.runehive.game.world.entity.combat.projectile.CombatProjectile.getDefinition;
16
17public class JaxXil extends MultiStrategy {
18
19 private static final Melee MELEE = new Melee();
20 private static final Ranged RANGED = new Ranged();
21
22 private static final CombatStrategy<Npc>[] STRATEGIES = createStrategyArray(RANGED, MELEE);
23
24 public JaxXil() {
26 }
27
28 @Override
29 public boolean canAttack(Npc attacker, Mob defender) {
30 if (!currentStrategy.withinDistance(attacker, defender)) {
32 }
33 return currentStrategy.canAttack(attacker, defender);
34 }
35
36 private static class Melee extends NpcMeleeStrategy {
37 private static final Animation ANIMATION = new Animation(7604, UpdatePriority.HIGH);
38
39 @Override
40 public int getAttackDistance(Npc attacker, FightType fightType) {
41 return 2;
42 }
43
44 @Override
45 public Animation getAttackAnimation(Npc attacker, Mob defender) {
46 return ANIMATION;
47 }
48
49 @Override
50 public CombatHit[] getHits(Npc attacker, Mob defender) {
51 return new CombatHit[] { nextMeleeHit(attacker, defender) };
52 }
53 }
54
55 private static class Ranged extends NpcRangedStrategy {
56
57 private static final Animation ANIMATION = new Animation(7605, UpdatePriority.HIGH);
58
59 private Ranged() {
60 super(getDefinition("xil"));
61 }
62
63 @Override
64 public Animation getAttackAnimation(Npc attacker, Mob defender) {
65 return ANIMATION;
66 }
67
68 @Override
69 public CombatHit[] getHits(Npc attacker, Mob defender) {
70 return new CombatHit[] { nextMagicHit(attacker, defender, 46) };
71 }
72 }
73}
CombatHit[] getHits(Npc attacker, Mob defender)
Definition JaxXil.java:50
Animation getAttackAnimation(Npc attacker, Mob defender)
Definition JaxXil.java:45
int getAttackDistance(Npc attacker, FightType fightType)
Definition JaxXil.java:40
Animation getAttackAnimation(Npc attacker, Mob defender)
Definition JaxXil.java:64
CombatHit[] getHits(Npc attacker, Mob defender)
Definition JaxXil.java:69
boolean canAttack(Npc attacker, Mob defender)
Definition JaxXil.java:29
static final CombatStrategy< Npc >[] STRATEGIES
Definition JaxXil.java:22
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 nextMagicHit(T attacker, Mob defender)
Handles the mob class.
Definition Mob.java:66
Represents a non-player character in the in-game world.
Definition Npc.java:29
Represents different priorities for updating.
The enumerated type whose elements represent the fighting types.