RuneHive-Game
Loading...
Searching...
No Matches
InspectAction.java
Go to the documentation of this file.
1package com.runehive.game.action.impl;
2
3import com.runehive.game.action.Action;
4import com.runehive.game.action.policy.WalkablePolicy;
5import com.runehive.game.world.entity.mob.player.Player;
6import com.runehive.game.world.position.Position;
7
8public abstract class InspectAction extends Action<Player> {
9
10 /**
11 * The position.
12 */
14
15 /**
16 * Constructor.
17 *
18 * @param player
19 * @param position
20 */
22 super(player, 1, true);
23 this.position = position;
24 }
25
26 @Override
27 public boolean prioritized() {
28 return false;
29 }
30
31 @Override
35
36 @Override
37 public void execute() {
38 if (getDelay() == 0) {
40 init();
41 if (this.isRunning()) {
42 getMob().face(position);
43 }
44 } else {
46 cancel();
47 }
48 }
49
50 /**
51 * Initialization method.
52 */
53 public abstract void init();
54
55 /**
56 * Inspection time consumption.
57 * @return
58 */
59 public abstract int getInspectDelay();
60
61 /**
62 * Rewards to give the player.
63 * @param player
64 */
65 public abstract void giveRewards(Player player);
66
67}
T getMob()
Gets the player.
Definition Action.java:44
Action(T mob, int delay, boolean instant)
Creates a new Action randomevent.
Definition Action.java:24
abstract void init()
Initialization method.
abstract int getInspectDelay()
Inspection time consumption.
WalkablePolicy getWalkablePolicy()
Gets the WalkablePolicy of this action.
abstract void giveRewards(Player player)
Rewards to give the player.
boolean prioritized()
Determines if this action is prioritized.
void execute()
A function representing the unit of work that will be carried out.
InspectAction(Player player, Position position)
Constructor.
synchronized final void cancel()
Cancels all subsequent executions.
Definition Task.java:113
void setDelay(int delay)
Sets the cyclic delay.
Definition Task.java:164
This class represents a character controlled by a player.
Definition Player.java:125
Represents a single tile on the game world.
Definition Position.java:14
A queue policy determines whether the action can occur while walking.
NON_WALKABLE
This indicates actions cannot occur while walking.