/**
  * Change a pet's color to the paintbrush's color (if available). 
  *
  * Changes the pet's pet_specie_color_id and destroys the item.
  *
  * If a pet doesn't have the specific color built out in 
  * pet_specie_pet_specie_color, a failure message will be shown and the
  * item will not be destroyed.
  * 
  * @param Pet $pet 
  * @return string The success (or failure) message. 
  **/
 public function paint(Pet $pet)
 {
     $color = new PetSpecie_PetSpecieColor($this->db);
     $color = $color->findOneBy(array('pet_specie_id' => $pet->getPetSpecieId(), 'pet_specie_color_id' => $this->getPetSpecieColorId()));
     // It's possible that that particular color is not built out for
     // that species (ie, nobody f*****g drew it). Handle that.
     if ($color == null) {
         return "You put the brush down, realizing that this color is not available for your pet.";
     } elseif ($pet->getPetSpecieColorId() == $color->getPetSpecieColorId()) {
         return "You frown and notice that {$pet->getPetName()} is already painted in {$color->getColorName()}.";
     }
     $pet->setPetSpecieColorId($color->getPetSpecieColorId());
     $pet->save();
     $this->updateQuantity($this->getQuantity() - 1);
     return "{$pet->getPetName()} looks snazzy in <strong>{$color->getColorName()}</strong>!";
 }
 /**
  * Increase a pet's happiness level.
  *
  * Increases the pet's happiness level and destroys the item. 
  * 
  * @param Pet $pet 
  * @param integer $quantity
  * @return string The success message.
  **/
 public function playWith(Pet $pet, $quantity)
 {
     if ($quantity > $this->getQuantity()) {
         throw new ArgumentError("This stack does not have {$quantity} items.");
     }
     $pet->play($this->getHappinessBonus() * $quantity);
     $this->updateQuantity($this->getQuantity() - $quantity);
     return "{$pet->getPetName()} is happier now.";
 }
 /**
  * Feed the item to a specified pet.
  *
  * Increases pet's hunger level and destroys the item. 
  * 
  * @param Pet $pet 
  * @return string The success message. 
  **/
 public function feedTo(Pet $pet, $quantity)
 {
     if ($quantity > $this->getQuantity()) {
         throw new ArgumentError("This stack does not have {$quantity} items.");
     }
     // Do it before destroying the object.
     $pet->consume($this->getHungerBonus() * $quantity);
     $text = "You have fed {$pet->getPetName()} {$this->makeActionText($quantity)}.";
     $this->updateQuantity($this->getQuantity() - $quantity);
     return $text;
 }