Class Sheep
java.lang.Object
- All Implemented Interfaces:
Killer,Cloneable,Iterable<String>,Serializable
- Author:
- Daniel Herding
-
Nested Class Summary
Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static intThe amount of hunger that indicates extremely hungry.protected static intThe amount of hunger that indicates hungry.protected static intThe amount of hunger that indicates starvation.static intThe weight at which the sheep will stop eating.Fields inherited from class games.stendhal.server.entity.creature.DomesticAnimal
owner, wasOwned, weightFields inherited from class games.stendhal.server.entity.creature.Creature
dropItemInstances, dropsItems, noisesFields inherited from class games.stendhal.server.entity.npc.NPC
pauseDirection, pauseTurns, pauseTurnsRemaining, SOUND_RADIUSFields inherited from class games.stendhal.server.entity.RPEntity
atk, ATTR_TITLE, damageReceived, def, level, lv_cap, ratk, statusAttackers, statusList, totalDamageReceivedFields inherited from class games.stendhal.server.entity.GuidedEntity
baseSpeed, pathnotifierFields inherited from class marauroa.common.game.RPObject
INVALID_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondescribe()Describes the entity (if a players looks at it).protected voidLet the sheep eat some food.static voidgetFoodinRange(double range)Returns a list of SheepFood in the given range ordered by distance.voidlogic()Determines what the sheep shall do next.voidIs called when the sheep dies.protected booleanonHungry()Called when the sheep is hungry.protected voidonIdle()Called when the sheep is idle.protected voidonStarve()Called when the sheep is starving.protected booleanvoidsetAttackStrategy(Map<String,String> aiProfiles)Set the fighting strategy used by the creature.Methods inherited from class games.stendhal.server.entity.creature.DomesticAnimal
dropItemsOn, getOwner, getWeight, handleObjectCollision, handleSimpleCollision, isOwnerCallingMe, moveToOwner, setOwner, setWeight, takesPartInCombat, update, wasOwnedMethods inherited from class games.stendhal.server.entity.creature.Creature
addDropItem, addDropItem, addDropItem, attack, clearDropItemList, equip, 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, makeNoise, makeNoiseChance, notifyRegisteredObjects, registerObjectsForNotification, registerObjectsForNotification, setAIProfiles, setBusy, setCorpse, setDamageTypes, setDeathSound, setHealer, setIdle, setMovementSound, setNoises, setRespawned, setRespawnPoint, setSusceptibilities, stopMovementSound, unregisterObjectsForNotification, unregisterObjectsForNotificationMethods 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, setSoundsMethods 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, unsetOutfitColorMethods inherited from class games.stendhal.server.entity.RPEntity
addAtkXP, addBaseMana, addDefXP, addKarma, addMana, addRatkXP, addStatusAttacker, addXP, applyDefXP, applyDistanceAttackModifiers, canDoRangeAttack, canHit, damage, damageDone, delayedDamage, 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, useKarmaMethods 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, usesRandomPathMethods 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, stoppedMethods 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, squaredDistanceMethods 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, 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, spliterator
-
Field Details
-
HUNGER_HUNGRY
protected static final int HUNGER_HUNGRYThe amount of hunger that indicates hungry.- See Also:
- Constant Field Values
-
HUNGER_EXTREMELY_HUNGRY
protected static final int HUNGER_EXTREMELY_HUNGRYThe amount of hunger that indicates extremely hungry.- See Also:
- Constant Field Values
-
HUNGER_STARVATION
protected static final int HUNGER_STARVATIONThe amount of hunger that indicates starvation.- See Also:
- Constant Field Values
-
MAX_WEIGHT
public static final int MAX_WEIGHTThe weight at which the sheep will stop eating.- See Also:
- Constant Field Values
-
-
Constructor Details
-
Sheep
public Sheep()Creates a new wild Sheep. -
Sheep
Creates a new Sheep that is owned by a player.- Parameters:
owner- owning player, ornull
-
Sheep
Creates a Sheep based on an existing sheep RPObject, and assigns it to a player.- Parameters:
object- object containing the data for the sheepowner- The player who should own the sheep
-
-
Method Details
-
setAttackStrategy
Description copied from class:CreatureSet the fighting strategy used by the creature.- Overrides:
setAttackStrategyin classCreature- Parameters:
aiProfiles- AI profiles to be used when deciding the strategy
-
generateRPClass
public static void generateRPClass() -
onDead
Is called when the sheep dies. Removes the dead sheep from the owner. -
getFoodinRange
Returns a list of SheepFood in the given range ordered by distance. The first in list is the nearest.- Parameters:
range- The maximum distance to a SheepFood- Returns:
- a list of SheepFood or emptyList if none is found in the given range
-
onHungry
protected boolean onHungry()Called when the sheep is hungry.- Returns:
trueif the sheep is hunting for food.
-
searchForFood
protected boolean searchForFood() -
onIdle
protected void onIdle()Called when the sheep is idle. -
onStarve
protected void onStarve()Called when the sheep is starving. -
eat
Let the sheep eat some food.- Parameters:
food- The food to eat.
-
logic
public void logic()Determines what the sheep shall do next. -
describe
Description copied from class:EntityDescribes the entity (if a players looks at it).
-