RuneHive-Game
Loading...
Searching...
No Matches
Action.java
Go to the documentation of this file.
1package com.runehive.game.action;
2
3import com.runehive.game.action.policy.WalkablePolicy;
4import com.runehive.game.task.Task;
5import com.runehive.game.world.entity.mob.Mob;
6
7/**
8 * Represents an action an entity can execute.
9 *
10 * @author <a href="http://www.rune-server.org/members/stand+up/">Stand Up</a>
11 */
12public abstract class Action<T extends Mob> extends Task {
13
14 /** The {@link Mob} associated with this ActionEvent. */
15 private final T mob;
16
17 /**
18 * Creates a new {@link Action} randomevent.
19 *
20 * @param mob {@link #mob}.
21 * @param instant {@link #instant}.
22 * @param delay {@link #delay}.
23 */
24 public Action(T mob, int delay, boolean instant) {
25 super(instant, delay);
26 this.mob = mob;
27 }
28
29 /**
30 * Creates a new {@link Action} randomevent.
31 *
32 * @param mob {@link #mob}.
33 * @param delay {@link #delay}.
34 */
35 public Action(T mob, int delay) {
36 this(mob, delay, false);
37 }
38
39 /**
40 * Gets the player.
41 *
42 * @return The player.
43 */
44 public T getMob() {
45 return mob;
46 }
47
48 /**
49 * Determines if this action is prioritized. <p>When making an action
50 * prioritized, the next action will be ignored if not queued.</p>
51 *
52 * @return {@code true} if this action is prioritized, {@code false}
53 * otherwise.
54 */
55 public boolean prioritized() {
56 return false;
57 }
58
59 /**
60 * Gets the WalkablePolicy of this action.
61 *
62 * @return The walkable policy of this action.
63 */
65
66 /**
67 * Gets the name of this action.
68 *
69 * @return The name of this action.
70 */
71 public abstract String getName();
72
73 public boolean cancellableInProgress() {
74 return true;
75 }
76
77}
T getMob()
Gets the player.
Definition Action.java:44
boolean prioritized()
Determines if this action is prioritized.
Definition Action.java:55
Action(T mob, int delay)
Creates a new Action randomevent.
Definition Action.java:35
final T mob
The Mob associated with this ActionEvent.
Definition Action.java:15
abstract WalkablePolicy getWalkablePolicy()
Gets the WalkablePolicy of this action.
abstract String getName()
Gets the name of this action.
Action(T mob, int delay, boolean instant)
Creates a new Action randomevent.
Definition Action.java:24
Task(boolean instant, int delay)
Creates a new Task.
Definition Task.java:41
final boolean instant
If execution happens instantly upon being scheduled.
Definition Task.java:14
int delay
The cyclic delay.
Definition Task.java:17
Handles the mob class.
Definition Mob.java:66
A queue policy determines whether the action can occur while walking.