All Implemented Interfaces:
Killer, Cloneable, Iterable<String>, Serializable
Direct Known Subclasses:
BabyDragon, Cat, PurpleDragon

public abstract class Pet extends DomesticAnimal
A pet is a domestic animal that can be owned by a player. It eats chicken from the ground. They move faster than sheep. Pets starve if they are not fed. They can die.
Author:
kymara
  • Field Details

    • HUNGER_HUNGRY

      protected static final int HUNGER_HUNGRY
      The amount of hunger that indicates hungry.
      See Also:
      Constant Field Values
    • HUNGER_STARVATION

      protected static final int HUNGER_STARVATION
      The amount of hunger that indicates starvation.
      See Also:
      Constant Field Values
    • MAX_WEIGHT

      public final int MAX_WEIGHT
      The weight at which the pet will stop eating.
      See Also:
      Constant Field Values
    • FAT_FACTOR

      public final int FAT_FACTOR
      Approximately how much slower he gets hungry if he's full weight.
      See Also:
      Constant Field Values
    • foodName

      protected List<String> foodName
    • medicineName

      protected List<String> medicineName
    • HP

      protected int HP
    • ATK

      protected int ATK
    • DEF

      protected int DEF
    • XP

      protected int XP
    • hunger

      protected int hunger
  • Constructor Details

    • Pet

      public Pet()
      Creates a new wild Pet.
    • Pet

      public Pet(RPObject object, Player owner)
      Creates a Pet based on an existing pet RPObject, and assigns it to a player.
      Parameters:
      object - object containing the data for the Pet
      owner - The player who should own the pet
  • Method Details

    • getFoodNames

      protected abstract List<String> getFoodNames()
    • getMedicineNames

      protected List<String> getMedicineNames()
    • generateRPClass

      public static void generateRPClass()
    • onDead

      public void onDead(Killer killer, boolean remove)
      Is called when the pet dies. Removes the dead pet from the owner.
      Overrides:
      onDead in class Creature
      Parameters:
      killer - The entity who caused the death, i.e. who did the last hit.
      remove - true iff this entity should be removed from the world. For almost everything remove is true, but not for the players, who are instead moved to afterlife ("reborn").
    • logic

      public void logic()
      Determines what the pet shall do next.
      Overrides:
      logic in class Creature
    • describe

      public String describe()
      Description copied from class: Entity
      Describes the entity (if a players looks at it).
      Overrides:
      describe in class RPEntity
      Returns:
      description from the players point of view
    • canGrow

      public boolean canGrow()
      does this pet even have another form?
    • grow

      public void grow()
      grow this pet into a new form