1package com.runehive.game.world.entity.mob;
3import com.google.common.collect.ImmutableList;
4import com.runehive.game.world.position.Position;
5import com.runehive.util.Utility;
43 public static final byte[]
DELTA_X =
new byte[]{-1, 0, 1, -1, 1, -1, 0, 1};
48 public static final byte[]
DELTA_Y =
new byte[]{1, 1, 1, 0, 0, -1, -1, -1};
59 }
else if (deltaX == 0) {
61 }
else if (deltaX <= -1) {
64 }
else if (deltaY == 0) {
67 }
else if (deltaX == 0) {
69 }
else if (deltaX <= -1) {
72 }
else if (deltaY <= -1) {
75 }
else if (deltaX == 0) {
77 }
else if (deltaX <= -1) {
100 }
else if (deltaX == 0) {
102 }
else if (deltaX <= -1) {
105 }
else if (deltaY == 0) {
108 }
else if (deltaX == 0) {
110 }
else if (deltaX <= -1) {
113 }
else if (deltaY <= -1) {
116 }
else if (deltaX == 0) {
118 }
else if (deltaX <= -1) {
130 case 1:
return NORTH;
132 case 3:
return SOUTH;
134 default:
return SOUTH;
152 }
else if (deltaY == 0) {
155 }
else if (deltaX == 0) {
157 }
else if (deltaX <= -1) {
160 }
else if (deltaY <= -1) {
194 int deltaX = Math.abs(source.
getX() - target.
getX());
195 int deltaY = Math.abs(source.
getY() - target.
getY());
196 boolean vertical = deltaY > deltaX;
199 if (vertical)
return NORTH;
202 if (vertical)
return NORTH;
205 if (vertical)
return SOUTH;
208 if (vertical)
return SOUTH;
244 switch (orientation) {
Represents a single tile on the game world.
int getY()
Gets the absolute y coordinate.
int getX()
Gets the absolute x coordinate.
Handles miscellaneous methods.
static int random(int bound)
static Direction getDirection(int deltaX, int deltaY)
Gets the direction between two locations.
static Direction ofManhattan(int orientation)
Gets the Manhattan direction of an orientation.
static Direction getDirection(Position position, Position other)
Gets the direction between two locations.
static Direction getManhattanDirection(Position position, Position other)
Gets the direction between two locations, ignoring corners.
static final byte[] DELTA_Y
Difference in Y coordinates for directions array.
Position getFaceLocation()
static final Direction[] VALID
static Direction[] valid()
static int direction(int dx, int dy)
static Direction getRandomDirection()
static Direction getFollowDirection(Position source, Position target)
Direction(int directionX, int directionY)
static final ImmutableList< Direction > DIRECTIONS
static Direction getOppositeDirection(Direction direction)
final Position faceLocation
static final byte[] DELTA_X
Difference in X coordinates for directions array.
static int getDoorOrientation(Direction direction)
Gets the orientation for door.
int getManhattanOrientation()