SHOW:
|
|
- or go back to the newest paste.
| 1 | using System; | |
| 2 | using System.Collections.Generic; | |
| 3 | using System.Linq; | |
| 4 | using System.Text; | |
| 5 | ||
| 6 | namespace GameBase_test_ | |
| 7 | {
| |
| 8 | class Program | |
| 9 | {
| |
| 10 | static void Main(string[] args) | |
| 11 | {
| |
| 12 | int m = 0; | |
| 13 | int Strength = 5; | |
| 14 | int Agility = 5; | |
| 15 | int Intelligence = 5; | |
| 16 | int Level = 0; | |
| 17 | string specialty; | |
| 18 | string Name; | |
| 19 | ||
| 20 | ||
| 21 | Console.WriteLine("What is your name?");
| |
| 22 | Name = Console.ReadLine(); | |
| 23 | ||
| 24 | Console.WriteLine("What is your specialty?");
| |
| 25 | Console.WriteLine("Strength, Agility, or Intelligence");
| |
| 26 | ||
| 27 | while (m != 1) | |
| 28 | {
| |
| 29 | specialty = Console.ReadLine(); | |
| 30 | if (specialty != "Strength") | |
| 31 | {
| |
| 32 | if (specialty != "Agility") | |
| 33 | {
| |
| 34 | if (specialty != "Intelligence") | |
| 35 | {
| |
| 36 | Console.WriteLine("Try Again");
| |
| 37 | } | |
| 38 | else | |
| 39 | {
| |
| 40 | Console.WriteLine("Intelligence increased by 3!");
| |
| 41 | Intelligence += 3; | |
| 42 | Console.WriteLine("Your Intelligence is now: " + Intelligence);
| |
| 43 | m = 1; | |
| 44 | } | |
| 45 | ||
| 46 | } | |
| 47 | else | |
| 48 | {
| |
| 49 | Console.WriteLine("Agility increased by 3!");
| |
| 50 | Agility += 3; | |
| 51 | Console.WriteLine("Your Agility is now: " + Agility);
| |
| 52 | m = 1; | |
| 53 | } | |
| 54 | } | |
| 55 | else | |
| 56 | {
| |
| 57 | Console.WriteLine("Strength Increased by 3!");
| |
| 58 | Strength += 3; | |
| 59 | Console.WriteLine("Your Strength is now: " + Strength);
| |
| 60 | m = 1; | |
| 61 | } | |
| 62 | } | |
| 63 | GameLoop(Strength, Agility, Intelligence, Level); | |
| 64 | Console.ReadLine(); | |
| 65 | } | |
| 66 | static int CalculateHealth(int strength, int Damage) | |
| 67 | {
| |
| 68 | int Health = 19 * strength + 150 - Damage; | |
| 69 | return Health; | |
| 70 | } | |
| 71 | static int CalculateMana(int Intelligence, int SpellCost) | |
| 72 | {
| |
| 73 | int Mana = 13 * Intelligence + 100 - SpellCost; | |
| 74 | return Mana; | |
| 75 | } | |
| 76 | static int CalculateAttackSpeed(int Agility, int Slows) | |
| 77 | {
| |
| 78 | int AttackSpeed = Agility + 10 - Slows; | |
| 79 | return AttackSpeed; | |
| 80 | } | |
| 81 | static void GameLoop(int Strength, int Agility, int Intelligence, int Level) | |
| 82 | {
| |
| 83 | ||
| 84 | int XP = 0; | |
| 85 | int Damage = 0; | |
| 86 | int SpellCost = 0; | |
| 87 | int Slows = 0; | |
| 88 | int EnemiesKilled = 0; | |
| 89 | string Input = ""; | |
| 90 | Level = 1; | |
| 91 | int neededXP = XpScaler(Level, XP); | |
| 92 | while (Input != "Quit") | |
| 93 | {
| |
| 94 | ||
| 95 | Console.WriteLine("Your Health is: " + CalculateHealth(Strength, Damage));
| |
| 96 | Console.WriteLine("Your Mana is: " + CalculateMana(Intelligence, SpellCost));
| |
| 97 | Console.WriteLine("Your Attack Speed is: " + CalculateAttackSpeed(Agility, Slows));
| |
| 98 | Console.WriteLine("What will you do?");
| |
| 99 | Console.WriteLine("(Fight)");
| |
| 100 | Input = Console.ReadLine(); | |
| 101 | if (Input == "Fight") | |
| 102 | {
| |
| 103 | if (FightLoop(Strength, Agility, Intelligence, Damage, SpellCost, Slows, Level) == false) | |
| 104 | {
| |
| 105 | //Calculate Score | |
| 106 | } | |
| 107 | else | |
| 108 | {
| |
| 109 | int EnemyLevel = CalculateEnemyLevel(Level); | |
| 110 | EnemiesKilled = EnemiesKilled + 1; | |
| 111 | XP = xpgenerator(EnemyLevel, Level) + XP; | |
| 112 | Console.WriteLine("You Have: " + XP + "XP");
| |
| 113 | int XPTillNextLevel = neededXP - XP; | |
| 114 | Console.WriteLine("XP untill your next level: " + XPTillNextLevel);
| |
| 115 | if (XPTillNextLevel <= 0) | |
| 116 | {
| |
| 117 | Console.WriteLine("You have leveled up!");
| |
| 118 | Level = Level + 1; | |
| 119 | XpScaler(Level, XP); | |
| 120 | XP = 0; | |
| 121 | } | |
| 122 | Console.ReadLine(); | |
| 123 | ||
| 124 | } | |
| 125 | } | |
| 126 | } | |
| 127 | ||
| 128 | } | |
| 129 | static bool FightLoop(int Strength, int Agility, int Intelligence, int Damage, int SpellCost, int Slows, int Level) | |
| 130 | {
| |
| 131 | int EnemyDamage = 0; | |
| 132 | int PlayerHealth = CalculateHealth(Strength, Damage); | |
| 133 | int EnemyLevel = CalculateEnemyLevel(Level); | |
| 134 | bool Death = false; | |
| 135 | int EnemySlows = 0; | |
| 136 | int EnemyStrength = CalculateEnemyStrength(EnemyLevel); | |
| 137 | string Input = ""; | |
| 138 | while (Death == false) | |
| 139 | {
| |
| 140 | int EnemyHealth = CalculateEnemyHealth(EnemyStrength, EnemyDamage); | |
| 141 | if (EnemyHealth >= 1) | |
| 142 | {
| |
| 143 | ||
| 144 | if (PlayerHealth >= 1) | |
| 145 | {
| |
| 146 | Console.WriteLine("What will you do?");
| |
| 147 | Console.WriteLine("Attack, Dodge, or Examine");
| |
| 148 | Input = Console.ReadLine(); | |
| 149 | if (Input != "Attack") | |
| 150 | {
| |
| 151 | if (Input != "Dodge") | |
| 152 | {
| |
| 153 | if (Input != "Examine") | |
| 154 | {
| |
| 155 | if (Input != "Run") | |
| 156 | {
| |
| 157 | Console.WriteLine("What was that?");
| |
| 158 | } | |
| 159 | else | |
| 160 | {
| |
| 161 | Console.WriteLine("Running is not an option you pussy");
| |
| 162 | ||
| 163 | } | |
| 164 | } | |
| 165 | else | |
| 166 | {
| |
| 167 | Console.WriteLine("Your enemies stats are: ");
| |
| 168 | CalculateEnemyStats(EnemyLevel, EnemyDamage, EnemySlows); | |
| 169 | } | |
| 170 | } | |
| 171 | else | |
| 172 | {
| |
| 173 | //Generate dodge chance and test against enemy speed + strength. | |
| 174 | } | |
| 175 | } | |
| 176 | else | |
| 177 | {
| |
| 178 | int AttackDamage = CalculateAttack(Strength); | |
| 179 | EnemyDamage += AttackDamage; | |
| 180 | ||
| 181 | } | |
| 182 | } | |
| 183 | else | |
| 184 | {
| |
| 185 | Console.WriteLine("You have been rekt");
| |
| 186 | Death = true; | |
| 187 | return false; | |
| 188 | } | |
| 189 | } | |
| 190 | else if (EnemyHealth <= 0) | |
| 191 | {
| |
| 192 | Console.WriteLine("You have slain your enemy");
| |
| 193 | Death = true; | |
| 194 | ||
| 195 | ||
| 196 | } | |
| 197 | } | |
| 198 | return true; | |
| 199 | } | |
| 200 | static int XpScaler(int Level, int XP) | |
| 201 | {
| |
| 202 | int HML = Level + 10; | |
| 203 | int LevelEffect = 10 * Level; | |
| 204 | int XPTillNextLevel = 100 + LevelEffect + HML; | |
| 205 | return XPTillNextLevel; | |
| 206 | } | |
| 207 | static int xpgenerator(int EnemyLevel, int Level) | |
| 208 | {
| |
| 209 | int XPGained = 10 + EnemyLevel - Level; | |
| 210 | if (XPGained < 1) | |
| 211 | {
| |
| 212 | XPGained = 1; | |
| 213 | } | |
| 214 | return XPGained; | |
| 215 | } | |
| 216 | static int CalculateAttack(int Strength) | |
| 217 | {
| |
| 218 | int AttackDamage = Strength * 5; | |
| 219 | return AttackDamage; | |
| 220 | } | |
| 221 | static int CalculateEnemyLevel(int Level) | |
| 222 | {
| |
| 223 | int EnemyMin = Level - 5; | |
| 224 | if (EnemyMin < 1) | |
| 225 | {
| |
| 226 | EnemyMin = 1; | |
| 227 | } | |
| 228 | int EnemyMax = Level + 10; | |
| 229 | Random random = new Random(); | |
| 230 | int EnemyLevel = random.Next(EnemyMin, EnemyMax); | |
| 231 | return EnemyLevel; | |
| 232 | } | |
| 233 | static void CalculateEnemyStats(int EnemyLevel,int EnemyDamage, int EnemySlows) | |
| 234 | {
| |
| 235 | int EnemyStrength = CalculateEnemyStrength(EnemyLevel); | |
| 236 | int EnemyHealth = CalculateEnemyHealth(EnemyStrength, EnemyDamage); | |
| 237 | int EnemyMana = CalculateEnemyMana(); | |
| 238 | int EnemyAttackSpeed = CalculateEnemyAgility(EnemyLevel); | |
| 239 | Console.WriteLine("Your Enemies Health is: " + EnemyHealth);
| |
| 240 | Console.WriteLine("Your Enemies Mana is: " + EnemyMana);
| |
| 241 | Console.WriteLine("Your Enemies AttackSpeed is: " + EnemyAttackSpeed);
| |
| 242 | } | |
| 243 | static int CalculateEnemyStrength(int EnemyLevel) | |
| 244 | {
| |
| 245 | ||
| 246 | int EnemyStrength = EnemyLevel + 5; | |
| 247 | return EnemyStrength; | |
| 248 | } | |
| 249 | static int CalculateEnemyAgility(int EnemyLevel) | |
| 250 | {
| |
| 251 | int EnemyAgility = EnemyLevel + 5; | |
| 252 | return EnemyAgility; | |
| 253 | } | |
| 254 | static int CalculateEnemyHealth(int EnemyStrength, int EnemyDamage) | |
| 255 | {
| |
| 256 | int EnemyHealth = 19 * EnemyStrength - EnemyDamage; | |
| 257 | return EnemyHealth; | |
| 258 | } | |
| 259 | static int CalculateEnemyMana() | |
| 260 | {
| |
| 261 | int EnemyMana = 13 * 5; | |
| 262 | return EnemyMana; | |
| 263 | } | |
| 264 | } | |
| 265 | } |