RuneHive-Game
Loading...
Searching...
No Matches
CombatWaypoint.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.mob.movement.waypoint;
2
3import com.runehive.content.activity.Activity;
4import com.runehive.content.activity.impl.kraken.KrakenActivity;
5import com.runehive.game.world.entity.combat.attack.FightType;
6import com.runehive.game.world.entity.mob.Mob;
7import com.runehive.util.Utility;
8
9public class CombatWaypoint extends Waypoint {
10
12 super(mob, target);
13 }
14
15 @Override
16 public void onDestination() {
17 mob.movement.reset();
18 }
19
20 @Override
21 protected boolean withinDistance() {
22 if (target.equals(mob.getCombat().getDefender())) {
23 return mob.isPlayer() && Activity.evaluate(mob.getPlayer(), it -> {
24 if (it instanceof KrakenActivity) {
25 Mob kraken = ((KrakenActivity) it).kraken;
26 return Utility.getDistance(mob, kraken) <= getRadius() && mob.getStrategy().withinDistance(mob, kraken);
27 }
28 return false;
29 }) || Utility.getDistance(mob, target) <= getRadius() && mob.getStrategy().withinDistance(mob, (Mob) target);
30 }
31 return super.withinDistance();
32 }
33
34 @Override
35 protected int getRadius() {
36 if (target.equals(mob.getCombat().getDefender())) {
37 FightType fightType = mob.getCombat().getFightType();
38 return mob.getStrategy().getAttackDistance(mob, fightType);
39 }
40 return 1;
41 }
42
43}
A Activity object constructs an in-game activity and sequences it through the start() and finish() me...
Definition Activity.java:31
static boolean evaluate(Mob mob, Predicate< Activity > predicate)
Definition Activity.java:74
Handles the mob class.
Definition Mob.java:66
Handles miscellaneous methods.
Definition Utility.java:27
static int getDistance(Interactable source, Position target)
Definition Utility.java:363
The enumerated type whose elements represent the fighting types.