RuneHive-Game
Loading...
Searching...
No Matches
Jalimkot.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.task.Task;
6import com.runehive.game.world.World;
7import com.runehive.game.world.entity.combat.hit.CombatHit;
8import com.runehive.game.world.entity.combat.hit.Hit;
9import com.runehive.game.world.entity.combat.strategy.npc.MultiStrategy;
10import com.runehive.game.world.entity.combat.strategy.npc.NpcMeleeStrategy;
11import com.runehive.game.world.entity.mob.Mob;
12import com.runehive.game.world.entity.mob.npc.Npc;
13
14public class Jalimkot extends MultiStrategy {
15
16 private static Melee MELEE = new Melee();
17 private static Burrow BURROW = new Burrow();
18
19 public Jalimkot() {
21 }
22
23 @Override
24 public boolean canAttack(Npc attacker, Mob defender) {
25 if (attacker.getPosition().isWithinDistance(defender.getPlayer().getPosition(), 5)) {
27 } else {
29 }
30 return currentStrategy.canAttack(attacker, defender);
31 }
32
33 private static class Burrow extends NpcMeleeStrategy {
34 private static final Animation ANIMATION = new Animation(7600, UpdatePriority.HIGH);
35
36 @Override
37 public void start(Npc attacker, Mob defender, Hit[] hits) {
38 attacker.animate(ANIMATION, true);
39 World.schedule(new Task(true, 1) {
40 int tick = 0;
41
42 @Override
43 protected void execute() {
44 tick++;
45 if (tick >= 3) {
46 // attacker.move(defender.getPosition().addX(1));
47 attacker.animate(7601);
48 }
49 }
50 });
51 }
52
53 @Override
54 public CombatHit[] getHits(Npc attacker, Mob defender) {
55 return new CombatHit[] { nextMeleeHit(attacker, defender, 49) };
56 }
57 }
58
59 private static class Melee extends NpcMeleeStrategy {
60 private static final Animation ANIMATION = new Animation(7597, UpdatePriority.HIGH);
61
62 @Override
63 public Animation getAttackAnimation(Npc attacker, Mob defender) {
64 return ANIMATION;
65 }
66
67 @Override
68 public CombatHit[] getHits(Npc attacker, Mob defender) {
69 return new CombatHit[] { nextMeleeHit(attacker, defender, 49) };
70 }
71 }
72}
void start(Npc attacker, Mob defender, Hit[] hits)
Definition Jalimkot.java:37
CombatHit[] getHits(Npc attacker, Mob defender)
Definition Jalimkot.java:54
Animation getAttackAnimation(Npc attacker, Mob defender)
Definition Jalimkot.java:63
CombatHit[] getHits(Npc attacker, Mob defender)
Definition Jalimkot.java:68
boolean canAttack(Npc attacker, Mob defender)
Definition Jalimkot.java:24
Class that models a single animation used by an entity.
A game representing a cyclic unit of work.
Definition Task.java:11
Represents the game world.
Definition World.java:46
static void schedule(Task task)
Submits a new event.
Definition World.java:247
A wrapper for a Hit object, adding additional variables for hit and hitsplat delays.
A Hit object holds the damage amount and hitsplat data.
Definition Hit.java:10
Handles the mob class.
Definition Mob.java:66
Represents a non-player character in the in-game world.
Definition Npc.java:29
boolean isWithinDistance(Position other, int radius)
Checks if this location is within range of another.
Represents different priorities for updating.