Class DomesticAnimal
java.lang.Object
marauroa.common.game.Attributes
marauroa.common.game.SlotOwner
marauroa.common.game.RPObject
games.stendhal.server.entity.Entity
games.stendhal.server.entity.ActiveEntity
games.stendhal.server.entity.GuidedEntity
games.stendhal.server.entity.RPEntity
games.stendhal.server.entity.DressedEntity
games.stendhal.server.entity.npc.NPC
games.stendhal.server.entity.creature.Creature
games.stendhal.server.entity.creature.DomesticAnimal
- All Implemented Interfaces:
Killer
,Cloneable
,Iterable<String>
,Serializable
A domestic animal can be owned by a player;
each player can't own more than one domestic animal.
It has a weight; when it dies, it leaves an amount of meat, depending on its weight.
-
Nested Class Summary
Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID
-
Field Summary
Modifier and TypeFieldDescriptionprotected Player
The player who owns the domestic animal, or null if the animal is wild.protected boolean
protected int
Fields inherited from class games.stendhal.server.entity.creature.Creature
dropItemInstances, dropsItems, noises
Fields inherited from class games.stendhal.server.entity.npc.NPC
pauseDirection, pauseTurns, pauseTurnsRemaining, SOUND_RADIUS
Fields inherited from class games.stendhal.server.entity.RPEntity
atk, ATTR_TITLE, damageReceived, def, level, lv_cap, ratk, statusAttackers, statusList, totalDamageReceived
Fields inherited from class games.stendhal.server.entity.GuidedEntity
baseSpeed, pathnotifier
Fields inherited from class marauroa.common.game.RPObject
INVALID_ID
-
Constructor Summary
ConstructorDescriptionCreates a new wild DomesticAnimal.DomesticAnimal(RPObject object)
Creates a wild DomesticAnimal based on an existing RPObject.DomesticAnimal(RPObject object, Player owner)
Creates a wild DomesticAnimal based on an existing RPObject, and assigns it to a player. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
dropItemsOn(Corpse corpse)
Can be called when the sheep dies.getOwner()
int
protected void
protected void
handleSimpleCollision(int nx, int ny)
a simple collision is from tiled collision layer or the edge of the map.protected boolean
Is the owner of this pet calling its name or the type name like "pet"?protected void
void
void
setWeight(int weight)
protected boolean
Does this domestic animal take part in combat?void
update()
boolean
wasOwned()
Checks if this domestic animal was owned by a player, regardless of whether it is owned at the moment.Methods inherited from class games.stendhal.server.entity.creature.Creature
addDropItem, addDropItem, addDropItem, attack, clearDropItemList, equip, generateRPClass, getAIProfile, getAIProfiles, getAttackStrategy, getAttackTurn, getCorpseDeserver, getCorpseHeight, getCorpseName, getCorpseWidth, getDamageType, getEnemyList, getHarmlessCorpseName, getItemAtk, getItemRatk, getMaxRangeForArcher, getNearestEnemy, getNewInstance, getRangedDamageType, getRespawnPoint, getRespawnTime, getSusceptibility, hasTargetMoved, init, isAbnormal, isAttackable, isAttackTurn, isBoss, isEnemyNear, isPlayingMovementSound, isRare, isSpawned, logic, makeNoise, makeNoiseChance, notifyRegisteredObjects, onDead, registerObjectsForNotification, registerObjectsForNotification, setAIProfiles, setAttackStrategy, setBusy, setCorpse, setDamageTypes, setDeathSound, setHealer, setIdle, setMovementSound, setNoises, setRespawned, setRespawnPoint, setSusceptibilities, stopMovementSound, unregisterObjectsForNotification, unregisterObjectsForNotification
Methods inherited from class games.stendhal.server.entity.npc.NPC
checkPause, getIdea, getMovementRange, getPerceptionRange, getSounds, maybeMakeSound, maybeMakeSound, moveRandomly, onFinishedPath, say, setIdea, setMovement, setMovementRange, setPathCompletedPause, setPathCompletedPause, setPerceptionRange, setRandomPathFrom, setSounds, setSounds
Methods inherited from class games.stendhal.server.entity.DressedEntity
getOriginalOutfit, getOutfit, getOutfitColors, isNaked, put, restoreOriginalOutfit, setOutfit, setOutfit, setOutfit, setOutfit, setOutfit, setOutfit, setOutfitColor, setOutfitColor, setOutfitColor, setOutfitColors, setOutfitWithDetail, unsetOutfitColor
Methods inherited from class games.stendhal.server.entity.RPEntity
addAtkXP, addBaseMana, addDefXP, addKarma, addMana, addRatkXP, addStatusAttacker, addXP, applyDefXP, applyDistanceAttackModifiers, canDoRangeAttack, canHit, damage, damageDone, delayedDamage, describe, drop, drop, drop, dropDroppableItem, dropWithInfostring, dropWithInfostring, entityAsOnlinePlayer, entityAsPet, equip, equipOrPutOnGround, equipToInventoryOnly, getAllEquipped, getAllEquippedWithInfostring, getAmmunition, getArmor, getAtk, getAtkXP, getAttackingRPEntities, getAttackRate, getAttackSources, getAttackTarget, getBaseHP, getBaseMana, getBloodClass, getBoots, getCappedAtk, getCappedDef, getCappedRatk, getCloak, getDeathSound, getDef, getDefenseItems, getDefXP, getDescriptionName, getDroppables, getEquippedItemClass, getFirstEquipped, getHelmet, getHP, getItemDef, getKarma, getLanguage, getLegs, getLevel, getLVCap, getMana, getMissileIfNotHoldingOtherWeapon, getName, getNumberOfEquipped, getRangeWeapon, getRatk, getRatkXP, getRing, getsFightXpFrom, getShield, getSlotToEquip, getStatusList, getTitle, getTotalNumberOf, getWeapon, getWeapons, getXP, handleLifesteal, handlePortal, hasArmor, hasBoots, hasCloak, hasHelmet, hasLegs, hasLineOfSight, hasRing, hasShield, hasStatus, heal, heal, heal, incAtkXP, incDefXP, incRatkXP, initHP, isAttacked, isAttacking, isEquipped, isEquipped, isEquippedItemClass, isEquippedItemInSlot, isEquippedWithInfostring, isEquippedWithInfostring, isInvisibleToCreatures, makeCorpse, maybeDropDroppables, onAdded, onDamaged, onDead, onRemoved, rememberAttacker, rewardKillerAnimals, rewardKillers, sendPrivateText, sendPrivateText, setAtk, setAtkInternal, setAtkXP, setBaseHP, setBaseMana, setBlood, setDef, setDefInternal, setDefXP, setHP, setLevel, setLVCap, setMana, setName, setRatk, setRatkInternal, setRatkXP, setRatkXPInternal, setShadowStyle, setTarget, setTitle, setXP, stopAttack, stopAttacking, subXP, updateItemAtkDef, updateLevel, useKarma, useKarma, useKarma
Methods inherited from class games.stendhal.server.entity.GuidedEntity
addSuspend, addSuspend, applyMovement, atMovementRadius, clearPath, followPath, getBaseSpeed, getCollisionAction, getDirectionFromOrigin, getDistanceFromOrigin, getGuide, getPath, getPathPosition, hasPath, isPathLoop, onMoved, onNodeReached, onOutsideMovementRadius, removeSuspend, reroute, retracePath, setBaseSpeed, setCollisionAction, setPath, setPath, setPathAndPosition, setPathPosition, setRandomMovementRadius, setRandomMovementRadius, setRetracePath, setUsesRandomPath, stop, updateModifiedAttributes, usesRandomPath
Methods inherited from class games.stendhal.server.entity.ActiveEntity
canMoveTo, canMoveTo, faceto, faceToward, getDirection, getDirectionToward, getDirectionToward, getResistance, getSpeed, getStepsTaken, handleLeaveZone, ignoresCollision, isFacingToward, isGhost, isMoveCompleted, isZoneChangeAllowed, move, setDirection, setIgnoresCollision, setSpeed, stopped
Methods inherited from class games.stendhal.server.entity.Entity
getAdjacentNodes, getArea, getArea, getCursor, getDescription, getEntitySlot, getHeight, getOrigin, getResistance, getWidth, getX, getY, getZone, hasDescription, isInSight, isObstacle, nextTo, nextTo, notifyWorldAboutChanges, setCursor, setDescription, setEntityClass, setEntitySubclass, setMenu, setPosition, setResistance, setSize, setVisibility, slotIterator, slots, squaredDistance, squaredDistance
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, 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
-
Field Details
-
weight
protected int weight -
wasOwned
protected boolean wasOwned -
owner
The player who owns the domestic animal, or null if the animal is wild.
-
-
Constructor Details
-
DomesticAnimal
public DomesticAnimal()Creates a new wild DomesticAnimal. -
DomesticAnimal
Creates a wild DomesticAnimal based on an existing RPObject.- Parameters:
object
- object containing the data for the animal
-
DomesticAnimal
Creates a wild DomesticAnimal based on an existing RPObject, and assigns it to a player.- Parameters:
object
- owning player, ornull
owner
- The player who should own the sheep
-
-
Method Details
-
setOwner
-
takesPartInCombat
protected boolean takesPartInCombat()Does this domestic animal take part in combat?- Returns:
- true, if it can be attacked by creatures, false otherwise
-
getOwner
-
wasOwned
public boolean wasOwned()Checks if this domestic animal was owned by a player, regardless of whether it is owned at the moment.- Returns:
true
, if the creature had been owned, otherwisefalse
-
update
public void update() -
setWeight
public void setWeight(int weight) -
getWeight
public int getWeight() -
moveToOwner
protected void moveToOwner() -
dropItemsOn
Can be called when the sheep dies. Puts meat onto its corpse; the amount of meat depends on the domestic animal's weight.- Overrides:
dropItemsOn
in classCreature
- Parameters:
corpse
- The corpse on which to put the meat
-
handleObjectCollision
protected void handleObjectCollision()- Overrides:
handleObjectCollision
in classGuidedEntity
-
handleSimpleCollision
protected void handleSimpleCollision(int nx, int ny)Description copied from class:ActiveEntity
a simple collision is from tiled collision layer or the edge of the map.- Overrides:
handleSimpleCollision
in classActiveEntity
-
isOwnerCallingMe
protected boolean isOwnerCallingMe()Is the owner of this pet calling its name or the type name like "pet"?- Returns:
- boolean flag
-