Class GameObject
- java.lang.Object
-
- net.sf.gridarta.model.baseobject.GameObjectContainer<G,A,R>
-
- net.sf.gridarta.model.baseobject.AbstractBaseObject<G,A,R,G>
-
- net.sf.gridarta.model.gameobject.AbstractGameObject<GameObject,MapArchObject,Archetype>
-
- net.sf.gridarta.var.crossfire.model.gameobject.GameObject
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<GameObject>,Attributes,BaseObject<GameObject,MapArchObject,Archetype,GameObject>,GameObject<GameObject,MapArchObject,Archetype>
public class GameObject extends AbstractGameObject<GameObject,MapArchObject,Archetype>
Handles the Crossfire GameObjects. Usually, a GameObject that is really used is derived from a (replaceable) default arch.- See Also:
- Serialized Form
- Todo:
- this class is not always the best place for multi-part object handling,
see also
GameObjectContainerfor issues about this
-
-
Field Summary
Fields Modifier and Type Field Description static @NotNull java.lang.StringELEVATIONThe name of the "elevation" attribute.static @NotNull java.lang.StringINVISIBLEThe name of the "invisible" attribute.static @NotNull java.lang.StringSMOOTHLEVELThe name of the "smoothlevel" attribute.-
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
-
Fields inherited from interface net.sf.gridarta.model.gameobject.GameObject
EDITOR_FOLDER_INTERN
-
-
Constructor Summary
Constructors Constructor Description GameObject(@NotNull Archetype archetype, @NotNull FaceObjectProviders faceObjectProviders, @NotNull AnimationObjects animationObjects)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyMassChange(@NotNull java.lang.Integer @NotNull [] layers, @NotNull java.lang.Integer[] subLayers, @NotNull java.lang.String changes)Applies mass changes to the specified object if all the match conditions are met.@NotNull GameObjectclone()Creates a clone of this base object.intgetLightRadius()Returns the effective light radius of this game object.protected @NotNull GameObjectgetThis()Returnsthisas its real type.booleanisDefaultGameObject()Returns whether this game object is unmodified from its underlying archetype.booleanisEqual(@NotNull BaseObject<?,?,?,?> gameObject)Compares this object to another game object.booleanisScripted()Returns whether this GameObject has one or more scripted events defined.voidpropagateElevation(@NotNull BaseObject<?,?,?,?> gameObject)If there is elevation data in the other game object, move it to here.voidupdateTileStretch(int heightValue, boolean isAbsolute, @NotNull java.lang.Integer @Nullable [] subLayers)Updates the tile stretching value of the selected object.booleanusesDirection()Return whether this base object uses the "direction" attribute.-
Methods inherited from class net.sf.gridarta.model.gameobject.AbstractGameObject
asGameObject, getArchetype, getAttributeString, getContainer, getContainerGameObject, getEffectiveFaceName, getMapSquare, getMapSquareOptional, getNext, getPrev, getTopContainer, hasUndefinedArchetype, insertAfter, insertBefore, isBottom, isInContainer, isTop, markModified, moveBottom, moveDown, moveTop, moveUp, newInstance, notifyBeginChange, notifyEndChange, notifyTransientChange, remove, setArchetype, setContainer, visit
-
Methods inherited from class net.sf.gridarta.model.baseobject.AbstractBaseObject
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, getTypeNo, hasAttribute, hasAttribute, isHead, isMulti, isTail, removeAttribute, removeTailParts, setAttributeInt, setAttributeString, setEditType, setLoreText, setMapX, setMapY, setMsgText, setMulti, setObjectFace, setObjectText, setThisContainer, toString, updateArchetype
-
Methods inherited from class net.sf.gridarta.model.baseobject.GameObjectContainer
addFirst, addLast, getFirst, getLast, 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.Attributes
getAttributeDouble, getAttributeInt, getAttributeLong, getAttributeString, hasAttribute, removeAttribute, setAttributeInt
-
Methods inherited from interface net.sf.gridarta.model.baseobject.BaseObject
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, isHead, isMulti, isTail, removeTailParts, setAttributeString, setEditType, setLoreText, setMapX, setMapY, setMsgText, setMulti, setObjectFace, setObjectText, toString
-
-
-
-
Field Detail
-
ELEVATION
@NotNull public static final @NotNull java.lang.String ELEVATION
The name of the "elevation" attribute.- See Also:
- Constant Field Values
-
INVISIBLE
@NotNull public static final @NotNull java.lang.String INVISIBLE
The name of the "invisible" attribute.- See Also:
- Constant Field Values
-
SMOOTHLEVEL
@NotNull public static final @NotNull java.lang.String SMOOTHLEVEL
The name of the "smoothlevel" attribute.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GameObject
public GameObject(@NotNull @NotNull Archetype archetype, @NotNull @NotNull FaceObjectProviders faceObjectProviders, @NotNull @NotNull AnimationObjects animationObjects)Creates a new instance.- Parameters:
archetype- the base archetypefaceObjectProviders- the face object providers for looking up facesanimationObjects- the animation objects for looking up animations
-
-
Method Detail
-
propagateElevation
public void propagateElevation(@NotNull @NotNull BaseObject<?,?,?,?> gameObject)Description copied from interface:GameObjectIf there is elevation data in the other game object, move it to here.- Parameters:
gameObject- the other game object
-
updateTileStretch
public void updateTileStretch(int heightValue, boolean isAbsolute, @NotNull @NotNull java.lang.Integer @Nullable [] subLayers)Description copied from interface:GameObjectUpdates the tile stretching value of the selected object.- Parameters:
heightValue- height valueisAbsolute- whether the height change value is absolute or relativesubLayers- sub-layers to affect ornullto affect all layers
-
applyMassChange
public void applyMassChange(@NotNull @NotNull java.lang.Integer @NotNull [] layers, @NotNull @NotNull java.lang.Integer[] subLayers, @NotNull @NotNull java.lang.String changes)Description copied from interface:GameObjectApplies mass changes to the specified object if all the match conditions are met.- Parameters:
layers- layers to match, can be emptysubLayers- sub-layers to match, can be emptychanges- changes to apply
-
usesDirection
public boolean usesDirection()
Description copied from interface:BaseObjectReturn whether this base object uses the "direction" attribute.- Returns:
- whether this base object uses the "direction" attribute
-
clone
@NotNull public @NotNull GameObject clone()
Description copied from interface:BaseObjectCreates a clone of this base object.- Specified by:
clonein interfaceBaseObject<GameObject,MapArchObject,Archetype,GameObject>- Overrides:
clonein classAbstractGameObject<GameObject,MapArchObject,Archetype>
-
isScripted
public boolean isScripted()
Description copied from interface:GameObjectReturns whether this GameObject has one or more scripted events defined.- Returns:
trueif this GameObject has one or more scripted events, otherwisefalse
-
isDefaultGameObject
public boolean isDefaultGameObject()
Description copied from interface:BaseObjectReturns whether this game object is unmodified from its underlying archetype.- Specified by:
isDefaultGameObjectin interfaceBaseObject<GameObject,MapArchObject,Archetype,GameObject>- Overrides:
isDefaultGameObjectin classAbstractBaseObject<GameObject,MapArchObject,Archetype,GameObject>- 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.- Specified by:
isEqualin interfaceBaseObject<GameObject,MapArchObject,Archetype,GameObject>- Overrides:
isEqualin classAbstractBaseObject<GameObject,MapArchObject,Archetype,GameObject>- Parameters:
gameObject- the other game object- Returns:
trueif this object equals the other object
-
getThis
@NotNull protected @NotNull GameObject getThis()
Description copied from class:AbstractBaseObjectReturnsthisas its real type.- Specified by:
getThisin classAbstractBaseObject<GameObject,MapArchObject,Archetype,GameObject>- Returns:
this
-
getLightRadius
public int getLightRadius()
Description copied from interface:GameObjectReturns the effective light radius of this game object.- Returns:
- the effective light radius or
0if this object does not emit light
-
-