public interface BaseObject<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,T extends BaseObject<G,A,R,T>> extends Attributes, java.lang.Cloneable, java.lang.Iterable<G>, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ANIM_SPEED
The name of the "anim_speed" attribute.
|
static java.lang.String |
ANIMATION
The attribute name of the object's animation.
|
static java.lang.String |
BLOCKSVIEW
The name of the "blocksview" attribute.
|
static java.lang.String |
DIRECTION
The attribute name of the object's direction.
|
static int |
EDIT_TYPE_NONE |
static java.lang.String |
FACE
The attribute name of the object's face.
|
static java.lang.String |
HP
The attribute name of the "hp" attribute.
|
static java.lang.String |
IS_ANIMATED
The attribute name of the "is_animated" flag.
|
static java.lang.String |
IS_TURNABLE
The name of the "is_turnable" attribute.
|
static java.lang.String |
LAST_HEAL
The name of the "last_heal" attribute.
|
static java.lang.String |
LEVEL
The name of the "level" attribute.
|
static java.lang.String |
NAME
The attribute name of the object's name.
|
static java.lang.String |
NO_PASS
The name of the "no_pass" attribute.
|
static java.lang.String |
NO_PICK
The name of the "no_pick" attribute.
|
static java.lang.String |
SLAYING
The name of the "slaying" attribute.
|
static java.lang.String |
SP
The attribute name of the "sp" attribute.
|
static java.lang.String |
TITLE
The attribute name of the object's title.
|
static java.lang.String |
TYPE
The attribute name of the object's type.
|
Modifier and Type | Method and Description |
---|---|
void |
addMsgTextLine(java.lang.String text)
Adds a line of message text.
|
void |
addObjectText(java.lang.String line)
Appends
text to the object text of this GameObject. |
void |
addTailPart(T tail)
Appends a tail to this GameObject.
|
T |
clone()
Creates a clone of this base object.
|
int |
countInvObjects()
Counts the number of all inventory items (recursively).
|
void |
facesReloaded()
Will be called whenever the archetype faces have been reloaded.
|
java.lang.String |
getAnimName()
DaiEditor only: Returns the name of the animation.
|
R |
getArchetype()
Returns the Archetype this GameObject is based on.
|
double |
getAttributeDouble(java.lang.String attributeName,
boolean queryArchetype)
Returns the requested attribute value of this GameObject as
double . |
int |
getAttributeInt(java.lang.String attributeName,
boolean queryArchetype)
Returns the requested attribute value of this GameObject as
int . |
long |
getAttributeLong(java.lang.String attributeName,
boolean queryArchetype)
Returns the requested attribute value of this GameObject as
long . |
java.lang.String |
getAttributeString(java.lang.String attributeName,
boolean queryArchetype)
Returns the requested attribute value of this GameObject as
String . |
java.lang.String |
getBestName()
Returns the name which is best appropriate to describe this GameObject.
|
int |
getDirection()
Returns the direction of this Archetype or GameObject.
|
int |
getEditType()
Returns the edit type.
|
java.lang.String |
getFaceName()
Returns the name of the face of this Archetype or GameObject.
|
java.lang.String |
getFaceObjName()
Returns the face name, can be from animation or face.
|
FaceSource |
getFaceObjSource()
Returns the
FaceSource of this base object. |
T |
getHead()
Return the head part of a multi-part object.
|
java.lang.String |
getLoreText()
Returns the map lore.
|
java.awt.Point |
getMapLocation()
Returns the coordinate of this GameObject on its map.
|
int |
getMapX()
Returns the X coordinate of this GameObject on its map.
|
int |
getMapY()
Returns the Y coordinate of this GameObject on its map.
|
int |
getMaxX()
Determines the maximum x-coordinate of any part relative to the head
part.
|
int |
getMaxY()
Determines the maximum y-coordinate of any part relative to the head
part.
|
int |
getMinX()
Determines the minimum x-coordinate of any part relative to the head
part.
|
int |
getMinY()
Determines the minimum y-coordinate of any part relative to the head
part.
|
java.lang.String |
getMsgText()
Returns the message bound to this object.
|
T |
getMultiNext()
Returns the next of this multi-part object.
|
int |
getMultiRefCount()
Returns the number of parts for multi-part heads.
|
javax.swing.ImageIcon |
getNormalImage()
Returns the normal face for this GameObject.
|
java.lang.String |
getObjectText()
Returns the object text of this GameObject as String.
|
java.lang.String |
getObjName()
Returns the name of the object as shown to the player.
|
int |
getSizeX()
Determines the horizontal extent in squares.
|
int |
getSizeY()
Determines the vertical extent in squares.
|
int |
getTypeNo()
Returns the type number of this Archetype.
|
boolean |
hasAttribute(java.lang.String attributeName,
boolean queryArchetype)
Returns whether an attribute name exists.
|
boolean |
isDefaultGameObject()
Returns whether this game object is unmodified from its underlying
archetype.
|
boolean |
isEqual(BaseObject<?,?,?,?> gameObject)
Compares this object to another game object.
|
boolean |
isHead()
Returns whether this object is a single-part object or the head of the
multi-part object.
|
boolean |
isMulti()
Returns whether this Archetype is a multi-part object.
|
boolean |
isTail()
Determines if this part is a tail part.
|
G |
newInstance(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 |
removeTailParts()
Removes all tail parts of this game object.
|
void |
setAttributeString(java.lang.String attributeName,
java.lang.String value)
Sets the String of an archetype attribute in the objectText.
|
void |
setEditType(int editType)
Sets the edit type.
|
void |
setLoreText(java.lang.CharSequence loreText)
Sets the map lore.
|
void |
setMapX(int mapX)
Sets the X coordinate of this GameObject on its map.
|
void |
setMapY(int mapY)
Sets the Y coordinate of this GameObject on its map.
|
void |
setMsgText(java.lang.String msgText)
Sets the message text.
|
void |
setMulti(MultiArchData<G,A,R,T> multi) |
void |
setObjectFace()
We set here the real face of the objects, depending on the set face and
the set animation.
|
void |
setObjectText(java.lang.String objectText)
Sets
objectText as object text of this GameObject. |
java.lang.String |
toString(java.lang.String format)
Returns a string representation of this game object.
|
boolean |
usesDirection()
Return whether this base object uses the "direction" attribute.
|
void |
visit(BaseObjectVisitor<G,A,R> baseObjectVisitor)
Calls the appropriate
visit() function of a BaseObjectVisitor . |
getAttributeDouble, getAttributeInt, getAttributeLong, getAttributeString, hasAttribute, removeAttribute, setAttributeInt
static final int EDIT_TYPE_NONE
@NotNull static final java.lang.String ANIMATION
@NotNull static final java.lang.String DIRECTION
@NotNull static final java.lang.String FACE
@NotNull static final java.lang.String NAME
@NotNull static final java.lang.String TYPE
@NotNull static final java.lang.String TITLE
@NotNull static final java.lang.String IS_ANIMATED
@NotNull static final java.lang.String IS_TURNABLE
@NotNull static final java.lang.String HP
@NotNull static final java.lang.String SP
@NotNull static final java.lang.String NO_PASS
@NotNull static final java.lang.String NO_PICK
@NotNull static final java.lang.String LEVEL
@NotNull static final java.lang.String SLAYING
@NotNull static final java.lang.String LAST_HEAL
@NotNull static final java.lang.String BLOCKSVIEW
@NotNull static final java.lang.String ANIM_SPEED
int getTypeNo()
@Nullable java.lang.String getFaceName()
int countInvObjects()
boolean hasAttribute(@NotNull java.lang.String attributeName, boolean queryArchetype)
attributeName
- the attribute namequeryArchetype
- whether to query the Archetype of this GameObject:
true
if the Archetype should be queried as well, false
to
ignore it.@NotNull 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.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)
int getAttributeInt(@NotNull java.lang.String attributeName, boolean queryArchetype)
int
.attributeName
- the name of the attribute to searchqueryArchetype
- whether to query the archetype of this game objectAttributes.getAttributeInt(String)
,
getAttributeString(String, boolean)
long getAttributeLong(@NotNull java.lang.String attributeName, boolean queryArchetype)
long
.attributeName
- the name of the attribute to searchqueryArchetype
- whether to query the archetype of this game objectAttributes.getAttributeLong(String)
,
getAttributeString(String, boolean)
double getAttributeDouble(@NotNull java.lang.String attributeName, boolean queryArchetype)
double
.attributeName
- the name of the attribute to searchqueryArchetype
- whether to query the archetype of this game objectAttributes.getAttributeDouble(String)
,
getAttributeString(String, boolean)
void setAttributeString(@NotNull java.lang.String attributeName, @NotNull java.lang.String value)
attributeName
- search for "attributeName <string>"value
- the value to setvoid notifyBeginChange()
void notifyEndChange()
void notifyTransientChange()
@NotNull R getArchetype()
this
.int getEditType()
void setEditType(int editType)
editType
- the edit typevoid addMsgTextLine(@NotNull java.lang.String text)
text
- the text to append to message text@Nullable java.lang.String getMsgText()
null
.void setMsgText(@Nullable java.lang.String msgText)
msgText
- the message textint getMapX()
getMapY()
int getMapY()
getMapX()
java.awt.Point getMapLocation()
void setMapX(int mapX)
mapX
- the x coordinatevoid setMapY(int mapY)
mapY
- the y coordinateboolean isHead()
true
if single-part or head of multi-part, otherwise
false
@Nullable T getMultiNext()
null
if this isn't
a multi-part object or this is the last part of a multi-part objectint getMultiRefCount()
void addTailPart(@NotNull T tail)
tail
- the tail to appendvoid removeTailParts()
isMulti()
will return false
.T getHead()
boolean isTail()
true
iff this part if a tail partint getSizeX()
int getSizeY()
int getMaxX()
int getMaxY()
int getMinX()
int getMinY()
@NotNull java.lang.String getObjName()
@NotNull java.lang.String getBestName()
@NotNull java.lang.String getObjectText()
void addObjectText(@NotNull java.lang.String line)
text
to the object text of this GameObject.line
- a line of text to append, may contain '\n' for appending
multiple linesvoid setObjectText(@NotNull java.lang.String objectText)
objectText
as object text of this GameObject.objectText
- the text to set as object textboolean isDefaultGameObject()
boolean isEqual(@NotNull BaseObject<?,?,?,?> gameObject)
gameObject
- the other game objecttrue
if this object equals the other objectint getDirection()
@NotNull FaceSource getFaceObjSource()
FaceSource
of this base object.@Nullable java.lang.String getAnimName()
boolean isMulti()
true
if this Archetype is a multi-part object, otherwise
false
void setMulti(@NotNull MultiArchData<G,A,R,T> multi)
@Nullable java.lang.String getFaceObjName()
void setObjectFace()
@NotNull javax.swing.ImageIcon getNormalImage()
@NotNull T clone()
@NotNull java.lang.String getLoreText()
void setLoreText(@NotNull java.lang.CharSequence loreText)
loreText
- the map lore@NotNull G newInstance(@NotNull GameObjectFactory<G,A,R> gameObjectFactory)
gameObjectFactory
- the game object factory for creating new game
objectsvoid visit(@NotNull BaseObjectVisitor<G,A,R> baseObjectVisitor)
visit()
function of a BaseObjectVisitor
.baseObjectVisitor
- the base object visitorboolean usesDirection()
void facesReloaded()
@NotNull java.lang.String toString(@NotNull java.lang.String format)
format
string which supports the
following replacements:
format
- the format to use