RuneHive-Game
Loading...
Searching...
No Matches
CombatWaypoint.java
Go to the documentation of this file.
1
package
com.runehive.game.world.entity.mob.movement.waypoint;
2
3
import
com.runehive.content.activity.Activity;
4
import
com.runehive.content.activity.impl.kraken.KrakenActivity;
5
import
com.runehive.game.world.entity.combat.attack.FightType;
6
import
com.runehive.game.world.entity.mob.Mob;
7
import
com.runehive.util.Utility;
8
9
public
class
CombatWaypoint
extends
Waypoint
{
10
11
public
CombatWaypoint
(
Mob
mob
,
Mob
target
) {
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
}
com.runehive.content.activity.Activity
A Activity object constructs an in-game activity and sequences it through the start() and finish() me...
Definition
Activity.java:31
com.runehive.content.activity.Activity.evaluate
static boolean evaluate(Mob mob, Predicate< Activity > predicate)
Definition
Activity.java:74
com.runehive.game.world.entity.mob.Mob
Handles the mob class.
Definition
Mob.java:66
com.runehive.game.world.entity.mob.movement.waypoint.CombatWaypoint.onDestination
void onDestination()
Definition
CombatWaypoint.java:16
com.runehive.game.world.entity.mob.movement.waypoint.CombatWaypoint.CombatWaypoint
CombatWaypoint(Mob mob, Mob target)
Definition
CombatWaypoint.java:11
com.runehive.game.world.entity.mob.movement.waypoint.CombatWaypoint.withinDistance
boolean withinDistance()
Definition
CombatWaypoint.java:21
com.runehive.game.world.entity.mob.movement.waypoint.CombatWaypoint.getRadius
int getRadius()
Definition
CombatWaypoint.java:35
com.runehive.game.world.entity.mob.movement.waypoint.Waypoint.Waypoint
Waypoint(Mob mob, Interactable target)
Definition
Waypoint.java:25
com.runehive.game.world.entity.mob.movement.waypoint.Waypoint.mob
final Mob mob
Definition
Waypoint.java:21
com.runehive.game.world.entity.mob.movement.waypoint.Waypoint.target
Interactable target
Definition
Waypoint.java:22
com.runehive.util.Utility
Handles miscellaneous methods.
Definition
Utility.java:27
com.runehive.util.Utility.getDistance
static int getDistance(Interactable source, Position target)
Definition
Utility.java:363
com.runehive.game.world.entity.combat.attack.FightType
The enumerated type whose elements represent the fighting types.
Definition
FightType.java:10