public abstract class AbstractArchetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends AbstractBaseObject<G,A,R,R> implements Archetype<G,A,R>
Archetype
implementations.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
Modifier | Constructor and Description |
---|---|
protected |
AbstractArchetype(java.lang.String archetypeName,
FaceObjectProviders faceObjectProviders,
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. |
R |
clone() |
R |
getArchetype()
Returns the Archetype this GameObject is based on.
|
java.lang.String |
getArchetypeName()
Returns the name of this archetype.
|
java.lang.String |
getAttributeString(java.lang.String attributeName,
boolean queryArchetype)
Returns the requested attribute value of this GameObject as
String . |
java.lang.String |
getEditorFolder()
Returns the editor folder.
|
protected java.lang.String |
getEffectiveFaceName(java.lang.String faceName)
Returns the effective face name for
AbstractBaseObject.faceName for a given real
face name. |
MapSquare<G,A,R> |
getMapSquare()
Returns the
MapSquare of this container. |
int |
getMultiPartNr()
Returns the multi part id.
|
int |
getMultiShapeID()
Returns the multi shape id.
|
int |
getMultiX()
Returns the x-distance of this part to the head part.
|
int |
getMultiY()
Returns the y-distance of this part to the head part.
|
boolean |
isArtifact()
Returns whether this GameObject is an Artifact.
|
boolean |
isLowestPart()
Returns whether this part has the smallest y coordinate when painting the
image.
|
G |
newInstance(GameObjectFactory<G,A,R> gameObjectFactory)
|
void |
notifyBeginChange()
Notify the map model that this container is about to change.
|
void |
notifyEndChange()
Notify 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 |
setArchetypeName(java.lang.String archetypeName)
Sets the name of this archetype.
|
void |
setArtifact()
Converts this game object into an artifact.
|
void |
setEditorFolder(java.lang.String editorFolder)
Set the editor folder.
|
void |
setLowestPart(boolean isLowestPart)
Sets whether this part has the smallest y coordinate when painting the
image.
|
void |
setMultiPartNr(int multiPartNr)
Sets the multi part id.
|
void |
setMultiShapeID(int multiShapeID)
Sets the multi shape id.
|
void |
setMultiX(int multiX)
Sets the x-position of this part of a multi-part object.
|
void |
setMultiY(int multiY)
Sets the y-position of this part of a multi-part object.
|
void |
visit(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, transientGameObjectChange, updateArchetype
addFirst, addLast, getFirst, getLast, getNext, getPrev, hasSameContents, insertAfter, insertBefore, isBottom, isEmpty, isTop, iterator, moveBottom, moveDown, moveTop, moveUp, recursive, remove, removeAll, replace, reverse, toString
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addFirst, addLast, getAttributeKeys, isUndefinedArchetype, iterator
addMsgTextLine, 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, usesDirection
getAttributeDouble, getAttributeInt, getAttributeLong, getAttributeString, hasAttribute, removeAttribute, setAttributeInt
protected AbstractArchetype(@NotNull java.lang.String archetypeName, @NotNull FaceObjectProviders faceObjectProviders, @NotNull AnimationObjects animationObjects)
archetypeName
- the name of the archetypefaceObjectProviders
- the face object providers for looking up
facesanimationObjects
- the animation objects for looking up animations@Nullable public MapSquare<G,A,R> getMapSquare()
MapSquare
of this container.getMapSquare
in class GameObjectContainer<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
null
if this
GameObjectContainer is not (yet?) connected to a map (a MapSquare
would return itself)@NotNull public java.lang.String getAttributeString(@NotNull java.lang.String attributeName, boolean queryArchetype)
String
. 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>,R extends Archetype<G,A,R>>
attributeName
- the name of the attribute to search; this will be
"attributeName value"
in the object
text
queryArchetype
- 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 java.lang.String getEffectiveFaceName(@NotNull java.lang.String faceName)
AbstractBaseObject.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>,R extends Archetype<G,A,R>>
faceName
- the real face namenull
if the real face name is
unset or equals the archetype's face namepublic void notifyBeginChange()
notifyBeginChange
in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,R extends Archetype<G,A,R>>
notifyBeginChange
in class AbstractBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,R extends Archetype<G,A,R>>
public void notifyEndChange()
notifyEndChange
in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,R extends Archetype<G,A,R>>
notifyEndChange
in class AbstractBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,R extends Archetype<G,A,R>>
public void notifyTransientChange()
notifyTransientChange
in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,R extends Archetype<G,A,R>>
@NotNull public R getArchetype()
getArchetype
in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,R extends Archetype<G,A,R>>
@NotNull public R clone()
clone
in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,R extends Archetype<G,A,R>>
clone
in class AbstractBaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,R extends Archetype<G,A,R>>
@Nullable public G asGameObject()
GameObject
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 GameObjectFactory<G,A,R> gameObjectFactory)
newInstance
in interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,R extends Archetype<G,A,R>>
gameObjectFactory
- the game object factory for creating new game
objectspublic void visit(@NotNull BaseObjectVisitor<G,A,R> baseObjectVisitor)
visit()
function of a BaseObjectVisitor
.@NotNull public java.lang.String getArchetypeName()
getArchetypeName
in interface Archetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public void setArchetypeName(@NotNull java.lang.String archetypeName)
setArchetypeName
in interface Archetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
archetypeName
- the namepublic void setMultiX(int multiX)
public void setMultiY(int multiY)
public int getMultiX()
public int getMultiY()
public boolean isLowestPart()
isLowestPart
in interface Archetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public void setLowestPart(boolean isLowestPart)
setLowestPart
in interface Archetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
isLowestPart
- whether this part has the smallest y coordinatepublic int getMultiShapeID()
getMultiShapeID
in interface Archetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public void setMultiShapeID(int multiShapeID)
setMultiShapeID
in interface Archetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
multiShapeID
- the multi shape idpublic int getMultiPartNr()
getMultiPartNr
in interface Archetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public void setMultiPartNr(int multiPartNr)
setMultiPartNr
in interface Archetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
multiPartNr
- the multi part id@Nullable public java.lang.String getEditorFolder()
getEditorFolder
in interface Archetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public void setEditorFolder(@Nullable java.lang.String editorFolder)
setEditorFolder
in interface Archetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
editorFolder
- the editor folderpublic boolean isArtifact()
isArtifact
in interface Archetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
true
if this GameObject is an Artifact, otherwise false
.public void setArtifact()
setArtifact
in interface Archetype<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
Archetype.isArtifact()