Exemplo n.º 1
0
        public void Brawl(Pirate otherPirate)
        {
            if (otherPirate.IsDead || IsDead)               //check for pirates condition
            {
                Console.WriteLine("He's dead.");
                return;
            }
            else if (otherPirate.IsPassedOut || IsPassedOut)
            {
                Console.WriteLine("He's done for today");
                return;
            }

            //generate the random number from array and save it to chance
            Random random = new Random();
            int    chance = random.Next(1, 4);

            switch (chance)                                     //three cases for the otcome of Brawl
            {
            case 1:
                otherPirate.Die();
                break;

            case 2:
                Die();
                break;

            case 3:
                otherPirate.PassOut();
                PassOut();
                break;
            }
        }
Exemplo n.º 2
0
        public void Brawl(Pirate pirateTwo)
        {
            Random random = new Random();
            int    chance = random.Next(1, 4);

            if (!pirateTwo.IsNotDead)
            {
                Console.WriteLine("Can't fight dead pirate.");
                return;
            }

            switch (chance)
            {
            case 1:
                this.Die();
                Console.WriteLine($"{Name} is dead.");
                break;

            case 2:
                pirateTwo.Die();
                Console.WriteLine($"{pirateTwo.Name} is dead.");
                break;

            case 3:
                Console.WriteLine("Both pirates passed out.");
                break;
            }
        }
Exemplo n.º 3
0
        public static void Brawl(Pirate pirate1, Pirate pirate2)
        {
            Random rand   = new Random();
            int    chance = rand.Next(1, 33);

            if (pirate1.health != 1 || pirate2.health != 1)
            {
                if (pirate1.health == 1)
                {
                    pirate1.DrinkSomeRum();
                }
                pirate2.DrinkSomeRum();
            }
            else if (chance <= 11)
            {
                pirate1.DrinkSomeRum();
                pirate2.DrinkSomeRum();
            }
            else if (chance <= 22 && chance > 11)
            {
                pirate1.Die();
                Console.WriteLine(pirate1.name + " died whit a " + chance + "/33 chance");
            }
            else if (chance > 23)
            {
                pirate2.Die();
                Console.WriteLine(pirate2.name + " died whit a " + chance + "/33 chance");
            }
        }
Exemplo n.º 4
0
        public void Brawl(Pirate anotherPirate)
        {
            int randomNumber = random.Next(3);

            if (randomNumber == 0)
            {
                Die();
            }
            else if (randomNumber == 1)
            {
                anotherPirate.Die();
            }
            else
            {
                State = "passed out";
                anotherPirate.State = "passed out";
            }
        }
Exemplo n.º 5
0
 // Brawl(x) - where pirate fights another pirate (if that other pirate is alive) and
 // there's a 1/3 chance, 1 dies, the other dies or they both pass out.
 public void Brawl(Pirate name)
 {
     if (name.IsAlive)
     {
         var randomChance = new Random().Next(1, 4);
         if (randomChance == 1)
         {
             Die();
             Console.WriteLine($"{Name} has died");
         }
         else if (randomChance == 2)
         {
             name.Die();
             Console.WriteLine($"{name.Name} has died");
         }
         else
         {
             IsPassedOut      = true;
             name.IsPassedOut = true;
             Console.WriteLine($"{Name} and {name.Name} is passed out");
         }
     }
 }
Exemplo n.º 6
0
        public void Brawl(Pirate enemy)
        {
            var ranNum = new Random().Next(1, 4);

            switch (ranNum)
            {
            case 1:
                enemy.Die();
                Console.WriteLine("{Name}killed{ enemy.Name}.");
                break;

            case 2:
                Die();
                Console.WriteLine("{enemy.Name} killed {Name}.");
                break;

            case 3:
                enemy.Sleep();
                Sleep();
                Console.WriteLine("Both passed out.");
                break;
            }
        }
Exemplo n.º 7
0
 public string GetShipStatus()
 {
     return("Our captain's passed out: " + captain.PassOut() + " or is he still alive: " + captain.Die() + " and he drunk how much: " + captain.DrinkSomeRum());
 }