Package net.sf.gridarta.model.baseobject
Class AbstractBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>
- java.lang.Object
-
- net.sf.gridarta.model.baseobject.GameObjectContainer<G,A,R>
-
- net.sf.gridarta.model.baseobject.AbstractBaseObject<G,A,R,T>
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<G>,Attributes,BaseObject<G,A,R,T>
- Direct Known Subclasses:
AbstractArchetype,AbstractGameObject
public abstract class AbstractBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>> extends GameObjectContainer<G,A,R> implements BaseObject<G,A,R,T>
Default implementation forGameObjectimplementing classes. This abstract class serves as a common base for GameObjects for Daimonin and Crossfire to allow classes that use GameObjects being reused and moved to Gridarta.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface net.sf.gridarta.model.baseobject.BaseObject
ANIM_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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractBaseObject(@NotNull FaceObjectProviders faceObjectProviders, @NotNull AnimationObjects animationObjects)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddMsgTextLine(@NotNull java.lang.String text)Adds a line of message text.voidaddObjectText(@NotNull java.lang.String line)Appendstextto the object text of this GameObject.voidaddTailPart(T tail)Appends a tail to this GameObject.protected voidbeginGameObjectChange()Records that this game object is about to change.Tclone()Creates a clone of this base object.intcountInvObjects()Counts the number of all inventory items (recursively).protected voidendGameObjectChange()Records that this game object has changed.voidfacesReloaded()Will be called whenever the archetype faces have been reloaded.@Nullable java.lang.StringgetAnimName()DaiEditor only: Returns the name of the animation.doublegetAttributeDouble(@NotNull java.lang.String attributeName)Returns an attribute value of this Archetype as double.doublegetAttributeDouble(@NotNull java.lang.String attributeName, boolean queryArchetype)Returns the requested attribute value of this GameObject asdouble.intgetAttributeInt(@NotNull java.lang.String attributeName)Returns an attribute value of this Archetype as int.intgetAttributeInt(@NotNull java.lang.String attributeName, boolean queryArchetype)Returns the requested attribute value of this GameObject asint.@NotNull java.util.Collection<java.lang.String>getAttributeKeys()Returns all attribute keys of this object.longgetAttributeLong(@NotNull java.lang.String attributeName)Returns an attribute value of this Archetype as long.longgetAttributeLong(@NotNull java.lang.String attributeName, boolean queryArchetype)Returns the requested attribute value of this GameObject aslong.@NotNull java.lang.StringgetAttributeString(@NotNull java.lang.String attributeName)Returns the requested attribute value of this GameObject asString.protected @Nullable java.lang.StringgetAttributeValue(@NotNull java.lang.String attributeName)Returns an attribute value by attribute name.@NotNull java.lang.StringgetBestName()Returns the name which is best appropriate to describe this GameObject.intgetDirection()Returns the direction of this Archetype or GameObject.intgetEditType()Returns the edit type.protected abstract @Nullable java.lang.StringgetEffectiveFaceName(@NotNull java.lang.String faceName)Returns the effective face name forfaceNamefor a given real face name.@Nullable java.lang.StringgetFaceName()Returns the name of the face of this Archetype or GameObject.@Nullable java.lang.StringgetFaceObjName()Returns the face name, can be from animation or face.@NotNull FaceSourcegetFaceObjSource()Returns theFaceSourceof this base object.TgetHead()Return the head part of a multi-part object.@NotNull java.lang.StringgetLoreText()Returns the map lore.@NotNull java.awt.PointgetMapLocation()Returns the coordinate of this GameObject on its map.intgetMapX()Returns the X coordinate of this GameObject on its map.intgetMapY()Returns the Y coordinate of this GameObject on its map.intgetMaxX()Determines the maximum x-coordinate of any part relative to the head part.intgetMaxY()Determines the maximum y-coordinate of any part relative to the head part.intgetMinX()Determines the minimum x-coordinate of any part relative to the head part.intgetMinY()Determines the minimum y-coordinate of any part relative to the head part.@Nullable java.lang.StringgetMsgText(boolean queryArchetype)Returns the message bound to this object.protected @Nullable MultiArchData<G,A,R,T>getMulti()Returns theMultiArchDatafor this base object.TgetMultiNext()Returns the next of this multi-part object.intgetMultiRefCount()Returns the number of parts for multi-part heads.@NotNull javax.swing.ImageIcongetNormalImage()Returns the normal face for this GameObject.@NotNull java.lang.StringgetObjectText()Returns the object text of this GameObject as String.@NotNull java.lang.StringgetObjName()Returns the name of the object as shown to the player.intgetSizeX()Determines the horizontal extent in squares.intgetSizeY()Determines the vertical extent in squares.protected abstract TgetThis()Returnsthisas its real type.intgetTypeNo()Returns the type number of this Archetype.booleanhasAttribute(@NotNull java.lang.String attributeName)Returns whether an attribute name exists.booleanhasAttribute(@NotNull java.lang.String attributeName, boolean queryArchetype)Returns whether an attribute name exists.booleanisDefaultGameObject()Returns whether this game object is unmodified from its underlying archetype.booleanisEqual(@NotNull BaseObject<?,?,?,?> gameObject)Compares this object to another game object.booleanisHead()Returns whether this object is a single-part object or the head of the multi-part object.booleanisMulti()Returns whether this Archetype is a multi-part object.booleanisTail()Determines if this part is a tail part.abstract voidnotifyBeginChange()Notifies the map model that this container is about to change.abstract voidnotifyEndChange()Notifies the map model that this container has changed.voidremoveAttribute(@NotNull java.lang.String attributeName)Removes the String of an archetype attribute from the objectText.voidremoveTailParts()Removes all tail parts of this game object.voidsetAttributeInt(@NotNull java.lang.String attributeName, int value)Sets an int value attribute.voidsetAttributeString(@NotNull java.lang.String attributeName, @NotNull java.lang.String value)Sets the String of an archetype attribute in the objectText.voidsetEditType(int editType)Sets the edit type.voidsetLoreText(@NotNull java.lang.CharSequence loreText)Sets the map lore.voidsetMapX(int mapX)Sets the X coordinate of this GameObject on its map.voidsetMapY(int mapY)Sets the Y coordinate of this GameObject on its map.voidsetMsgText(@Nullable java.lang.String msgText)Sets the message text.voidsetMulti(@NotNull MultiArchData<G,A,R,T> multi)voidsetObjectFace()We set here the real face of the objects, depending on the set face and the set animation.voidsetObjectText(@NotNull java.lang.String objectText)SetsobjectTextas object text of this GameObject.protected voidsetThisContainer(G gameObject)Sets aGameObject's container to this container.@NotNull java.lang.StringtoString(@NotNull java.lang.String format)Returns a string representation of this game object.protected voidupdateArchetype()Called wheneverBaseObject.getArchetype()has changed.-
Methods inherited from class net.sf.gridarta.model.baseobject.GameObjectContainer
addFirst, addLast, asGameObject, getFirst, getLast, getMapSquare, getMapSquareOptional, getNext, getPrev, hasSameContents, insertAfter, insertBefore, isBottom, isEmpty, isTop, iterator, moveBottom, moveDown, moveTop, moveUp, recursive, remove, removeAll, replace, reverse, toString
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.gridarta.model.baseobject.BaseObject
getArchetype, getAttributeString, newInstance, notifyTransientChange, usesDirection, visit
-
-
-
-
Constructor Detail
-
AbstractBaseObject
protected AbstractBaseObject(@NotNull @NotNull FaceObjectProviders faceObjectProviders, @NotNull @NotNull AnimationObjects animationObjects)Creates a new instance.- Parameters:
faceObjectProviders- the face object providers for looking up facesanimationObjects- the animation objects for looking up animations
-
-
Method Detail
-
getTypeNo
public int getTypeNo()
Description copied from interface:BaseObjectReturns the type number of this Archetype.
-
getEffectiveFaceName
@Nullable protected abstract @Nullable java.lang.String getEffectiveFaceName(@NotNull @NotNull java.lang.String faceName)Returns the effective face name forfaceNamefor a given real face name.- Parameters:
faceName- the real face name- Returns:
- the effective face name or
nullif the real face name is unset or equals the archetype's face name
-
getFaceName
@Nullable public @Nullable java.lang.String getFaceName()
Description copied from interface:BaseObjectReturns the name of the face of this Archetype or GameObject.- Specified by:
getFaceNamein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the name of the face of this archetype or game object
-
countInvObjects
public int countInvObjects()
Description copied from interface:BaseObjectCounts the number of all inventory items (recursively). The returned value does not include this GameObject.- Specified by:
countInvObjectsin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the number of objects in the inventory (recursively)
-
hasAttribute
public boolean hasAttribute(@NotNull @NotNull java.lang.String attributeName, boolean queryArchetype)Description copied from interface:BaseObjectReturns whether an attribute name exists.- Specified by:
hasAttributein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
attributeName- the attribute namequeryArchetype- whether to query the Archetype of this GameObject:trueif the Archetype should be queried as well,falseto ignore it.- Returns:
- whether the attribute name exists
-
hasAttribute
public boolean hasAttribute(@NotNull @NotNull java.lang.String attributeName)Description copied from interface:AttributesReturns whether an attribute name exists.- Specified by:
hasAttributein interfaceAttributes- Parameters:
attributeName- the attribute name- Returns:
- whether the attribute name exists
-
getAttributeValue
@Nullable protected @Nullable java.lang.String getAttributeValue(@NotNull @NotNull java.lang.String attributeName)Returns an attribute value by attribute name.- Parameters:
attributeName- the attribute name- Returns:
- the attribute value or
null
-
getAttributeString
@NotNull public @NotNull java.lang.String getAttributeString(@NotNull @NotNull java.lang.String attributeName)Description copied from interface:AttributesReturns the requested attribute value of this GameObject asString. The attribute value is first searched in this GameObject. 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.- Specified by:
getAttributeStringin interfaceAttributes- Parameters:
attributeName- the name of the attribute to search- Returns:
- the attribute value or an empty String ("") if no such attribute
-
getAttributeInt
public int getAttributeInt(@NotNull @NotNull java.lang.String attributeName, boolean queryArchetype)Description copied from interface:BaseObjectReturns the requested attribute value of this GameObject asint.- Specified by:
getAttributeIntin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
attributeName- the name of the attribute to searchqueryArchetype- whether to query the archetype of this game object- Returns:
- attribute the value or zero if not found
- See Also:
Attributes.getAttributeInt(String),BaseObject.getAttributeString(String, boolean)
-
getAttributeInt
public int getAttributeInt(@NotNull @NotNull java.lang.String attributeName)Description copied from interface:AttributesReturns an attribute value of this Archetype as int.- Specified by:
getAttributeIntin interfaceAttributes- Parameters:
attributeName- the name of the attribute value to return- Returns:
- the attribute value or
0(zero) if not found - See Also:
Attributes.getAttributeString(String)
-
getAttributeLong
public long getAttributeLong(@NotNull @NotNull java.lang.String attributeName, boolean queryArchetype)Description copied from interface:BaseObjectReturns the requested attribute value of this GameObject aslong.- Specified by:
getAttributeLongin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
attributeName- the name of the attribute to searchqueryArchetype- whether to query the archetype of this game object- Returns:
- the attribute value or zero if not found
- See Also:
Attributes.getAttributeLong(String),BaseObject.getAttributeString(String, boolean)
-
getAttributeLong
public long getAttributeLong(@NotNull @NotNull java.lang.String attributeName)Description copied from interface:AttributesReturns an attribute value of this Archetype as long.- Specified by:
getAttributeLongin interfaceAttributes- Parameters:
attributeName- the name of the attribute value to return- Returns:
- the attribute value or
0(zero) if not found - See Also:
Attributes.getAttributeString(String)
-
getAttributeDouble
public double getAttributeDouble(@NotNull @NotNull java.lang.String attributeName, boolean queryArchetype)Description copied from interface:BaseObjectReturns the requested attribute value of this GameObject asdouble.- Specified by:
getAttributeDoublein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
attributeName- the name of the attribute to searchqueryArchetype- whether to query the archetype of this game object- Returns:
- the attribute value or zero if not found
- See Also:
Attributes.getAttributeDouble(String),BaseObject.getAttributeString(String, boolean)
-
getAttributeDouble
public double getAttributeDouble(@NotNull @NotNull java.lang.String attributeName)Description copied from interface:AttributesReturns an attribute value of this Archetype as double.- Specified by:
getAttributeDoublein interfaceAttributes- Parameters:
attributeName- the name of the attribute value to return- Returns:
- the attribute value or
0.0(zero) if not found - See Also:
Attributes.getAttributeString(String)
-
setAttributeString
public void setAttributeString(@NotNull @NotNull java.lang.String attributeName, @NotNull @NotNull java.lang.String value)Description copied from interface:BaseObjectSets the String of an archetype attribute in the objectText.- Specified by:
setAttributeStringin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
attributeName- search for "attributeName <string>"value- the value to set
-
setAttributeInt
public void setAttributeInt(@NotNull @NotNull java.lang.String attributeName, int value)Description copied from interface:AttributesSets an int value attribute.- Specified by:
setAttributeIntin interfaceAttributes- Parameters:
attributeName- the name of the attribute to updatevalue- the new value
-
removeAttribute
public void removeAttribute(@NotNull @NotNull java.lang.String attributeName)Description copied from interface:AttributesRemoves the String of an archetype attribute from the objectText.- Specified by:
removeAttributein interfaceAttributes- Parameters:
attributeName- search for "attributeName <string>"
-
notifyBeginChange
public abstract void notifyBeginChange()
Description copied from class:GameObjectContainerNotifies the map model that this container is about to change.- Specified by:
notifyBeginChangein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Specified by:
notifyBeginChangein classGameObjectContainer<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- No Inspection:
- AbstractMethodOverridesAbstractMethod // needed because of public modifier
-
notifyEndChange
public abstract void notifyEndChange()
Description copied from class:GameObjectContainerNotifies the map model that this container has changed.- Specified by:
notifyEndChangein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Specified by:
notifyEndChangein classGameObjectContainer<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- No Inspection:
- AbstractMethodOverridesAbstractMethod // needed because of public modifier
-
updateArchetype
protected void updateArchetype()
Called wheneverBaseObject.getArchetype()has changed.
-
getEditType
public int getEditType()
Description copied from interface:BaseObjectReturns the edit type.- Specified by:
getEditTypein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the edit type
-
setEditType
public void setEditType(int editType)
Description copied from interface:BaseObjectSets the edit type.- Specified by:
setEditTypein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
editType- the edit type
-
addMsgTextLine
public void addMsgTextLine(@NotNull @NotNull java.lang.String text)Description copied from interface:BaseObjectAdds a line of message text. This is used when creating the GameObject from the ArchetypeParser.- Specified by:
addMsgTextLinein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
text- the text to append to message text
-
getMsgText
@Nullable public @Nullable java.lang.String getMsgText(boolean queryArchetype)
Description copied from interface:BaseObjectReturns the message bound to this object. If the message is empty, the empty String is returned. If the object has no message, this method returnsnull.- Specified by:
getMsgTextin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
queryArchetype- whether to query the Archetype of this GameObject:trueif the Archetype should be queried as well,falseto ignore it.- Returns:
- the message bound to this object
-
setMsgText
public void setMsgText(@Nullable @Nullable java.lang.String msgText)Description copied from interface:BaseObjectSets the message text.- Specified by:
setMsgTextin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
msgText- the message text
-
getMapX
public int getMapX()
Description copied from interface:BaseObjectReturns the X coordinate of this GameObject on its map. This method only guarantees a reasonable value for GameObjects that are directly bound to a map. Implementations may also return reasonable values for GameObjects inside containers, but they are not required to do so.- Specified by:
getMapXin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the x coordinate on map
- See Also:
BaseObject.getMapY()
-
getMapY
public int getMapY()
Description copied from interface:BaseObjectReturns the Y coordinate of this GameObject on its map. This method only guarantees a reasonable value for GameObjects that are directly bound to a map. Implementations may also return reasonable values for GameObjects inside containers, but they are not required to do so.- Specified by:
getMapYin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the y coordinate on map
- See Also:
BaseObject.getMapX()
-
getMapLocation
@NotNull public @NotNull java.awt.Point getMapLocation()
Description copied from interface:BaseObjectReturns the coordinate of this GameObject on its map. This method only guarantees a reasonable value for GameObjects that are directly bound to a map. Implementations may also return reasonable values for GameObjects inside containers, but they are not required to do so.- Specified by:
getMapLocationin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the coordinate on map
-
setMapX
public void setMapX(int mapX)
Description copied from interface:BaseObjectSets the X coordinate of this GameObject on its map.
-
setMapY
public void setMapY(int mapY)
Description copied from interface:BaseObjectSets the Y coordinate of this GameObject on its map.
-
isHead
public boolean isHead()
Description copied from interface:BaseObjectReturns whether this object is a single-part object or the head of the multi-part object.
-
getMultiNext
@Nullable public T getMultiNext()
Description copied from interface:BaseObjectReturns the next of this multi-part object.- Specified by:
getMultiNextin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the next of this multi-part object or
nullif this isn't a multi-part object or this is the last part of a multi-part object
-
getMultiRefCount
public int getMultiRefCount()
Description copied from interface:BaseObjectReturns the number of parts for multi-part heads. (*.getMultiRefCount() > 0) is often used as way to find multi-parts.- Specified by:
getMultiRefCountin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the number of parts
-
addTailPart
public void addTailPart(@NotNull T tail)Description copied from interface:BaseObjectAppends a tail to this GameObject.- Specified by:
addTailPartin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
tail- the tail to append
-
removeTailParts
public void removeTailParts()
Description copied from interface:BaseObjectRemoves all tail parts of this game object. AfterwardsBaseObject.isMulti()will returnfalse.- Specified by:
removeTailPartsin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>
-
getHead
public T getHead()
Description copied from interface:BaseObjectReturn the head part of a multi-part object. For single-part objects it is the object itself.
-
isTail
public boolean isTail()
Description copied from interface:BaseObjectDetermines if this part is a tail part. For single-part objects this is never true.
-
getSizeX
public int getSizeX()
Description copied from interface:BaseObjectDetermines the horizontal extent in squares. For single-part objects 1 is returned.
-
getSizeY
public int getSizeY()
Description copied from interface:BaseObjectDetermines the vertical extent in squares. For single-part objects 1 is returned.
-
getMaxX
public int getMaxX()
Description copied from interface:BaseObjectDetermines the maximum x-coordinate of any part relative to the head part. For single-part objects 0 is returned.
-
getMaxY
public int getMaxY()
Description copied from interface:BaseObjectDetermines the maximum y-coordinate of any part relative to the head part. For single-part objects 0 is returned.
-
getMinX
public int getMinX()
Description copied from interface:BaseObjectDetermines the minimum x-coordinate of any part relative to the head part. For single-part objects 0 is returned.
-
getMinY
public int getMinY()
Description copied from interface:BaseObjectDetermines the minimum y-coordinate of any part relative to the head part. For single-part objects 0 is returned.
-
clone
@NotNull public T clone()
Description copied from interface:BaseObjectCreates a clone of this base object.- Specified by:
clonein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Overrides:
clonein classGameObjectContainer<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
-
setThisContainer
protected void setThisContainer(@NotNull G gameObject)Description copied from class:GameObjectContainerSets aGameObject's container to this container.- Specified by:
setThisContainerin classGameObjectContainer<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
gameObject- the game object
-
getObjName
@NotNull public @NotNull java.lang.String getObjName()
Description copied from interface:BaseObjectReturns the name of the object as shown to the player.- Specified by:
getObjNamein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the name of the object as shown to the player
-
getBestName
@NotNull public @NotNull java.lang.String getBestName()
Description copied from interface:BaseObjectReturns the name which is best appropriate to describe this GameObject. (This can be Archetype name or GameObject name.)- Specified by:
getBestNamein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the best suitable descriptive name
-
getObjectText
@NotNull public @NotNull java.lang.String getObjectText()
Description copied from interface:BaseObjectReturns the object text of this GameObject as String.- Specified by:
getObjectTextin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the object text
-
addObjectText
public void addObjectText(@NotNull @NotNull java.lang.String line)Description copied from interface:BaseObjectAppendstextto the object text of this GameObject.- Specified by:
addObjectTextin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
line- a line of text to append, may contain '\n' for appending multiple lines
-
setObjectText
public void setObjectText(@NotNull @NotNull java.lang.String objectText)Description copied from interface:BaseObjectSetsobjectTextas object text of this GameObject.- Specified by:
setObjectTextin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
objectText- the text to set as object text
-
isDefaultGameObject
public boolean isDefaultGameObject()
Description copied from interface:BaseObjectReturns whether this game object is unmodified from its underlying archetype.- Specified by:
isDefaultGameObjectin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- whether this game object is unmodified
-
isEqual
public boolean isEqual(@NotNull @NotNull BaseObject<?,?,?,?> gameObject)Description copied from interface:BaseObjectCompares this object to another game object.
-
getDirection
public int getDirection()
Description copied from interface:BaseObjectReturns the direction of this Archetype or GameObject.- Specified by:
getDirectionin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the direction of this archetype or game object
-
beginGameObjectChange
protected void beginGameObjectChange()
Records that this game object is about to change.
-
endGameObjectChange
protected void endGameObjectChange()
Records that this game object has changed.
-
getFaceObjSource
@NotNull public @NotNull FaceSource getFaceObjSource()
Description copied from interface:BaseObjectReturns theFaceSourceof this base object.- Specified by:
getFaceObjSourcein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the face source
-
getAnimName
@Nullable public @Nullable java.lang.String getAnimName()
Description copied from interface:BaseObjectDaiEditor only: Returns the name of the animation.- Specified by:
getAnimNamein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the name of the animation
-
isMulti
public boolean isMulti()
Description copied from interface:BaseObjectReturns whether this Archetype is a multi-part object.
-
getMulti
@Nullable protected @Nullable MultiArchData<G,A,R,T> getMulti()
Returns theMultiArchDatafor this base object.- Returns:
- the multi arch data or
nullif this object is not a multi-square object
-
setMulti
public void setMulti(@NotNull @NotNull MultiArchData<G,A,R,T> multi)
-
getFaceObjName
@Nullable public @Nullable java.lang.String getFaceObjName()
Description copied from interface:BaseObjectReturns the face name, can be from animation or face.- Specified by:
getFaceObjNamein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the face name
-
setObjectFace
public void setObjectFace()
Description copied from interface:BaseObjectWe set here the real face of the objects, depending on the set face and the set animation. The rule is, that a active animation will overrule the default face. We will catch it here. This method should always be invoked after the face or animation has changed and no other change is expected right now, so the changes to animation / face should be applied.- Specified by:
setObjectFacein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>
-
getNormalImage
@NotNull public @NotNull javax.swing.ImageIcon getNormalImage()
Description copied from interface:BaseObjectReturns the normal face for this GameObject.- Specified by:
getNormalImagein interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the normal face for this GameObject
-
getLoreText
@NotNull public @NotNull java.lang.String getLoreText()
Description copied from interface:BaseObjectReturns the map lore.- Specified by:
getLoreTextin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Returns:
- the map lore
-
setLoreText
public void setLoreText(@NotNull @NotNull java.lang.CharSequence loreText)Description copied from interface:BaseObjectSets the map lore.- Specified by:
setLoreTextin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>- Parameters:
loreText- the map lore
-
facesReloaded
public void facesReloaded()
Description copied from interface:BaseObjectWill be called whenever the archetype faces have been reloaded.- Specified by:
facesReloadedin interfaceBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>>
-
toString
@NotNull public @NotNull java.lang.String toString(@NotNull @NotNull java.lang.String format)Description copied from interface:BaseObjectReturns a string representation of this game object. The string representation is the givenformatstring which supports the following replacements:- $$ - a string $ character
- ${NAME} - the in-game object name
- ${name} - the value of attribute "name"
- ${name:text} - text if the attribute name exists; empty otherwise. replacements within "text" are processed
-
getThis
@NotNull protected abstract T getThis()
Returnsthisas its real type.- Returns:
this
-
getAttributeKeys
@NotNull public @NotNull java.util.Collection<java.lang.String> getAttributeKeys()
Returns all attribute keys of this object.- Returns:
- the attribute keys
-
-