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

            if (victim != null)
            {
                if (stamina > 0)
                {
                    victim.health   -= 10;
                    victim.strength -= 1;
                    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} clawed {1}, causing {1} to lose 5 health, and 1 strength! {0} loses 1 stamina for fighting.", name, victim.name);
                Console.ResetColor();
            }
        }
예제 #2
0
파일: Feline.cs 프로젝트: andyblz/CDCSharp
        public void ShowEnemyStats(object target)
        {
            Canine victim = target as Canine;

            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);
            }
        }