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
FieldsModifier and TypeFieldDescriptionprotected intThe damage inflicted each hit.protected doubleThe chance of damage while walking (0.0 - 1.0).protected RandomRandom number generator.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
ConstructorsConstructorDescriptionDamagingArea(int width, int height, int interval, int damage, double probability) Create a damaging area. -
Method Summary
Modifier and TypeMethodDescriptionprotected floatcalculateDefense(RPEntity entity) Calculate the entity's final defense value.protected 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 booleanhandleMovement(RPEntity entity) Apply actions done while moving.protected voidhandleRemoved(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, 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
-
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:
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.
-
handleMovement
Apply actions done while moving.- Overrides:
handleMovementin classOccupantArea- Parameters:
entity- The RPEntity that moved.- 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.
-