RuneHive-Game
Loading...
Searching...
No Matches
Mob.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.mob;
2
3import com.runehive.content.activity.Activity;
4import com.runehive.content.activity.ActivityType;
5import com.runehive.content.wintertodt.Wintertodt;
6import com.runehive.fs.cache.decoder.AnimationDefinition;
7import com.runehive.fs.cache.decoder.AnimationDefinitionDecoder;
8import com.runehive.game.Animation;
9import com.runehive.game.Graphic;
10import com.runehive.game.action.ActionManager;
11import com.runehive.game.task.impl.ForceMovementTask;
12import com.runehive.game.world.Interactable;
13import com.runehive.game.world.World;
14import com.runehive.game.world.entity.Entity;
15import com.runehive.game.world.entity.EntityType;
16import com.runehive.game.world.entity.combat.Combat;
17import com.runehive.game.world.entity.combat.CombatUtil;
18import com.runehive.game.world.entity.combat.PoisonType;
19import com.runehive.game.world.entity.combat.attack.listener.CombatListener;
20import com.runehive.game.world.entity.combat.attack.listener.CombatListenerManager;
21import com.runehive.game.world.entity.combat.effect.CombatEffectType;
22import com.runehive.game.world.entity.combat.hit.Hit;
23import com.runehive.game.world.entity.combat.strategy.CombatStrategy;
24import com.runehive.game.world.entity.combat.strategy.npc.NpcMeleeStrategy;
25import com.runehive.game.world.entity.mob.data.LockType;
26import com.runehive.game.world.entity.mob.movement.Movement;
27import com.runehive.game.world.entity.mob.movement.waypoint.CombatWaypoint;
28import com.runehive.game.world.entity.mob.movement.waypoint.FollowWaypoint;
29import com.runehive.game.world.entity.mob.movement.waypoint.WalkToWaypoint;
30import com.runehive.game.world.entity.mob.movement.waypoint.Waypoint;
31import com.runehive.game.world.entity.mob.npc.Npc;
32import com.runehive.game.world.entity.mob.npc.NpcAssistant;
33import com.runehive.game.world.entity.mob.npc.NpcUtility;
34import com.runehive.game.world.entity.mob.npc.definition.NpcDefinition;
35import com.runehive.game.world.entity.mob.player.ForceMovement;
36import com.runehive.game.world.entity.mob.player.Player;
37import com.runehive.game.world.entity.mob.player.relations.ChatMessage;
38import com.runehive.game.world.entity.mob.prayer.PrayerBook;
39import com.runehive.game.world.entity.skill.Skill;
40import com.runehive.game.world.entity.skill.SkillManager;
41import com.runehive.game.world.object.GameObject;
42import com.runehive.game.world.pathfinding.TraversalMap;
43import com.runehive.game.world.position.Position;
44import com.runehive.net.packet.out.SendPoison;
45import com.runehive.util.MutableNumber;
46import com.runehive.util.Stopwatch;
47import com.runehive.util.Utility;
48import com.runehive.util.generic.BooleanInterface;
49import com.runehive.util.generic.GenericAttributes;
50
51import java.util.EnumSet;
52import java.util.LinkedList;
53import java.util.List;
54import java.util.Optional;
55import java.util.concurrent.TimeUnit;
56import java.util.function.Function;
57
58import static com.runehive.game.world.entity.combat.CombatConstants.EMPTY_BONUSES;
59
60/**
61 * Handles the mob class.
62 *
63 * @author Daniel
64 * @author Chex
65 */
66public abstract class Mob extends Entity {
67
68 public boolean pathfinderProjectiles = false;
69 private int listIndex;
70 public int id = -1;
71 private int transformId;
72 private boolean dead;
73 public boolean regionChange;
74 public boolean positionChange;
75 public boolean forceWalking;
76 public boolean teleporting;
77 public boolean inTeleport;
78 public boolean teleportRegion;
79 public boolean blockFace;
80 public boolean blockInteract;
81 public String forceChat;
83 public Hit firstHit;
84 public Hit secondHit;
89 private Optional<Animation> animation = Optional.empty();
90 public transient long nextAnimation;
91 private Optional<Graphic> graphic = Optional.empty();
92 public List<Mob> followers = new LinkedList<>();
94 public final EnumSet<UpdateFlag> updateFlags = EnumSet.noneOf(UpdateFlag.class);
96 public final SkillManager skills = new SkillManager(this);
97 public final SkillManager skills_copy = new SkillManager(this);
98 public final Movement movement = new Movement(this);
103 private int[] bonuses = EMPTY_BONUSES;
106 public final Locking locking = new Locking(this);
110
111 /**
112 * Constructs a new <code>Mob</code>.
113 */
115 super(position);
116 this.lastPosition = position.copy();
117 }
118
119 public Mob(Position position, boolean visible) {
120 super(position, visible);
121 this.lastPosition = position.copy();
122 }
123
124 /**
125 * Sets the mob's forced chat.
126 */
127 public void speak(String forceChat) {
128 if (forceChat == null || forceChat.isEmpty() || forceChat.length() > ChatMessage.CHARACTER_LIMIT)
129 return;
130 this.forceChat = forceChat;
131 this.updateFlags.add(UpdateFlag.FORCED_CHAT);
132 }
133
134 public void animate(int animation) {
135 animate(animation, false);
136 }
137
138 public void animate(int animation, boolean override) {
139 animate(new Animation(animation), override);
140 }
141
142 /**
143 * Plays an animation.
144 */
146 animate(animation, false);
147 }
148
149 public void graphic(int graphic) {
150 graphic(new Graphic(graphic));
151 }
152
153 /**
154 * Plays a graphic.
155 */
156 public void graphic(Graphic graphic) {
157 graphic(graphic, false);
158 }
159
160 /**
161 * Plays an animation.
162 */
163 public void animate(Animation animation, final boolean override) {
164 final long now = System.currentTimeMillis();
165 if (!override && (nextAnimation > now || updateFlags.contains(UpdateFlag.ANIMATION))) {
166 return;
167 }
168
169 final Optional<Animation> result = Optional.ofNullable(animation);
170 animation = result.orElse(Animation.RESET);
171
172 final AnimationDefinition definition =
174 ? null
176 if (definition != null) {
177 nextAnimation = now + definition.durationTime + 600;
178 }
179 this.animation = result;
180 this.updateFlags.add(UpdateFlag.ANIMATION);
181 }
182
183 /**
184 * Plays a graphic.
185 */
186 public void graphic(Graphic graphic, boolean override) {
187 Optional<Graphic> result = Optional.ofNullable(graphic);
188 graphic = result.orElse(Graphic.RESET);
189
190 if (!this.graphic.isPresent() || override || this.graphic.get().compareTo(graphic) > 0) {
191 this.graphic = result;
192 this.updateFlags.add(UpdateFlag.GRAPHICS);
193 }
194 }
195
196 public static boolean pathfinderProjectiles(Mob source) {
197 final String name = source.getName().toLowerCase();
198 return "imp".equals(name) || name.contains("impling");
199 }
200
201 public void transform(int transformId) {
202 transform(transformId, false);
203 }
204
205 /**
206 * Transforms the mob.
207 */
208 public void transform(int transformId, boolean reload) {
209 this.transformId = transformId;
210 this.id = transformId;
211 this.updateFlags.add(UpdateFlag.TRANSFORM);
212 this.updateFlags.add(UpdateFlag.APPEARANCE);
213
214 if (isNpc()) {
215 NpcDefinition definition = NpcDefinition.get(id);
216 final Npc npc = getNpc();
217 npc.definition = definition;
218 npc.pathfinderProjectiles = Mob.pathfinderProjectiles(npc);
219 setWidth(definition.getSize());
220 setLength(definition.getSize());
221 setBonuses(definition.getBonuses());
222 mobAnimation.setNpcAnimations(definition);
223
224 if (reload) {
227
228 if (listener != null) {
229 combat.addListener(listener);
230 }
231
233 getNpc().setStrategy(NpcUtility.STRATEGIES.getOrDefault(getNpc().id, () -> NpcAssistant.loadStrategy(getNpc()).orElse(NpcMeleeStrategy.get())).get());
234 }
235 }
236 }
237
238 /**
239 * Resets the mob after an update.
240 */
241 public final void reset() {
243 resetGraphic();
244 }
245
246 /**
247 * Resets the waypoint
248 */
249 public final void resetWaypoint() {
250 if (cachedWaypoint != null && cachedWaypoint.isRunning()) {
251 cachedWaypoint.cancel();
252 }
253 }
254
255 public void forceMove(int animation, int x, int y) {
256 forceMove(0, 0, animation, 0, 0, 0, new Position(x, y), Direction.NORTH);
257 }
258
259 public void forceMove(int delay, int animation, int startSpeed, int endSpeed, Position offset, Direction direction) {
260 forceMove(delay, 0, animation, startSpeed, endSpeed, offset, direction);
261 }
262
263 public void forceMove(int delay, int delay2, int animation, int startSpeed, int endSpeed, Position offset, Direction direction) {
264 forceMove(delay, delay2, animation, 0, startSpeed, endSpeed, offset, direction);
265 }
266
267 /**
268 * Creates a force movement action for an entity.
269 */
270 public void forceMove(int delay, int delay2, int animation, int animationDelay, int startSpeed, int endSpeed, Position offset, Direction direction) {
271 ForceMovement movement = new ForceMovement(getPosition().copy(), offset, startSpeed, endSpeed, direction);
272 World.schedule(new ForceMovementTask(this, delay, delay2, movement, new Animation(animation, animationDelay)));
273 }
274
275 /**
276 * Sets the mob interacting with another mob.
277 */
278 public void interact(Mob mob) {
279 if (blockInteract) {
280 return;
281 }
282 this.interactingWith = mob;
283 this.updateFlags.add(UpdateFlag.INTERACT);
284 }
285
286 /**
287 * Sets the client update flag to face a certain direction.
288 */
289 public void face(GameObject object) {
290 if (blockFace)
291 return;
292 if (object == null || object.getPosition().equals(facePosition))
293 return;
294 this.facePosition = object.getPosition();
295 this.updateFlags.add(UpdateFlag.FACE_COORDINATE);
296 }
297
298 public void face(Mob mob) {
299 face(mob.getPosition());
300 }
301
302 /**
303 * Sets the client update flag to face a certain direction.
304 */
305 public void face(Position position) {
306 if (blockFace)
307 return;
308 if (!position.equals(facePosition)) {
309 this.facePosition = position;
310 this.updateFlags.add(UpdateFlag.FACE_COORDINATE);
311 }
312 }
313
314 /**
315 * Sets the client update flag to face a certain direction.
316 */
317 public void face(Direction direction) {
318 if (blockFace)
319 return;
321 if (!position.equals(facePosition)) {
322 this.facePosition = position;
323 this.updateFlags.add(UpdateFlag.FACE_COORDINATE);
324 }
325 }
326
327 /**
328 * Resets the mob's face location.
329 */
330 public void resetFace() {
331 if (blockFace || interactingWith == null)
332 return;
333 interactingWith = null;
334 this.updateFlags.add(UpdateFlag.INTERACT);
335 }
336
337 /**
338 * Moves the mob to a set position.
339 */
340 public void move(Position position) {
341 if (regionChange)
342 return;
343 if (isPlayer() && !getPlayer().interfaceManager.isClear())
347 regionChange = true;
348 } else {
349 positionChange = true;
350 }
351 teleportRegion = true;
352 getCombat().reset();
353 resetFace();
354 locking.lock(599, TimeUnit.MILLISECONDS, LockType.MASTER);
355 onStep();
356 }
357
358 public void walk(Position position) {
359 walk(position, false);
360 }
361
362 public void walk(Position destination, boolean ignoreClip) {
363 if (ignoreClip) {
364 movement.walk(destination);
365 } else {
366 movement.simplePath(destination);
367 }
368 }
369
370 public void runTo(Position destination) {
371 movement.dijkstraPath(destination);
372 }
373
374 public void walkTo(Position position) {
375 getCombat().reset();
376 walkTo(position, () -> { /* Do nothing on arrival */ });
377 }
378
379 public void walkTo(Position position, Runnable onDestination) {
381 walkTo(interactable, onDestination);
382 }
383
385 walkExactlyTo(position, () -> {
386 });
387 }
388
389 public void walkExactlyTo(Position position, Runnable onDestination) {
390 Interactable interactable = Interactable.create(position, 0, 0);
391 walkTo(interactable, onDestination);
392 }
393
394 public void walkTo(Interactable target, Runnable onDestination) {
395 walkTo(target, true, onDestination);
396 }
397
398 public void walkTo(Interactable target, boolean clearAction, Runnable onDestination) {
399 Waypoint waypoint = new WalkToWaypoint(this, target, onDestination);
400
401 if (cachedWaypoint == null || (!cachedWaypoint.isRunning() || !waypoint.equals(cachedWaypoint))) {
403 getCombat().reset();
404 movement.reset();
405
406 if (clearAction) {
407 action.clearNonWalkableActions();
408 }
409
410 World.schedule(cachedWaypoint = waypoint);
411 }
412 }
413
414 public void follow(Mob target) {
415 Waypoint waypoint = new FollowWaypoint(this, target);
416 if (cachedWaypoint == null || (!cachedWaypoint.isRunning() || !waypoint.equals(cachedWaypoint))) {
418 movement.reset();
419 action.clearNonWalkableActions();
420 World.schedule(cachedWaypoint = waypoint);
421 }
422 }
423
424 public void attack(Mob target) {
425 Waypoint waypoint = new CombatWaypoint(this, target);
426 if (cachedWaypoint == null || (!cachedWaypoint.isRunning() || !waypoint.equals(cachedWaypoint))) {
428 movement.reset();
429 action.clearNonWalkableActions();
430 World.schedule(cachedWaypoint = waypoint);
431 }
432 }
433
434 protected void setWaypoint(Waypoint waypoint) {
435 if (cachedWaypoint == null || (!cachedWaypoint.isRunning() || !waypoint.equals(cachedWaypoint))) {
437 movement.reset();
438 action.clearNonWalkableActions();
439 World.schedule(cachedWaypoint = waypoint);
440 }
441 }
442
443 public void damage(Hit... hits) {
444 for (Hit hit : hits)
445 getCombat().queueDamage(hit);
446 }
447
448 public void writeFakeDamage(Hit hit) {
449 if (!updateFlags.contains(UpdateFlag.FIRST_HIT)) {
450 firstHit = hit;
452 } else {
453 secondHit = hit;
455 }
456 }
457
458 public void writeDamage(Hit hit) {
459 if (isDead() || getCurrentHealth() < 1) {
460 return;
461 }
462
463 if (!damageImmunity.finished()) {
464 return;
465 }
466
467 getCombat().onDamage(hit);
468
469 if (!updateFlags.contains(UpdateFlag.FIRST_HIT)) {
472 } else {
475 }
476 }
477
478 public Hit decrementHealth(Hit hit) {
479 if (getCurrentHealth() - hit.getDamage() < 0)
481 skills.modifyLevel(level -> level - hit.getDamage(), Skill.HITPOINTS, 0, getCurrentHealth());
482 skills.refresh(Skill.HITPOINTS);
483 if (getCurrentHealth() < 1)
484 appendDeath();
485
486 return hit;
487 }
488
489 public void heal(int amount) {
490 int health = getCurrentHealth();
491 if (health >= getMaximumHealth())
492 return;
493 skills.modifyLevel(hp -> health + amount, Skill.HITPOINTS, 0, getMaximumHealth());
494 skills.refresh(Skill.HITPOINTS);
495 }
496
497 /**
498 * Applies poison with an intensity of {@code type} to the entity.
499 */
500 public void poison(PoisonType type) {
501 poisonType = type;
503 }
504
505 /**
506 * Applies venom to the entity.
507 */
508 public void venom() {
510 }
511
513 this.forceMovement = forceMovement;
514 if (forceMovement != null)
515 this.updateFlags.add(UpdateFlag.FORCE_MOVEMENT);
516 }
517
518 public boolean inActivity() {
519 return activity != null;
520 }
521
522 public boolean inActivity(ActivityType type) {
523 return inActivity() && activity.getType() == type;
524 }
525
527 if (this.activity != null) {
528 this.activity.cleanup();
529 }
530 this.activity = activity;
531 }
532
533 /**
534 * Resets the teleport target.
535 */
536 public void clearTeleportTarget() {
537 this.teleportTarget = null;
538 }
539
540 /**
541 * Checks if mob requires an update.
542 */
543 public boolean isUpdateRequired() {
544 return !updateFlags.isEmpty();
545 }
546
547 /**
548 * Check if an entity is an npc.
549 */
550 public final boolean isNpc() {
551 return getType() == EntityType.NPC;
552 }
553
554 /**
555 * Check if an entity is an npc.
556 */
557 public final boolean isNpc(BooleanInterface<Npc> condition) {
558 return getType() == EntityType.NPC && condition.activated(getNpc());
559 }
560
561 /**
562 * Check if an entity is a player
563 */
564 public final boolean isPlayer() {
565 return getType() == EntityType.PLAYER;
566 }
567
568 public final Npc getNpc() {
569 return (Npc) this;
570 }
571
572 /**
573 * Check if an entity is a player
574 */
575 public final boolean isPlayer(Function<Player, Boolean> condition) {
576 return getType() == EntityType.PLAYER && condition.apply(getPlayer());
577 }
578
579 public void takeStep() {
581
583 walkTo = walkTo.west();
585 walkTo = walkTo.east();
587 walkTo = walkTo.north();
589 walkTo = walkTo.south();
590 }
591
592 if (!getPosition().equals(walkTo)) {
593 movement.walkTo(walkTo);
594 }
595 }
596
598 return forceMovement;
599 }
600
601 public void unpoison() {
602 poisonDamage.set(0);
603 poisonType = null;
604
605 if (this instanceof Player) {
606 Player player = (Player) this;
608 }
609 }
610
611 public void unvenom() {
612 venomDamage.set(0);
613
614 if (this instanceof Player) {
615 Player player = (Player) this;
617 }
618 }
619
620 public final boolean isPoisoned() {
621 return poisonDamage.get() > 0;
622 }
623
624 public final boolean isVenomed() {
625 return venomDamage.get() > 0;
626 }
627
629 return poisonDamage;
630 }
631
633 return venomDamage;
634 }
635
637 return poisonType;
638 }
639
640 public boolean isDead() {
641 return dead;
642 }
643
644 public void setDead(boolean dead) {
645 this.dead = dead;
646 }
647
648 public final Player getPlayer() {
649 return (Player) this;
650 }
651
652 public int getCurrentHealth() {
653 if (isNpc()) {
654 Npc npc = (Npc) this;
655 switch (npc.id) {
657 return npc.pyroHealth;
658 }
659 }
660 }
661 return skills.getLevel(Skill.HITPOINTS);
662 }
663
664 public int getMaximumHealth() {
665 if (isNpc()) {
666 Npc npc = (Npc) this;
667 switch (npc.id) {
669 return 24;
670 }
671 }
672 }
673 return skills.getMaxLevel(Skill.HITPOINTS);
674 }
675
676 public int[] getBonuses() {
677 return bonuses;
678 }
679
680 public int getBonus(int index) {
681 return bonuses[index];
682 }
683
684 public void setBonuses(int[] bonuses) {
685 this.bonuses = bonuses;
686 }
687
688 public void appendBonus(int index, int amount) {
689 if (bonuses == EMPTY_BONUSES)
690 bonuses = new int[EMPTY_BONUSES.length];
691 bonuses[index] += amount;
692 }
693
694 public void setBonus(int equipSlot, int bonus) {
695 if (bonuses == EMPTY_BONUSES)
696 bonuses = new int[EMPTY_BONUSES.length];
697 bonuses[equipSlot] = bonus;
698 }
699
700 public int getListIndex() {
701 return listIndex;
702 }
703
704 public void setListIndex(int listIndex) {
705 this.listIndex = listIndex;
706 }
707
708 public Optional<Animation> getAnimation() {
709 return animation;
710 }
711
712 public Optional<Graphic> getGraphic() {
713 return graphic;
714 }
715
716 public void resetAnimation() {
717 this.animation = Optional.empty();
718 }
719
720 public void resetGraphic() {
721 this.graphic = Optional.empty();
722 }
723
724 /**
725 * The method which is invoked every tick.
726 */
727 public abstract void sequence();
728
729 /**
730 * State of the mob's auto retaliate.
731 */
732 public abstract boolean isAutoRetaliate();
733
734 /**
735 * Handles the mob death.
736 */
737 protected abstract void appendDeath();
738
739 /**
740 * The combat strategy of the mob.
741 */
742 public abstract <T extends Mob> CombatStrategy<? super T> getStrategy();
743
744 /**
745 * The combat of the mob.
746 */
748
749 private boolean fixingInside;
750
751 public boolean isFixingInside() {
752 return fixingInside;
753 }
754
755 public void setFixingInside(boolean fixingInside) {
756 this.fixingInside = fixingInside;
757 }
758
759 public int getPriorityIndex() {
760 return getListIndex();
761 }
762
763 public boolean hasPriorityIndex(Mob other) {
764 return getPriorityIndex() < other.getPriorityIndex();
765 }
766
767 public int getId() {
768 return id;
769 }
770
771 public int getTransformId() {
772 return transformId;
773 }
774
775}
A Activity object constructs an in-game activity and sequences it through the start() and finish() me...
Definition Activity.java:31
abstract void cleanup()
Cleans up the activity when finished.
static final Int2ObjectMap< AnimationDefinition > definitions
Class that models a single animation used by an entity.
static final Animation RESET
Represents a single graphic that can be used by entities.
Definition Graphic.java:10
static final Graphic RESET
Definition Graphic.java:17
int compareTo(Graphic other)
Definition Graphic.java:204
The class which manages Actions executed by mobs.
Represents the game world.
Definition World.java:46
static void schedule(Task task)
Submits a new event.
Definition World.java:247
abstract EntityType getType()
Gets the EntityType.
abstract String getName()
Gets the name of this entity.
abstract boolean equals(Object obj)
void setPosition(Position position)
Definition Entity.java:106
A collection of util methods and constants related to combat.
static boolean effect(Mob mob, CombatEffectType effect)
Applies the effect in any context.
A Hit object holds the damage amount and hitsplat data.
Definition Hit.java:10
int getDamage()
Gets the damage amount.
Definition Hit.java:121
void modifyDamage(Function< Integer, Integer > modifier)
Sets the hit damage with a function.
Definition Hit.java:108
Optional< Graphic > getGraphic()
Definition Mob.java:712
Optional< Animation > animation
Definition Mob.java:89
void appendBonus(int index, int amount)
Definition Mob.java:688
abstract< T extends Mob > CombatStrategy<? super T > getStrategy()
The combat strategy of the mob.
void poison(PoisonType type)
Applies poison with an intensity of type to the entity.
Definition Mob.java:500
void graphic(Graphic graphic, boolean override)
Plays a graphic.
Definition Mob.java:186
final MutableNumber getPoisonDamage()
Definition Mob.java:628
final boolean isNpc(BooleanInterface< Npc > condition)
Check if an entity is an npc.
Definition Mob.java:557
void walkTo(Interactable target, boolean clearAction, Runnable onDestination)
Definition Mob.java:398
final EnumSet< UpdateFlag > updateFlags
Definition Mob.java:94
void speak(String forceChat)
Sets the mob's forced chat.
Definition Mob.java:127
void setBonus(int equipSlot, int bonus)
Definition Mob.java:694
void setFixingInside(boolean fixingInside)
Definition Mob.java:755
final MutableNumber poisonDamage
Definition Mob.java:104
void interact(Mob mob)
Sets the mob interacting with another mob.
Definition Mob.java:278
void walkTo(Interactable target, Runnable onDestination)
Definition Mob.java:394
final void resetWaypoint()
Resets the waypoint.
Definition Mob.java:249
void forceMove(int animation, int x, int y)
Definition Mob.java:255
abstract Combat<? extends Mob > getCombat()
The combat of the mob.
void setBonuses(int[] bonuses)
Definition Mob.java:684
final boolean isPlayer(Function< Player, Boolean > condition)
Check if an entity is a player.
Definition Mob.java:575
void setListIndex(int listIndex)
Definition Mob.java:704
abstract boolean isAutoRetaliate()
State of the mob's auto retaliate.
void transform(int transformId)
Definition Mob.java:201
abstract void appendDeath()
Handles the mob death.
boolean isUpdateRequired()
Checks if mob requires an update.
Definition Mob.java:543
void walkExactlyTo(Position position, Runnable onDestination)
Definition Mob.java:389
void setForceMovement(ForceMovement forceMovement)
Definition Mob.java:512
final GenericAttributes attributes
Definition Mob.java:95
abstract void sequence()
The method which is invoked every tick.
void animate(Animation animation, final boolean override)
Plays an animation.
Definition Mob.java:163
void forceMove(int delay, int delay2, int animation, int startSpeed, int endSpeed, Position offset, Direction direction)
Definition Mob.java:263
Optional< Animation > getAnimation()
Definition Mob.java:708
void walkTo(Position position, Runnable onDestination)
Definition Mob.java:379
Mob(Position position, boolean visible)
Definition Mob.java:119
Mob(Position position)
Constructs a new Mob.
Definition Mob.java:114
void forceMove(int delay, int animation, int startSpeed, int endSpeed, Position offset, Direction direction)
Definition Mob.java:259
static boolean pathfinderProjectiles(Mob source)
Definition Mob.java:196
final SkillManager skills_copy
Definition Mob.java:97
void move(Position position)
Moves the mob to a set position.
Definition Mob.java:340
void face(GameObject object)
Sets the client update flag to face a certain direction.
Definition Mob.java:289
void animate(int animation, boolean override)
Definition Mob.java:138
boolean inActivity(ActivityType type)
Definition Mob.java:522
void setWaypoint(Waypoint waypoint)
Definition Mob.java:434
void forceMove(int delay, int delay2, int animation, int animationDelay, int startSpeed, int endSpeed, Position offset, Direction direction)
Creates a force movement action for an entity.
Definition Mob.java:270
void graphic(Graphic graphic)
Plays a graphic.
Definition Mob.java:156
final boolean isNpc()
Check if an entity is an npc.
Definition Mob.java:550
boolean hasPriorityIndex(Mob other)
Definition Mob.java:763
void face(Position position)
Sets the client update flag to face a certain direction.
Definition Mob.java:305
final boolean isPlayer()
Check if an entity is a player.
Definition Mob.java:564
void walk(Position position)
Definition Mob.java:358
void setActivity(Activity activity)
Definition Mob.java:526
final MutableNumber venomDamage
Definition Mob.java:105
void walkTo(Position position)
Definition Mob.java:374
void animate(Animation animation)
Plays an animation.
Definition Mob.java:145
void clearTeleportTarget()
Resets the teleport target.
Definition Mob.java:536
void resetFace()
Resets the mob's face location.
Definition Mob.java:330
final void reset()
Resets the mob after an update.
Definition Mob.java:241
Optional< Graphic > graphic
Definition Mob.java:91
void runTo(Position destination)
Definition Mob.java:370
void venom()
Applies venom to the entity.
Definition Mob.java:508
void transform(int transformId, boolean reload)
Transforms the mob.
Definition Mob.java:208
void face(Direction direction)
Sets the client update flag to face a certain direction.
Definition Mob.java:317
void walk(Position destination, boolean ignoreClip)
Definition Mob.java:362
void walkExactlyTo(Position position)
Definition Mob.java:384
Handles the movement for the player.
Definition Movement.java:25
Method handles small methods for npcs that do not have any parent class.
static Optional< CombatStrategy< Npc > > loadStrategy(Npc npc)
Represents a non-player character in the in-game world.
Definition Npc.java:29
void setStrategy(CombatStrategy< Npc > strategy)
Definition Npc.java:212
Combat< Npc > getCombat()
The combat of the mob.
Definition Npc.java:156
static final Map< Integer, Supplier< CombatStrategy< Npc > > > STRATEGIES
static NpcDefinition get(int id)
Gets a npc definition from the definition array.
This class represents a character controlled by a player.
Definition Player.java:125
Represents a chat message that can be displayed over an entities head.
static final int CHARACTER_LIMIT
When a chat message decoded there's a character buffer that can only hold 100 characters.
Represents a trainable and usable skill.
Definition Skill.java:18
static final int HITPOINTS
The hitpoints skill id.
Definition Skill.java:30
Manages all skills related to an mob.
Contains traversal data for a set of regions.
static boolean isTraversable(Position from, Direction direction, int size)
Tests whether or not a specified position is traversable in the specified direction.
Represents a single tile on the game world.
Definition Position.java:14
Position transform(int diffX, int diffY, int diffZ)
Creates a new location based on this location.
The container class that contains functions to simplify the modification of a number.
static Stopwatch start()
Handles miscellaneous methods.
Definition Utility.java:27
static boolean isRegionChange(Position position, Position region)
Definition Utility.java:343
Holds all activity types that are timed.
The enumerated type whose elements represent the different levels of poison.
The enumerated type whose values represent the collection of different combat effect types.
Represents the enumerated directions an entity can walk or face.
An object implementing Interactable has uses.
static Interactable create(Position position)
Creates a new instance of an Interactable.
A combat attack is used to describe what the attacking and defending mobs should do in each stage of ...