Advertisement
skipter

C# Fundamentals - Neighbours Wars Hardcore

Jun 4th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.44 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         int peshosDamage = int.Parse(Console.ReadLine());
  7.         int GoshosDamage = int.Parse(Console.ReadLine());
  8.  
  9.         int peshosHealth = 100;
  10.         int goshosHealth = 100;
  11.         int counter = 1;
  12.  
  13.         while (true)
  14.         {
  15.             if (counter % 2 == 1)
  16.             {
  17.                 goshosHealth -= peshosDamage;
  18.                 if (goshosHealth > 0)
  19.                 {
  20.                     Console.WriteLine($"Pesho used Roundhouse kick and reduced Gosho to {goshosHealth} health.");
  21.                 }
  22.  
  23.             }
  24.             else if (counter % 2 == 0)
  25.             {
  26.                 peshosHealth -= GoshosDamage;
  27.                 if (peshosHealth > 0)
  28.                 {
  29.                     Console.WriteLine($"Gosho used Thunderous fist and reduced Pesho to {peshosHealth} health.");
  30.                 }
  31.             }
  32.             if (counter % 3 == 0 && peshosHealth > 0 && goshosHealth > 0)
  33.             {
  34.                 goshosHealth += 10;
  35.                 peshosHealth += 10;
  36.             }
  37.             if (peshosHealth <= 0)
  38.             {
  39.                 Console.WriteLine($"Gosho won in {counter}th round.");
  40.                 break;
  41.             }
  42.  
  43.             else if (goshosHealth <= 0)
  44.             {
  45.                 Console.WriteLine($"Pesho won in {counter}th round.");
  46.                 break;
  47.             }
  48.             counter++;
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement