Class DamagingArea
java.lang.Object
marauroa.common.game.Attributes
marauroa.common.game.SlotOwner
marauroa.common.game.RPObject
games.stendhal.server.entity.Entity
games.stendhal.server.entity.mapstuff.area.AreaEntity
games.stendhal.server.entity.mapstuff.area.OccupantArea
games.stendhal.server.entity.mapstuff.area.DamagingArea
- All Implemented Interfaces:
MovementListener
,TurnListener
,Killer
,Cloneable
,Iterable<String>
,Serializable
An area that damages an RPEntity while over it.
-
Nested Class Summary
Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
The damage inflicted each hit.protected double
The chance of damage while walking (0.0 - 1.0).protected Random
Random number generator.Fields inherited from class games.stendhal.server.entity.mapstuff.area.OccupantArea
interval, playersOnly, targets
Fields inherited from class games.stendhal.server.entity.mapstuff.area.AreaEntity
ATTR_NAME
Fields inherited from class marauroa.common.game.RPObject
INVALID_ID
-
Constructor Summary
ConstructorDescriptionDamagingArea(int width, int height, int interval, int damage, double probability)
Create a damaging area. -
Method Summary
Modifier and TypeMethodDescriptionprotected float
calculateDefense(RPEntity entity)
Calculate the entity's final defense value.protected boolean
Inflict damage on an entity.protected boolean
handleAdded(RPEntity entity)
An entity has entered the area.protected boolean
handleInterval(RPEntity entity)
Apply actions done at regular intervals.protected boolean
handleMovement(RPEntity entity)
Apply actions done while moving.protected void
handleRemoved(RPEntity entity)
An entity has left the area.Methods inherited from class games.stendhal.server.entity.mapstuff.area.OccupantArea
addTarget, beforeMove, isOccupant, onAdded, onEntered, onExited, onMoved, onRemoved, onTurnReached, removeTarget, setPlayersOnly, update
Methods inherited from class games.stendhal.server.entity.mapstuff.area.AreaEntity
addBehaviour, generateRPClass, getDescriptionName, getName, getTitle, setName
Methods inherited from class games.stendhal.server.entity.Entity
describe, getAdjacentNodes, getArea, getArea, getCursor, getDescription, getEntitySlot, getHeight, getOrigin, getResistance, getResistance, getWidth, getX, getY, getZone, hasDescription, isInSight, isObstacle, nextTo, nextTo, notifyWorldAboutChanges, onMoved, setCursor, setDescription, setEntityClass, setEntitySubclass, setMenu, setPosition, setResistance, setSize, setVisibility, slotIterator, slots, squaredDistance, squaredDistance, stopped
Methods inherited from class marauroa.common.game.RPObject
addEvent, addLink, addLink, addMap, addSlot, addSlot, applyDifferences, clearEvents, clearVisible, clone, containsKey, equals, events, eventsIterator, fill, get, getBaseContainer, getBoolean, getContainer, getContainerBaseOwner, getContainerOwner, getContainerSlot, getDifferences, getDouble, getFromSlots, getID, getInt, getLink, getLinkedObject, getMap, getSlot, has, hashCode, hasLink, hasMap, hasSlot, hide, isContained, isEmpty, isHidden, isStorable, maps, put, put, put, put, readObject, remove, removeLink, removeMap, removeSlot, resetAddedAndDeleted, resetAddedAndDeletedMaps, resetAddedAndDeletedRPLink, resetAddedAndDeletedRPSlot, setAddedMaps, setAddedRPSlot, setContainer, setDeletedMaps, setDeletedRPSlot, setID, size, slots, slotsIterator, store, toString, unhide, unstore, writeObject, writeObject, writeToJson
Methods inherited from class marauroa.common.game.SlotOwner
deserializeRPSlots, fill, serializeRPSlots
Methods inherited from class marauroa.common.game.Attributes
add, applyDifferences, get, getBool, getDouble, getInt, getList, getLong, getRPClass, has, instanceOf, iterator, put, put, put, put, put, readFromMap, remove, resetAddedAndDeletedAttributes, setAddedAttributes, setDeletedAttributes, setRPClass, setRPClass, toAttributeString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface games.stendhal.server.core.events.MovementListener
getArea
-
Field Details
-
damage
protected int damageThe damage inflicted each hit. -
probability
protected double probabilityThe chance of damage while walking (0.0 - 1.0). -
rand
Random number generator.
-
-
Constructor Details
-
DamagingArea
public DamagingArea(int width, int height, int interval, int damage, double probability)Create a damaging area.- Parameters:
width
- Width of this areaheight
- Height of this areainterval
- How often damage is given while stationary (in turns).damage
- The amount of damage to inflict.probability
- The chance of damage while walking (0.0 - 1.0).
-
-
Method Details
-
calculateDefense
Calculate the entity's final defense value. Taken from new (potential replacement) combat code.- Parameters:
entity
-- Returns:
- defense value
-
doDamage
Inflict damage on an entity.- Parameters:
entity
- The entity to damage.- Returns:
false
if this entity should be removed from further processing,true
otherwise.
-
handleAdded
An entity has entered the area. This should not apply any actions thathandleMovement()
does.- Overrides:
handleAdded
in classOccupantArea
- Parameters:
entity
- The RPEntity that was added.- Returns:
false
if this entity should not be processed,true
otherwise.
-
handleInterval
Apply actions done at regular intervals.- Overrides:
handleInterval
in classOccupantArea
- Parameters:
entity
- The RPEntity occupant.- Returns:
false
if this entity should be removed from further processing,true
otherwise.
-
handleMovement
Apply actions done while moving.- Overrides:
handleMovement
in classOccupantArea
- Parameters:
entity
- The RPEntity that moved.- Returns:
false
if this entity should be removed from further processing,true
otherwise.
-
handleRemoved
An entity has left the area. This should not apply any actions thathandleMovement()
does.- Overrides:
handleRemoved
in classOccupantArea
- Parameters:
entity
- The RPEntity that was added.
-