Guest User

Untitled

a guest
Jun 25th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Arcadia_2._0
  7. {
  8.     class Program
  9.     {
  10.         int GenerateDamage(int finaldamage)
  11.         {
  12.  
  13.             Random rand; // Declares a new Random
  14.             rand = new Random(); //
  15.  
  16.             finaldamage = rand.Next(5, 20);
  17.  
  18.             return finaldamage; // Returns randomly generated final damage.
  19.         }
  20.  
  21.         int Defend(int blockvalue)
  22.         {
  23.             Random rand;
  24.             rand = new Random();
  25.  
  26.             blockvalue = rand.Next(1, 7);
  27.  
  28.             return blockvalue; //Returns your random block value.
  29.         }
  30.  
  31.         int HeroDamage(int herodam)
  32.         {
  33.             Random rand;
  34.             rand = new Random();
  35.  
  36.             herodam = rand.Next(2, 14);
  37.  
  38.             return herodam; //Returns your damage value.
  39.         }
  40.  
  41.         int MonsterDamage(int monsterdam)
  42.         {
  43.             Random rand;
  44.             rand = new Random();
  45.  
  46.             monsterdam = rand.Next(5, 9);
  47.  
  48.             return monsterdam; //Returns monsters damage value.
  49.         }
  50.         static void Main(string[] args)
  51.         {
  52.             Program program = new Program();
  53.             Random rand;
  54.             rand = new Random();
  55.  
  56.             int HeroHits;
  57.             int MonsterHits;
  58.             int BlockValue;
  59.             int BlockValueRaw;
  60.             int MonsterDamage;
  61.             int HeroDamage;
  62.             string startcombat;
  63.  
  64.             HeroHits = rand.Next(50, 100);
  65.             MonsterHits = rand.Next(50, 100);
  66.  
  67.             Console.WriteLine("Welcome to Thunder Dome. You're paid for fighting monsters");
  68.             Console.WriteLine("in the arena here. A lumbering beast trods out of the gates and");
  69.             Console.WriteLine("roars at you in anger. You draw your greatsword and rush at him");
  70.             Console.WriteLine("with anger in your eyes. Let the battle begin!");
  71.             Console.WriteLine("[Press Enter to Begin the Battle!]");
  72.             Console.ReadLine();
  73.  
  74.  
  75.             do
  76.             {
  77.                 Console.Write(@"
  78. ***************************************
  79. The Hero's Hitpoints are {0}
  80. The Monster's Hitpoints are {1}
  81. ***************************************
  82. ", HeroHits, MonsterHits);
  83.  
  84.                 Console.Write (@"
  85. ___________________________
  86. What dost thou wish to do?
  87. (A)ttack
  88. (D)efend
  89. ___________________________
  90. ");
  91.                 startcombat = Console.ReadLine();
  92.  
  93.  
  94.                 switch (startcombat)
  95.                
  96.                 {
  97.                     case "A":
  98.                     case "a":
  99.                         HeroDamage = program.HeroDamage(0);
  100.                         MonsterDamage = program.MonsterDamage(0);
  101.                         Console.WriteLine("You swing your shining greatsword, digging your blade into");
  102.                         Console.WriteLine("The creature's soft underbelly, causing it to screech in agony");
  103.                         Console.WriteLine("You deal {0} damage!", HeroDamage);
  104.                         MonsterHits -= HeroDamage;
  105.                         Console.WriteLine("The monster gnashes its jaws and rushes at you, swinging down");
  106.                         Console.WriteLine("with it's hand which was riddled with claws. It shreds through");
  107.                         Console.WriteLine("your armor, dealing {0} damage!", MonsterDamage);
  108.                         HeroHits -= MonsterDamage;
  109.                         break;
  110.  
  111.                     case "D":
  112.                     case "d":
  113.                         BlockValueRaw = program.Defend(0);
  114.                         MonsterDamage = program.MonsterDamage(0);
  115.                         BlockValue = MonsterDamage -= BlockValueRaw;
  116.                         Console.WriteLine("You lift your shield, bracing yourself for impact");
  117.                         Console.WriteLine("The creature rushes forward, snarling and hissing in attempt");
  118.                         Console.WriteLine("to bull-rush you.");
  119.                         Console.WriteLine("It's head make scontact with your shield, forcing you back onto");
  120.                         Console.WriteLine("the ground. You take {0} damage,", BlockValue);
  121.                         HeroHits -= BlockValue;
  122.                         Console.WriteLine("but it is lessened by your defensive stance!");
  123.                         break;
  124.                    
  125.                     default:
  126.                     MonsterDamage = program.MonsterDamage(0);
  127.                     Console.WriteLine("You were indecisive in your choice and the monster took initiative");
  128.                     Console.WriteLine("dealing critical damage! You were hit for {0}", (MonsterDamage * 2));
  129.                     HeroHits -= (MonsterDamage * 2);
  130.                     break;
  131.                 }
  132.             }
  133.             while (HeroHits >= 0 && MonsterHits >= 0);
  134.            
  135.             if (HeroHits >= 0)
  136.             {
  137.                 Console.WriteLine("You have defeated the monster");
  138.             }
  139.             else
  140.             {
  141.                 Console.WriteLine("The monster has defeated you");
  142.             }
  143.  
  144.             Console.ReadLine();
  145.  
  146.         }      
  147.  
  148.     }
  149.  
  150. }
Add Comment
Please, Sign In to add comment