Пример #1
0
        public void FightWith(Command command)
        {
            ((Player.PlayerStrategy)player.Strategy).SetWeapon(command);
            Weapon playerWeapon   = player.SelectWeapon();
            Weapon creatureWeapon = creature.SelectWeapon();

            int result = CompareWeapon(playerWeapon, creatureWeapon);

            switch (result)
            {
            case 1:
                creature.TakeDamage(player.GetDamage(playerWeapon));
                Console.WriteLine("YOU HAVE WON.");
                Console.WriteLine("Creature have {0}/{1} HP", creature.Hitpoints, creature.MaxHP);
                break;

            case 0:
                Console.WriteLine("DRAW.");
                break;

            case -1:
                player.TakeDamage(creature.GetDamage(creatureWeapon));
                Console.WriteLine("YOU HAVE LOST.");
                Console.WriteLine("You have {0}/{1} HP", player.Hitpoints, player.MaxHP);

                break;
            }

            IsInFight = !EvaluateFight();
        }