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
FieldsModifier and TypeFieldDescriptionprotected doubleThe ratio of HP to inflicted.protected intThe minimum damage inflicted.Fields inherited from class games.stendhal.server.entity.mapstuff.area.OccupantArea
interval, playersOnly, targetsFields inherited from class games.stendhal.server.entity.mapstuff.area.AreaEntity
ATTR_NAMEFields inherited from class marauroa.common.game.RPObject
INVALID_ID -
Constructor Summary
ConstructorsConstructorDescriptionLifeDrainArea(int width, int height, int interval, double damageRatio, int minimumDamage) Create a damaging area. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanInflict damage on an entity.protected booleanhandleAdded(RPEntity entity) An entity has entered the area.protected booleanhandleInterval(RPEntity entity) Apply actions done at regular intervals.protected voidhandleRemoved(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, updateMethods inherited from class games.stendhal.server.entity.mapstuff.area.AreaEntity
addBehaviour, generateRPClass, getDescriptionName, getName, getTitle, setNameMethods 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, stoppedMethods 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, writeToJsonMethods inherited from class marauroa.common.game.SlotOwner
deserializeRPSlots, fill, serializeRPSlotsMethods 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, toAttributeStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods 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:
falseif this entity should be removed from further processing,trueotherwise.
-
handleAdded
An entity has entered the area. This should not apply any actions thathandleMovement()does.- Overrides:
handleAddedin classOccupantArea- Parameters:
entity- The RPEntity that was added.- Returns:
falseif this entity should not be processed,trueotherwise.
-
handleInterval
Apply actions done at regular intervals.- Overrides:
handleIntervalin classOccupantArea- Parameters:
entity- The RPEntity occupant.- Returns:
falseif this entity should be removed from further processing,trueotherwise.
-
handleRemoved
An entity has left the area. This should not apply any actions thathandleMovement()does.- Overrides:
handleRemovedin classOccupantArea- Parameters:
entity- The RPEntity that was added.
-