Advertisement
EmoRz

NeighbourWars

May 16th, 2018
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.87 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Condition_Statement_Loop
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             NeighbourWars();
  10.         }
  11.  
  12.         private static void NeighbourWars()
  13.         {
  14.             var peshoDamage = int.Parse(Console.ReadLine());
  15.             var goshoDamage = int.Parse(Console.ReadLine());
  16.             //
  17.             var peshoHealth = 100;
  18.             var goshoHealth = 100;
  19.             //
  20.             var round = 0;
  21.             while (true)
  22.             {
  23.                 if (round % 2 == 0)
  24.                 {
  25.                     round++;
  26.                     goshoHealth -= peshoDamage;
  27.                     if (goshoHealth <= 0)
  28.                     {
  29.                         Console.WriteLine($"Pesho won in {round}th round.");
  30.                         break;
  31.                     }
  32.                     else
  33.                     {
  34.                         Console.Write("Pesho used Roundhouse kick and reduced ");
  35.                         Console.WriteLine($"Gosho to {goshoHealth} health.");
  36.                     }
  37.                 }
  38.                 else
  39.                 {
  40.                     round++;
  41.                     peshoHealth -= goshoDamage;
  42.                     if (peshoHealth <= 0)
  43.                     {
  44.                         Console.WriteLine($"Gosho won in {round}th round.");
  45.                         break;
  46.                     }
  47.                     else
  48.                     {
  49.                         Console.Write("Gosho used Thunderous fist and reduced");
  50.                         Console.WriteLine($" Pesho to {peshoHealth} health.");
  51.                     }
  52.                 }
  53.                 if (round % 3 == 0 && (peshoHealth > 0 || goshoHealth > 0))
  54.                 {
  55.                     peshoHealth += 10;
  56.                     goshoHealth += 10;
  57.                 }
  58.             }
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement