 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.model.maplocation;
22 import java.awt.Point;
23 import java.util.regex.Pattern;
34 import org.jetbrains.annotations.NotNull;
35 import org.jetbrains.annotations.Nullable;
98 if (mapSquare ==
null) {
106 final int mapX =
getMapX(gameObject);
107 final int mapY =
getMapY(gameObject);
108 return new MapLocation(canonicalMapPath, mapX, mapY);
130 public boolean equals(@Nullable
final Object obj) {
134 if (obj ==
null || obj.getClass() != getClass()) {
174 if (path.isEmpty()) {
176 if (mapSquare ==
null) {
182 if (mapFile ==
null) {
189 if (allowRandomMapParameters && (path.equals(
"/!") || path.startsWith(
"/random/"))) {
209 final String msg = gameObject.getMsgText(
true);
215 for (
final String line : lines) {
217 if (tmp.length == 2 && tmp[0].equals(parameterName)) {
232 @SuppressWarnings(
"CompareToUsesNonFinalVariable")
234 final int cmp =
mapPath.toString().compareTo(o.mapPath.toString());
MapPath getMapPath()
Returns the map path.
boolean equals(@Nullable final Object obj)
A MapModel reflects the data of a map.
MapSquare< G, A, R > getMapSquareOptional()
Returns the MapSquare this game object is part of.
int compareTo(@NotNull final MapLocation o)
final Point mapCoordinate
The map coordinate.
A MapPath that is absolute, that is, it starts with a "/".
Base package of all Gridarta classes.
String SP
The attribute name of the "sp" attribute.
MapLocation(@NotNull final GameObject<?, ?, ?> gameObject, final boolean allowRandomMapParameters)
Creates a new instance from a BaseObject instance.
static MapPath getMapPath(@NotNull final GameObject<?, ?, ?> gameObject, final boolean allowRandomMapParameters)
Returns the exit map path of a BaseObject.
static MapPath newMapPath(@NotNull final String string)
Creates a MapPath instance from string representation.
Reflects a game object (object on a map).
Utility class for MapPath related functions.
AbsoluteMapPath getMapPath()
Returns the map path within getMapsDir().
A set of key/value pairs.
Point getMapCoordinate()
Returns the map coordinate.
GameObjects are the objects based on Archetypes found on maps.
static MapLocation newAbsoluteMapLocation(@NotNull final GameObject<?, ?, ?> gameObject, final boolean allowRandomMapParameters)
Creates a new instance from a BaseObject instance.
static AbsoluteMapPath append(@NotNull final AbsoluteMapPath baseMapPath, @NotNull final MapPath mapPath)
Appends a map path to another map path.
static final Pattern PATTERN_END_OF_LINE
The Pattern that matches end of lines in random map parameters.
Exception thrown if a game object does not specify a valid exit path.
static int getMapY(@NotNull final Attributes gameObject)
Returns the exit x coordinate of a BaseObject.
Represents a maps directory local map path.
Represents a location on a map consisting of a map path and a map coordinate.
String SLAYING
The name of the "slaying" attribute.
Utility class for string manipulation.
The location of a map file with a map directory.
MapModel< G, A, R > getMapModel()
Returns the MapModel this map square is part of.
static String getRandomMapParameter(@NotNull final BaseObject<?, ?, ?, ?> gameObject, @NotNull final String parameterName)
Extracts a parameter value for an exit to a random map.
final MapPath mapPath
The map path.
static final Pattern PATTERN_SPACES
The pattern that matches a non-empty sequence of spaces.
static int getMapX(@NotNull final Attributes gameObject)
Returns the exit y coordinate of a BaseObject.
MapLocation(@NotNull final MapPath mapPath, final int mapXCoordinate, final int mapYCoordinate)
Creates a new instance.
String HP
The attribute name of the "hp" attribute.
MapFile getMapFile()
Returns the map file.