RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Jalimkot.java
1package com.osroyale.content.activity.infernomobs;
2
3import com.osroyale.game.Animation;
4import com.osroyale.game.UpdatePriority;
5import com.osroyale.game.task.Task;
6import com.osroyale.game.world.World;
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.npc.MultiStrategy;
10import com.osroyale.game.world.entity.combat.strategy.npc.NpcMeleeStrategy;
11import com.osroyale.game.world.entity.mob.Mob;
12import com.osroyale.game.world.entity.mob.npc.Npc;
13
39
40public class Jalimkot extends MultiStrategy {
41
42 private static Melee MELEE = new Melee();
43 private static Burrow BURROW = new Burrow();
44
45 public Jalimkot() {
46 currentStrategy = MELEE;
47 }
48
49 @Override
50 public boolean canAttack(Npc attacker, Mob defender) {
51 if (attacker.getPosition().isWithinDistance(defender.getPlayer().getPosition(), 5)) {
52 currentStrategy = BURROW;
53 } else {
54 currentStrategy = MELEE;
55 }
56 return currentStrategy.canAttack(attacker, defender);
57 }
58
59 private static class Burrow extends NpcMeleeStrategy {
60 private static final Animation ANIMATION = new Animation(7600, UpdatePriority.HIGH);
61
62 @Override
63 public void start(Npc attacker, Mob defender, Hit[] hits) {
64 attacker.animate(ANIMATION, true);
65 World.schedule(new Task(true, 1) {
66 int tick = 0;
67
68 @Override
69 protected void execute() {
70 tick++;
71 if (tick >= 3) {
72 // attacker.move(defender.getPosition().addX(1));
73 attacker.animate(7601);
74 }
75 }
76 });
77 }
78
79 @Override
80 public CombatHit[] getHits(Npc attacker, Mob defender) {
81 return new CombatHit[] { nextMeleeHit(attacker, defender, 49) };
82 }
83 }
84
85 private static class Melee extends NpcMeleeStrategy {
86 private static final Animation ANIMATION = new Animation(7597, UpdatePriority.HIGH);
87
88 @Override
89 public Animation getAttackAnimation(Npc attacker, Mob defender) {
90 return ANIMATION;
91 }
92
93 @Override
94 public CombatHit[] getHits(Npc attacker, Mob defender) {
95 return new CombatHit[] { nextMeleeHit(attacker, defender, 49) };
96 }
97 }
98}
static void schedule(Task task)
Definition World.java:284
boolean isWithinDistance(Position other, int radius)