}//end Main public MainMenu() { //Dictionary<string, int> charStats = new Dictionary<string, int>(); Console.Write("What is your name, Gladiator? "); name = Console.ReadLine(); Fighter fighter = new Fighter(RollCharStats()); EnemyGladiator enemy = new EnemyGladiator(Roller.rollXSidedDice(4,1,1)+1); fighter.Name = name; Console.WriteLine("{1} will be facing {0} in the Arena for 200 Caesars!!", enemy.Name, fighter.Name); CombatMenu cm = new CombatMenu(fighter, enemy); }//end MainMenu
public static int ItHit(int attackRoll, int dieType, int numberOfTimesRolled, int criticalHitModifier) { int weaponDamage = Roller.rollXSidedDice(dieType, 1, numberOfTimesRolled); int criticalWeaponDamage = (Roller.rollXSidedDice(dieType, 1, numberOfTimesRolled) * criticalHitModifier); if (attackRoll >= 19) { return(criticalWeaponDamage); } else { return(weaponDamage); } }
}//end MainMenu public static Dictionary<string, int> RollCharStats() { Dictionary<string, int> charStats = new Dictionary<string, int>(); // just keeps the while loop going bool rolling = true; while (rolling) { //roll stats for Fighter #region actual rolls for character core stats strengthRaw = Roller.rollXSidedDice(6, 2, 3); agilityRaw = Roller.rollXSidedDice(6, 2, 3); intelligenceRaw = Roller.rollXSidedDice(6, 2, 3); luckRaw = Roller.rollXSidedDice(6, 2, 3); charismaRaw = Roller.rollXSidedDice(6, 2, 3); constitutionRaw = Roller.rollXSidedDice(6, 2, 3); maxHitPointsRaw = Roller.rollXSidedDice(20, 4, 3); maxRaw = maxHitPointsRaw; currentHitPointsRaw = maxRaw; #endregion #region displaying stats to the user and prompting to continue or roll again Console.WriteLine("Your strength is: \t\t {0} \n", strengthRaw); Console.WriteLine("Your agility is:\t\t {0} \n", agilityRaw); Console.WriteLine("Your intelligence is:\t\t {0} \n", intelligenceRaw); Console.WriteLine("Your luck is:\t\t\t {0} \n", luckRaw); Console.WriteLine("Your charisma is:\t\t {0} \n", charismaRaw); Console.WriteLine("Your constitution is:\t\t {0} \n", constitutionRaw); Console.WriteLine("Your max hit points are:\t {0} \n", maxHitPointsRaw); Console.WriteLine("Your current hit points are:\t {0} \n", currentHitPointsRaw); Console.Write("Are you satisfied with your stats and ready to proceed? (Y/N)\n "); string input = Console.ReadLine(); #endregion // if statement that checks if the user wishes to continue or re-roll // and adds stats rolled in last region to the Dictionary returned in // this method #region if statement if (input == "Y" || input == "y") {// adding rolled attributes to dictionary charStats.Add("Strength", strengthRaw); charStats.Add("Agility", agilityRaw); charStats.Add("Intelligence", intelligenceRaw); charStats.Add("Luck", luckRaw); charStats.Add("Charisma", charismaRaw); charStats.Add("Constitution", constitutionRaw); charStats.Add("MaxHitPoints", maxHitPointsRaw); charStats.Add("CurrentHitPoints", currentHitPointsRaw); rolling = false; break; } else if (input == "N" || input == "n") {// continue loop rolling = true; } else {// try again if fat-finger Console.WriteLine("Please enter a valid input"); #endregion }// end if }// end while return charStats; }//end RollCharStats method
public int CalculateDamage() { int inflict = ((Strength / 2) + (2 * Roller.rollXSidedDice(12, 1, 1))); return(inflict); }
public int Avoid() { int avoid = Roller.rollXSidedDice(20, 1, 1) + (Agility + (Constitution / 2) + (Intelligence / 2)); return(avoid); }
//Fighter methods #region Fighter Methods public int AttackEnemy() { int toHit = Roller.rollXSidedDice(20, 1, 1) + (Agility + (Strength / 2) + (Intelligence / 2)); return(toHit); }
public CombatMenu(Fighter f, EnemyGladiator e) { while (CombatActive) { int f20Roll = Roller.rollXSidedDice(20, 1, 1); int e20Roll = Roller.rollXSidedDice(20, 1, 1); if (salve == 0) { Console.WriteLine("\nAs you walk through the narrow pathway to the arena,\n" + "a fair maiden hands you a satchel. She says, \"Good luck, warrior. Take this\n" + "magic salve to heal your wounds during your fight.\"\n"); salve += 3; } else { Console.WriteLine("The enemy has {0} hit points left", e.CurrentHitPoints); Console.WriteLine("You have {0} hit points left", f.CurrentHitPoints); Console.WriteLine("You have fought {0} round(s)", turn); Console.WriteLine(); //Display Menu - perform menu actions Console.WriteLine("1) Melee Attack"); Console.WriteLine("2) Ranged Attack"); Console.WriteLine("3) Close with Enemy"); Console.WriteLine("4) Use salve"); Console.WriteLine("5) Yield"); if (f.Fury > 3 || f.Spirit > 3) { Console.WriteLine("6) Special Attack"); } int yourMove = Convert.ToInt32(Console.ReadLine()); //start switch switch (yourMove) { //attempt to attack enemy if close enough case 1: if (range < 2) { Console.WriteLine("\nYou swing your sword at the enemy, thoroughly expecting to lop his ugly head off."); Console.WriteLine(); Console.WriteLine("\nYou catch him on his heels and swing for the fences.", f.Name); if (f.AttackEnemy() > e.Avoid()) { int damage1 = f.CalculateDamage(); e.ReceiveDamage(damage1); Console.WriteLine("\nyou hit {0} for {1} damage", e.Name, damage1); f.Spirit++; e.Fury++; if (e.CurrentHitPoints <= 0) { CombatActive = false; break; } } else { Console.WriteLine("\nYou miss"); f.Spirit--; } #region Obsolete counter-attack code /*{ * Console.WriteLine("\n Your attack whiffs, {0} attacks you, instead!", e.Name); * if (e.AttackEnemy() > f.Avoid()) * { * int damage2 = e.CalculateDamage(); * f.ReceiveDamage(damage2); * Console.WriteLine("he hit you for {0} damage", damage2); * f.Fury++; * e.Spirit++; * * if (f.CurrentHitPoints <= 0) * { * CombatActive = false; * break; * } * } * else * { * Console.WriteLine("The enemy misses"); * e.Spirit--; * * } * * * * }//end if*/ #endregion } //end range if else { Console.WriteLine("You're not close enough to perform that action."); } break; //ranged attack if range > 1 case 2: if (range > 1) { Console.WriteLine("You don't have a ranged weapon yet!"); break; } else { Console.WriteLine("You cannot hit with ranged weapons in your current proximity to the enemy.\n" + "You shoot your imaginary arrow and it does nothing. Your opponent laughs."); break; } //close range to enemy case 3: Console.WriteLine("\n You sprint towards the enemy and make the craziest, most bloodthirsty face you can muster"); range--; break; //apply salve to heal case 4: if (salve > 0) { Console.WriteLine("\nYou use the magic salve on your wounds, and feel better immediately"); f.CurrentHitPoints += 20; salve--; break; } else { Console.WriteLine("\nYou don't have any magic salve left."); break; } //case 5: // case 6: Console.WriteLine("You focus all of your energy into a mighty finishing blow that staggers the enemy."); e.CurrentHitPoints -= 35; break; }//end switch //enemyTurn int enemyTurn = Roller.rollXSidedDice(6, 1, 1); if (range > 1 && e.CurrentHitPoints > 15) { Console.WriteLine("\n{0} moves closer to you.", e.Name); range--; } else if (e.CurrentHitPoints <= 15 && e.CurrentHitPoints > 0) { Console.WriteLine("\n{0}, injured and wobbly, applies the magic salve", e.Name); eSalve--; e.CurrentHitPoints += 20; } else { Console.WriteLine("\n {0} winds up and swings his sword with all of his might!", e.Name); if (e.AttackEnemy() > f.Avoid()) { int damage2 = e.CalculateDamage(); f.ReceiveDamage(damage2); Console.WriteLine("\nhe hit you for {0} damage", damage2); f.Fury++; e.Spirit++; if (f.CurrentHitPoints <= 0) { CombatActive = false; break; } } else { Console.WriteLine("\nThe enemy misses"); e.Spirit--; f.Spirit++; } } //end enemyTurn } //end if turn++; } //end while } //end method