Class LifeDrainArea
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.LifeDrainArea
- All Implemented Interfaces:
MovementListener
,TurnListener
,Killer
,Cloneable
,Iterable<String>
,Serializable
An area that drains an RPEntity of HP while over it.
-
Nested Class Summary
Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID
-
Field Summary
Modifier and TypeFieldDescriptionprotected double
The ratio of HP to inflicted.protected int
The minimum damage inflicted.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
ConstructorDescriptionLifeDrainArea(int width, int height, int interval, double damageRatio, int minimumDamage)
Create a damaging area. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 void
handleRemoved(RPEntity entity)
An entity has left the area.Methods inherited from class games.stendhal.server.entity.mapstuff.area.OccupantArea
addTarget, beforeMove, handleMovement, 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
-
minimumDamage
protected int minimumDamageThe minimum damage inflicted. -
damageRatio
protected double damageRatioThe ratio of HP to inflicted.
-
-
Constructor Details
-
LifeDrainArea
public LifeDrainArea(int width, int height, int interval, double damageRatio, int minimumDamage)Create a damaging area.- Parameters:
width
- Width of this area.height
- Height of this area.interval
- How often damage is given while stationary (in turns).damageRatio
- The ratio of damage to inflict.minimumDamage
- The minimum damage to inflict.
-
-
Method Details
-
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.
-
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.
-