public abstract class AbstractGameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends AbstractBaseObject<G,A,R,G> implements GameObject<G,A,R>
GameObject implementations.EDITOR_FOLDER_INTERNANIM_SPEED, ANIMATION, BLOCKSVIEW, DIRECTION, EDIT_TYPE_NONE, FACE, HP, IS_ANIMATED, IS_TURNABLE, LAST_HEAL, LEVEL, NAME, NO_PASS, NO_PICK, SLAYING, SP, TITLE, TYPE| Modifier | Constructor and Description |
|---|---|
protected |
AbstractGameObject(R archetype,
@NotNull FaceObjectProviders faceObjectProviders,
@NotNull AnimationObjects animationObjects)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
G |
asGameObject()
Returns this instance as a
GameObject or null if this
instance is not a game object. |
G |
clone()
Creates a clone of this base object.
|
R |
getArchetype()
Returns the Archetype this GameObject is based on.
|
@NotNull java.lang.String |
getAttributeString(@NotNull java.lang.String attributeName,
boolean queryArchetype)
Returns the requested attribute value of this GameObject as
String. |
@Nullable GameObjectContainer<G,A,R> |
getContainer()
Returns container of this GameObject.
|
G |
getContainerGameObject()
Returns the environment game object if this game object is in the
inventory or
null. |
protected @Nullable java.lang.String |
getEffectiveFaceName(@NotNull java.lang.String faceName)
Returns the effective face name for
AbstractBaseObject.faceName for a given real
face name. |
@NotNull MapSquare<G,A,R> |
getMapSquare()
Returns the
MapSquare this game object is part of. |
@Nullable MapSquare<G,A,R> |
getMapSquareOptional()
Returns the
MapSquare this game object is part of. |
G |
getNext()
Returns the game object succeeding this game object.
|
G |
getPrev()
Returns the game object preceding this game object.
|
G |
getTopContainer()
Get the topmost container of this GameObject (in Game sense, which means
being in a MapSquare isn't, but being in a GameObject is).
|
boolean |
hasUndefinedArchetype()
Return whether this instance references an undefined archetype.
|
void |
insertAfter(G node)
Insert a GameObject after this GameObject.
|
void |
insertBefore(G node)
Insert a GameObject before this GameObject.
|
boolean |
isBottom()
Returns whether this game object is the bottom-most one.
|
boolean |
isInContainer()
Check whether this GameObject is in a Container (in Gridarta sense, which
means being in a MapSquare isn't, but being is a GameObject is).
|
boolean |
isTop()
Returns whether this game object is the top-most one.
|
void |
markModified()
Marks this game object as "modified".
|
void |
moveBottom()
Move this GameObject bottom.
|
void |
moveDown()
Move this GameObject down.
|
void |
moveTop()
Move this GameObject top.
|
void |
moveUp()
Move this GameObject up.
|
G |
newInstance(@NotNull GameObjectFactory<G,A,R> gameObjectFactory)
|
void |
notifyBeginChange()
Notifies the map model that this container is about to change.
|
void |
notifyEndChange()
Notifies the map model that this container has changed.
|
void |
notifyTransientChange()
Notifies the map model that this container has changed but need not be
restored by undo/redo.
|
void |
remove()
Remove this GameObject from its container.
|
void |
setArchetype(R archetype)
Set the Archetype of this GameObject.
|
void |
setContainer(@Nullable GameObjectContainer<G,A,R> container,
int mapX,
int mapY)
Sets container of this GameObject.
|
void |
visit(@NotNull BaseObjectVisitor<G,A,R> baseObjectVisitor)
Calls the appropriate
visit() function of a BaseObjectVisitor. |
addMsgTextLine, addObjectText, addTailPart, beginGameObjectChange, countInvObjects, endGameObjectChange, facesReloaded, getAnimName, getAttributeDouble, getAttributeDouble, getAttributeInt, getAttributeInt, getAttributeKeys, getAttributeLong, getAttributeLong, getAttributeString, getAttributeValue, getBestName, getDirection, getEditType, getFaceName, getFaceObjName, getFaceObjSource, getHead, getLoreText, getMapLocation, getMapX, getMapY, getMaxX, getMaxY, getMinX, getMinY, getMsgText, getMulti, getMultiNext, getMultiRefCount, getNormalImage, getObjectText, getObjName, getSizeX, getSizeY, getThis, getTypeNo, hasAttribute, hasAttribute, isDefaultGameObject, isEqual, isHead, isMulti, isTail, removeAttribute, removeTailParts, setAttributeInt, setAttributeString, setEditType, setLoreText, setMapX, setMapY, setMsgText, setMulti, setObjectFace, setObjectText, setThisContainer, toString, updateArchetypeaddFirst, addLast, getFirst, getLast, getNext, getPrev, hasSameContents, insertAfter, insertBefore, isBottom, isEmpty, isTop, iterator, moveBottom, moveDown, moveTop, moveUp, recursive, remove, removeAll, replace, reverse, toStringequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddFirst, addLast, applyMassChange, getFirst, getLast, getLightRadius, isEmpty, isScripted, iterator, propagateElevation, recursive, removeAll, reverse, updateTileStretchaddMsgTextLine, addObjectText, addTailPart, countInvObjects, facesReloaded, getAnimName, getAttributeDouble, getAttributeInt, getAttributeLong, getBestName, getDirection, getEditType, getFaceName, getFaceObjName, getFaceObjSource, getHead, getLoreText, getMapLocation, getMapX, getMapY, getMaxX, getMaxY, getMinX, getMinY, getMsgText, getMultiNext, getMultiRefCount, getNormalImage, getObjectText, getObjName, getSizeX, getSizeY, getTypeNo, hasAttribute, isDefaultGameObject, isEqual, isHead, isMulti, isTail, removeTailParts, setAttributeString, setEditType, setLoreText, setMapX, setMapY, setMsgText, setMulti, setObjectFace, setObjectText, toString, usesDirectiongetAttributeDouble, getAttributeInt, getAttributeLong, getAttributeString, hasAttribute, removeAttribute, setAttributeIntprotected AbstractGameObject(@NotNull
R archetype,
@NotNull
@NotNull FaceObjectProviders faceObjectProviders,
@NotNull
@NotNull AnimationObjects animationObjects)
archetype - the archetype associated with with game objectfaceObjectProviders - the face object providers for looking up
facesanimationObjects - the animation objects for looking up animations@NotNull
public @NotNull java.lang.String getAttributeString(@NotNull
@NotNull java.lang.String attributeName,
boolean queryArchetype)
BaseObjectString. The attribute value is first searched in this GameObject. If
queryArchetype == true, additional search is done: if the
attribute value is not found and this GameObject is not an Archetype
itself, the attribute value is searched in this GameObject's Archetype as
well.getAttributeString in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>attributeName - the name of the attribute to search; this will be
"attributeName value" in the object
textqueryArchetype - whether to query the Archetype of this GameObject:
true if the Archetype should be queried as well, false to
ignore itAttributes.getAttributeString(String)@Nullable
protected @Nullable java.lang.String getEffectiveFaceName(@NotNull
@NotNull java.lang.String faceName)
AbstractBaseObjectAbstractBaseObject.faceName for a given real
face name.getEffectiveFaceName in class AbstractBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>faceName - the real face namenull if the real face name is
unset or equals the archetype's face namepublic void notifyBeginChange()
GameObjectContainernotifyBeginChange in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>notifyBeginChange in class AbstractBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>public void notifyEndChange()
GameObjectContainernotifyEndChange in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>notifyEndChange in class AbstractBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>public void notifyTransientChange()
BaseObjectnotifyTransientChange in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>@NotNull public G clone()
BaseObjectclone in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>clone in class AbstractBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>@NotNull public G asGameObject()
GameObjectContainerGameObject or null if this
instance is not a game object.asGameObject in class GameObjectContainer<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>null@NotNull public G newInstance(@NotNull @NotNull GameObjectFactory<G,A,R> gameObjectFactory)
BaseObjectnewInstance in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>gameObjectFactory - the game object factory for creating new game
objectspublic void visit(@NotNull
@NotNull BaseObjectVisitor<G,A,R> baseObjectVisitor)
BaseObjectvisit() function of a BaseObjectVisitor.visit in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>baseObjectVisitor - the base object visitorpublic void remove()
GameObjectremove in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>@Nullable public @Nullable GameObjectContainer<G,A,R> getContainer()
GameObjectnull for this).
getContainer in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>GameObject.getTopContainer()public boolean isTop()
GameObjectisTop in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>public boolean isBottom()
GameObjectisBottom in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>public void moveTop()
GameObjectmoveTop in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>public void moveUp()
GameObjectmoveUp in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>public void moveDown()
GameObjectmoveDown in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>public void moveBottom()
GameObjectmoveBottom in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>public void insertBefore(@NotNull
G node)
GameObjectinsertBefore in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>node - GameObject to appendpublic void insertAfter(@NotNull
G node)
GameObjectinsertAfter in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>node - GameObject to append@Nullable public G getContainerGameObject()
GameObjectnull.getContainerGameObject in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>null@NotNull public G getTopContainer()
GameObjectgetTopContainer in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>GameObject.getContainer()public void setContainer(@Nullable
@Nullable GameObjectContainer<G,A,R> container,
int mapX,
int mapY)
GameObjectsetContainer in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>container - the container of this game objectmapX - the x coordinate on the map or 0mapY - the y coordinate on the map or 0public boolean isInContainer()
GameObjectisInContainer in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>true if this GameObject has a Container and the Container
is a GameObject, otherwise (no Container or Container is not an
GameObject) false@NotNull public @NotNull MapSquare<G,A,R> getMapSquare()
GameObjectContainerMapSquare this game object is part of.getMapSquare in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>getMapSquare in class GameObjectContainer<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>@Nullable public @Nullable MapSquare<G,A,R> getMapSquareOptional()
GameObjectContainerMapSquare this game object is part of.getMapSquareOptional in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>getMapSquareOptional in class GameObjectContainer<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>null if the game object is not part of
a map@Nullable public G getPrev()
GameObjectgetPrev in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>null if no preceding game
object exists.@Nullable public G getNext()
GameObjectgetNext in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>null if no successor game
object exists.@NotNull public R getArchetype()
BaseObjectgetArchetype in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,G extends GameObject<G,A,R>>public void setArchetype(@NotNull
R archetype)
GameObjectsetArchetype in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>archetype - the new archetype of this game objectBaseObject.getArchetype()public boolean hasUndefinedArchetype()
GameObjecthasUndefinedArchetype in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>true if this instance references an undefined archetypepublic void markModified()
GameObjectmarkModified in interface GameObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>