Advertisement
Razelda

D&D C_maker

Mar 4th, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 9.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Razeldas_D_and_D_C_Builder
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.ForegroundColor = ConsoleColor.Green;
  14.             Console.SetWindowSize(60, 50);
  15.             Console.WriteLine("What would you like to name your Charactor? :");
  16.             string cname = Console.ReadLine();
  17.  
  18.             Console.WriteLine("What is the Race of this Charactor? :");
  19.             string crace = Console.ReadLine();
  20.  
  21.             Random rnd = new Random();
  22.             int STR = rnd.Next(1, 21);
  23.             int DEX = rnd.Next(1, 21);
  24.             int CON = rnd.Next(1, 21);
  25.             int INT = rnd.Next(1, 21);
  26.             int WIS = rnd.Next(1, 21);
  27.             int CHA = rnd.Next(1, 21);
  28.  
  29.             int STRmod;
  30.             int DEXmod;
  31.             int CONmod;
  32.             int INTmod;
  33.             int WISmod;
  34.             int CHAmod;
  35.             int clvl2;
  36.             String chclass;
  37.  
  38.  
  39.             clevel(STR, out STR,DEX,out DEX,CON,out CON,INT,out INT,WIS,out WIS,CHA,out CHA,out clvl2);
  40.  
  41.             Ch_Class(out STRmod, out DEXmod, out CONmod, out INTmod, out WISmod, out CHAmod,out chclass);
  42.  
  43.  
  44.             output(STR, DEX, CON, INT, WIS, CHA, STRmod, DEXmod, CONmod, INTmod, WISmod, CHAmod, cname, crace, chclass, clvl2);
  45.  
  46.  
  47.  
  48.         }
  49.  
  50.         static void clevel(int STR1, out int STR, int DEX1, out int DEX, int CON1, out int CON, int INT1, out int INT, int WIS1, out int WIS,int CHA1,out int CHA,out int clvl2)
  51.         {
  52.             int rp = 0;
  53.             do
  54.             {
  55.                 String clvl1 = "1";
  56.                 Console.WriteLine("What Level is this Character starting out at? (defalt 1)");
  57.                 clvl1 = Console.ReadLine();
  58.                 clvl2 = 1;
  59.                 try
  60.                 {
  61.                     clvl2 = Convert.ToInt32(clvl1);
  62.                 }
  63.                 catch (FormatException e)
  64.                 {
  65.                     Console.WriteLine();
  66.                 }
  67.                 catch (OverflowException e)
  68.                 {
  69.                     Console.WriteLine();
  70.                 }
  71.                
  72.  
  73.                 if (clvl2 > 20)
  74.                 {
  75.                     rp = +1;
  76.                     Console.WriteLine("D&D dose not go higher then 20");
  77.                     STR = STR1;
  78.                     DEX = DEX1;
  79.                     CON = CON1;
  80.                     INT = INT1;
  81.                     WIS = WIS1;
  82.                     CHA = CHA1;
  83.                     clvl2 = 1;
  84.                 }
  85.                 else if (clvl2 > 1 )
  86.                 {
  87.                     rp = +1;
  88.                     STR = STR1 + clvl2;
  89.                     DEX = DEX1 + clvl2;
  90.                     CON = CON1 + clvl2;
  91.                     INT = INT1 + clvl2;
  92.                     WIS = WIS1 + clvl2;
  93.                     CHA = CHA1 + clvl2;
  94.                 }
  95.                 else
  96.                 {
  97.                     rp = +1;
  98.                     STR = STR1;
  99.                     DEX = DEX1;
  100.                     CON = CON1;
  101.                     INT = INT1;
  102.                     WIS = WIS1;
  103.                     CHA = CHA1;
  104.                 }
  105.  
  106.              } while(rp < 0);
  107.                
  108.  
  109.  
  110.         }
  111.  
  112.         static void Ch_Class(out int STRmod, out int DEXmod, out int CONmod, out int INTmod, out int WISmod, out int CHAmod, out String chclass)
  113.         {
  114.             Console.WriteLine();
  115.             Console.WriteLine("Select a Class Type:");
  116.             Console.WriteLine("A: Warror");
  117.             Console.WriteLine("B: Wizard");
  118.             Console.WriteLine("C: Bard");
  119.             int selection = 0;
  120.             selection = (int)Console.ReadKey().Key;
  121.  
  122.            
  123.             if (selection == 65) //a Selected
  124.             {
  125.                 STRmod = 0 + 2;
  126.                 DEXmod = 0 + 2;
  127.                 CONmod = 0 + 1;
  128.                 INTmod = 0 - 3;
  129.                 WISmod = 0 - 2;
  130.                 CHAmod = 0 - 4;
  131.                 chclass = "Warror";
  132.             }
  133.             else if (selection == 66) // b Selected
  134.             {
  135.                 STRmod = 0 - 2;
  136.                 DEXmod = 0 - 2;
  137.                 CONmod = 0 - 1;
  138.                 INTmod = 0 + 4;
  139.                 WISmod = 0 + 2;
  140.                 CHAmod = 0 - 4;
  141.                 chclass = "Wizard";
  142.             }
  143.             else if (selection == 67) // c Selected
  144.             {
  145.                 STRmod = 0 - 2;
  146.                 DEXmod = 0 - 2;
  147.                 CONmod = 0 + 1;
  148.                 INTmod = 0 + 1;
  149.                 WISmod = 0 + 3;
  150.                 CHAmod = 0 + 2;
  151.                 chclass = "Bard";
  152.             }
  153.             else
  154.             {
  155.                 STRmod = 0;
  156.                 DEXmod = 0;
  157.                 CONmod = 0;
  158.                 INTmod = 0;
  159.                 WISmod = 0;
  160.                 CHAmod = 0;
  161.                 chclass = "None";
  162.             }
  163.  
  164.             Console.WriteLine(Environment.NewLine);
  165.  
  166.  
  167.  
  168.         }
  169.  
  170.         static void output(int STR,int DEX, int CON, int INT,int WIS, int CHA, int STRmod, int DEXmod, int CONmod, int INTmod, int WISmod, int CHAmod, string cname, string crace, string chclass, int clvl2)
  171.         {
  172.             Console.Clear();
  173.  
  174.             string STR2 = STR.ToString("00");
  175.             string DEX2 = DEX.ToString("00");
  176.             string CON2 = CON.ToString("00");
  177.             string INT2 = INT.ToString("00");
  178.             string WIS2 = WIS.ToString("00");
  179.             string CHA2 = CHA.ToString("00");
  180.  
  181.             int TSTR = STR + STRmod;
  182.             int TDEX = DEX + DEXmod;
  183.             int TCON = CON + CONmod;
  184.             int TINT = INT + INTmod;
  185.             int TWIS = WIS + WISmod;
  186.             int TCHA = CHA + CHAmod;
  187.  
  188.             string TSTR2 = TSTR.ToString("00");
  189.             string TDEX2 = TDEX.ToString("00");
  190.             string TCON2 = TCON.ToString("00");
  191.             string TINT2 = TINT.ToString("00");
  192.             string TWIS2 = TWIS.ToString("00");
  193.             string TCHA2 = TCHA.ToString("00");
  194.  
  195.             String STRmod2;
  196.             STR_PosNeg(STRmod, out STRmod2);
  197.  
  198.             String DEXmod2;
  199.             STR_PosNeg(DEXmod, out DEXmod2);
  200.  
  201.             String CONmod2;
  202.             STR_PosNeg(CONmod, out CONmod2);
  203.  
  204.             String INTmod2;
  205.             STR_PosNeg(INTmod, out INTmod2);
  206.  
  207.             String WISmod2;
  208.             STR_PosNeg(WISmod, out WISmod2);
  209.  
  210.             String CHAmod2;
  211.             STR_PosNeg(CHAmod, out CHAmod2);
  212.  
  213.             Console.WriteLine();
  214.             Console.WriteLine(" Character Name: {0}", cname);
  215.             Console.WriteLine(" Level: {0}", clvl2);
  216.             Console.WriteLine(" Race: {0}", crace);
  217.             Console.WriteLine(" Class: {0}", chclass);
  218.             Console.WriteLine();
  219.             Console.WriteLine(" ***************************************");
  220.             Console.WriteLine(" ***************************************");
  221.             Console.WriteLine(" ** Ability Name          | MOD | New **");
  222.             Console.WriteLine(" ***************************************");
  223.             Console.WriteLine(" ** Strength        =  {0} |  {1} |  {2} **", STR2,STRmod2,TSTR2);
  224.             Console.WriteLine(" ** Dexterity       =  {0} |  {1} |  {2} **", DEX2,DEXmod2,TDEX2);
  225.             Console.WriteLine(" ** Constitution    =  {0} |  {1} |  {2} **", CON2,CONmod2,TCON2);
  226.             Console.WriteLine(" ** Intelligence    =  {0} |  {1} |  {2} **", INT2,INTmod2,TINT2);
  227.             Console.WriteLine(" ** Wisdom          =  {0} |  {1} |  {2} **", WIS2,WISmod2,TWIS2);
  228.             Console.WriteLine(" ** Charisma        =  {0} |  {1} |  {2} **", CHA2,CHAmod2,TCHA2);
  229.             Console.WriteLine(" ***************************************");
  230.             Console.WriteLine(" ***************************************");
  231.             Console.WriteLine();
  232.             Console.WriteLine(" Press ENTER to close.");
  233.             string quit1 = Console.ReadLine();
  234.         }
  235.  
  236.         static void STR_PosNeg(int STRmod, out String STRmod2)
  237.         {
  238.             if (STRmod > 0)
  239.             {
  240.                 STRmod2 = STRmod.ToString("+0");
  241.             }
  242.             else
  243.             {
  244.                 STRmod2 = STRmod.ToString();
  245.             }
  246.         }
  247.  
  248.         static void DEX_PosNeg(int DEXmod, out String DEXmod2)
  249.         {
  250.             if (DEXmod > 0)
  251.             {
  252.                 DEXmod2 = DEXmod.ToString("+0");
  253.             }
  254.             else
  255.             {
  256.                 DEXmod2 = DEXmod.ToString();
  257.             }
  258.         }
  259.  
  260.         static void CON_PosNeg(int CONmod, out String CONmod2)
  261.         {
  262.             if (CONmod > 0)
  263.             {
  264.                 CONmod2 = CONmod.ToString("+0");
  265.             }
  266.             else
  267.             {
  268.                 CONmod2 = CONmod.ToString();
  269.             }
  270.         }
  271.  
  272.         static void INT_PosNeg(int INTmod, out String INTmod2)
  273.         {
  274.             if (INTmod > 0)
  275.             {
  276.                 INTmod2 = INTmod.ToString("+0");
  277.             }
  278.             else
  279.             {
  280.                 INTmod2 = INTmod.ToString();
  281.             }
  282.         }
  283.  
  284.         static void WIS_PosNeg(int WISmod, out String WISmod2)
  285.         {
  286.             if (WISmod > 0)
  287.             {
  288.                 WISmod2 = WISmod.ToString("+0");
  289.             }
  290.             else
  291.             {
  292.                 WISmod2 = WISmod.ToString();
  293.             }
  294.         }
  295.  
  296.         static void CHA_PosNeg(int CHAmod, out String CHAmod2)
  297.         {
  298.             if (CHAmod > 0)
  299.             {
  300.                 CHAmod2 = CHAmod.ToString("+0");
  301.             }
  302.             else
  303.             {
  304.                 CHAmod2 = CHAmod.ToString();
  305.             }
  306.         }
  307.         }
  308. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement