public class Shit extends Obj implements java.io.Serializable {
   static final long serialVersionUID = 2L;
   
   private static final int SHITLIMIT[] = {100*24*2, 100*24*4, 100*24*8};
   private int ageState;
   private int falldownDamage = 0;
   private int amount = 0;
   
   public Shit (int initX, int initY, int initZ, Body.AgeState initAgeState) {
      objType = Type.SHIT;
      x = initX;
      y = initY;
      z = initZ;
      ageState = initAgeState.ordinal();
      switch (initAgeState) {
      case BABY:
         amount = 100;
         break;
      case CHILD:
         amount = 100*2;
         break;
      case ADULT:
         amount = 100*4;
         break;
      }
      removed = false;
   }
   
   public int getAgeState() {
      return ageState;
   }
   
   public int getShitState() {
      if (age >= SHITLIMIT[ageState]/4) {
         return 1;
      }
      return 0;
   }
   
   public void eatShit(int eatAmount) {
      amount -= eatAmount;
      if (amount < 0) {
         amount = 0;
         removed = true;
      }
   }
   
   public Event clockTick()
   {
      if (removed == false)
      {
         age += TICK;
         if (age >= SHITLIMIT[ageState]) { removed = true; }
         if (!grabbed && z > 0)
         {
            z -= 2;
            falldownDamage += 2;
            if (z <= 0)
            {
               if (falldownDamage > 10) { age += SHITLIMIT[ageState]/2; }
               z = 0;
               falldownDamage = 0;
            }
         }
         return Event.DONOTHING;
      }
      return Event.REMOVED;
   }
}