예제 #1
0
        /** When an Animal attacks Gaurana it eats it and gains Strength
         * Depending on an area.Type the Strength gain is 2 (for Glade) or 3 (for any other area)
         */
        override public bool Collision(World world, Organism attackingOrganism)
        {
            int strengthToGain;

            if (world.AreaBoard[this.Location].Type == 0)
            {
                strengthToGain = 2;
            }
            else
            {
                strengthToGain = 3;
            }
            MainWindow.logInfo += this.ToString() + "(" + this.Strength + ") and eats it gaining " + strengthToGain + " Strength.\n";
            attackingOrganism.AddStrength(strengthToGain);
            world.NullToBoard(Location);
            this.Alive = false;
            return(true);
        }
예제 #2
0
 /** When a ThornEater attacks Thorn and eats it, it gains 2 Strength
  */
 override public bool Collision(World world, Organism attackingOrganism)
 {
     if (this.Strength > attackingOrganism.Strength)
     {
         MainWindow.logInfo += this.ToString() + "(" + this.Strength + ") and dies to its thorns.\n";
         return(false);
     }
     else
     {
         MainWindow.logInfo += this.ToString() + "(" + this.Strength + ") and eats it";
         if (attackingOrganism.GetType().Name == "ThornEater")
         {
             attackingOrganism.AddStrength(2);
             MainWindow.logInfo += " gaining 2 Strength";
         }
         world.NullToBoard(Location);
         this.Alive = false;
         Console.WriteLine(".");
         return(true);
     }
 }