예제 #1
0
파일: Canine.cs 프로젝트: andyblz/CDCSharp
        public void Bite(object target)
        {
            Feline victim = target as Feline;

            if (victim != null)
            {
                if (stamina > 0)
                {
                    victim.health   -= 20;
                    victim.strength -= 3;
                    stamina         -= 1;
                }
                else
                {
                    Console.WriteLine("Not enough stamina to fight.");
                }

                if (victim.health < 0 || victim.health == 0)
                {
                    Console.WriteLine("{0} WINS!", name);
                    Controller.GameOver();
                }

                if (victim.strength < 0)
                {
                    victim.strength = 0;
                }

                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("{0} bit {1}, causing {1} to lose 20 health, and 2 strength! {0} loses 1 stamina for fighting.", name, victim.name);
                Console.ResetColor();
            }
        }
예제 #2
0
파일: Canine.cs 프로젝트: andyblz/CDCSharp
        public void ShowEnemyStats(object target)
        {
            Feline victim = target as Feline;

            if (victim != null)
            {
                Console.WriteLine("\n");
                Console.BackgroundColor = ConsoleColor.Magenta;
                Console.ForegroundColor = ConsoleColor.Black;
                Console.WriteLine("{0}'S CURRENT STATS:", victim.name);
                Console.ResetColor();
                Console.WriteLine("Health: {0}.", victim.health);
                Console.WriteLine("Strength: {0}.", victim.strength);
                Console.WriteLine("Stamina: {0}.", victim.stamina);
            }
        }