public void setstat(int count) { string typech; while (true) { System.Console.Clear(); Asciidraw.drawpic("SetStat"); if (count < 1) { Console.WriteLine("You have 0 characteristics points"); System.Console.ReadKey(); break; } Console.WriteLine("You have " + count + " characteristics points\n"); Console.WriteLine("Type stat to increase (Strength, Intelligence, Agility, Wisdom, Vitality. Each 1 point spent on Agi/Wis/Vit increasing stat by 5) :"); typech = Console.ReadLine(); if (typech.CompareTo("Strength") == 0) { Console.WriteLine("Type requiered amount: "); typen = Convert.ToInt32(Console.ReadLine()); if (typen > count) { Console.WriteLine("Not enough points. Try again"); continue; } str = str + typen; count = count - typen; continue; } else if (typech.CompareTo("Intelligence") == 0) { Console.WriteLine("Type requiered amount: "); typen = Convert.ToInt32(Console.ReadLine()); if (typen > count) { Console.WriteLine("Not enough points. Try again"); continue; } intl = intl + typen; count = count - typen; continue; } else if (typech.CompareTo("Agility") == 0) { Console.WriteLine("Type requiered amount: "); typen = Convert.ToInt32(Console.ReadLine()); if (typen > count) { Console.WriteLine("Not enough points. Try again"); continue; } agi = agi + typen * 5; ep = agi; count = count - typen; continue; } else if (typech.CompareTo("Wisdom") == 0) { Console.WriteLine("Type requiered amount: "); typen = Convert.ToInt32(Console.ReadLine()); if (typen > count) { Console.WriteLine("Not enough points. Try again"); continue; } wis = wis + typen * 5; mp = wis; count = count - typen; continue; } else if (typech.CompareTo("Vitality") == 0) { Console.WriteLine("Type requiered amount: "); typen = Convert.ToInt32(Console.ReadLine()); if (typen > count) { Console.WriteLine("Not enough points. Try again"); continue; } vit = vit + typen * 5; hp = vit; count = count - typen; continue; } else { Console.WriteLine("Incorrect characteristic. Try again"); } } }
public void Fight(Characters chars, Queue <string> names, Queue <string> Battlestats) { int en_turn = 1; int i = 0; Hostile hostile = new Hostile(chars[i].lvl, names, chars[i].msgs); System.Console.Clear(); Asciidraw.drawpic("Header"); if (hostile.Name.CompareTo("Succubus") == 0) { Asciidraw.drawpic("Succubus"); } else if (hostile.Name.CompareTo("GrimReaper") == 0) { Asciidraw.drawpic("GrimReaper"); } else if (hostile.Name.CompareTo("Archlord") == 0) { Asciidraw.drawpic("Archlord"); } else if (hostile.Name.CompareTo("CentaurQueen") == 0) { Asciidraw.drawpic("CentaurQueen"); } else if (hostile.Name.CompareTo("Unicorn") == 0) { Asciidraw.drawpic("Unicorn"); } else { Asciidraw.drawpic("Angel"); } Console.WriteLine(hostile.Name + " spotted"); Console.WriteLine("Enemy level: " + hostile.lvl); hostile.showinfo(); while (true) { for (int j = 0; j < 4; j++) { if (chars[i].hp < 1) { if (i == 3) { i = 0; } else { i++; } } else { break; } if (j == 3) { Console.WriteLine("All Your Characters Died! Game Over!"); System.Console.ReadKey(); Environment.Exit(0); } } if (chars[i].Class.CompareTo("Warrior") == 0) { WarriorBattle(hostile, chars[i], en_turn, Battlestats, chars[i].msgs); } else if (chars[i].Class.CompareTo("Wizard") == 0) { WizardBattle(hostile, chars[i], en_turn, Battlestats, chars[i].msgs); } else if (chars[i].Class.CompareTo("Ranger") == 0) { RangerBattle(hostile, chars[i], en_turn, Battlestats, chars[i].msgs); } if (hostile.hp < 1) { break; } if (i == 3) { i = 0; } else { i++; } } }
public void RangerBattle(Hostile hostile, Character character, int enemy_turn, Queue <string> Battlestats, CharacterMessages msgs) { string typech; int typen; Console.WriteLine("Type <<Skill_list>> to begin fight"); while (true) { typech = Console.ReadLine(); if (typech.CompareTo("Skill_list") == 0) { System.Console.Clear(); Asciidraw.drawpic("Header"); if (hostile.Name.CompareTo("Succubus") == 0) { Asciidraw.drawpic("Succubus"); } else if (hostile.Name.CompareTo("GrimReaper") == 0) { Asciidraw.drawpic("GrimReaper"); } else if (hostile.Name.CompareTo("Archlord") == 0) { Asciidraw.drawpic("Archlord"); } else if (hostile.Name.CompareTo("CentaurQueen") == 0) { Asciidraw.drawpic("CentaurQueen"); } else if (hostile.Name.CompareTo("Unicorn") == 0) { Asciidraw.drawpic("Unicorn"); } else { Asciidraw.drawpic("Angel"); } CharactersAbilities.RangerShowSkillList(); Console.WriteLine("Choose skill number:"); typen = Convert.ToInt32(Console.ReadLine()); switch (typen) { case 1: hostile.hp = hostile.hp - CharactersAbilities.AutoShoot(character.str, character.phatk); break; case 2: if ((70 + 20 * character.lvl) < character.ep) { character.ep = character.ep - (70 + 20 * character.lvl); hostile.hp = hostile.hp - CharactersAbilities.PowerArrow(character.str, character.phatk); } else { Console.WriteLine("Not enough energy. Try to use another skill"); continue; } break; case 3: character.ep = character.ep + CharactersAbilities.RangerHealthRegeneration(character.agi, character.lvl); if (character.ep > character.agi) { character.ep = character.agi; } break; default: break; } if (hostile.hp > (100 * hostile.lvl) && hostile.hp < (200 * hostile.lvl)) { msgs.Message(hostile.Name, hostile.hp); } } else { Console.WriteLine("Incorrect text! Type Skill_list to choose skill: "); continue; } if (character.hp < 1) { Console.WriteLine("Character DIED!(will be revived at the end of the battle)"); break; } else if (hostile.hp < 1) { if (character.lvl == 10) { System.Console.Clear(); Asciidraw.drawpic("GoodGameOver"); Console.WriteLine("You defetead the most powerful enemy, and now Evergarden can finally be at peace! You have done an unbelievable job, and many centuries further your name will be in every single ballad!"); System.Console.ReadKey(); System.Console.ReadKey(); Environment.Exit(0); } Console.WriteLine("Congratulations, you won!"); character.exp = character.exp + hostile.lvl * 5; character.CheckLvlUp(); Console.WriteLine("You got " + (hostile.lvl * 5) + " exp points! " + (100 - character.exp) + " untill next lvl"); character.hp = character.vit; character.ep = character.agi; Battlestats.Enqueue(hostile.Name + " " + hostile.lvl); break; } else { if (enemy_turn == 3) { character.hp = character.hp - CharactersAbilities.Fury(hostile.str, hostile.phatk); enemy_turn = 1; } else { character.hp = character.hp - CharactersAbilities.Bite(hostile.str, hostile.phatk); enemy_turn++; } Console.WriteLine("You have" + character.hp + " hp."); Console.WriteLine("Enemy has " + hostile.hp + " hp. Type Skill_list to attack againg."); if (character.hp < 1) { Console.WriteLine("Character DIED!(will be revived at the end of the battle)"); } break; } } }
static void Main(string[] args) { BinaryFormatter savefile = new BinaryFormatter(); Characters chars; Queue <string> queuenames = new Queue <string>(); string typer; int i = 0; Console.WindowTop = 0; Console.WindowLeft = 0; Console.SetWindowSize(Console.LargestWindowWidth - 3, Console.LargestWindowHeight - 3); Asciidraw.drawpic("AGERESTRICT"); try { AgeCheck p = new AgeCheck(); p.Age = Convert.ToInt32(Console.ReadLine()); } catch (AgeException ex) { Console.WriteLine("Error AgeException: " + ex.Message); Environment.Exit(0); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); Environment.Exit(0); } System.Console.Clear(); Asciidraw.drawpic("intro"); System.Console.ReadKey(); System.Console.Clear(); Console.WriteLine("Do you wanna load your progress(Y/N)"); typer = Console.ReadLine(); if (typer.CompareTo("Y") == 0) { Console.WriteLine("Type the name of save file:"); typer = Console.ReadLine(); using (FileStream fs = new FileStream(typer + ".sav", FileMode.Open)) { chars = (Characters)savefile.Deserialize(fs); Console.WriteLine("Succesfull !"); } } else { chars = new Characters(); while (i < 4) { Asciidraw.drawpic("newcharacter"); Console.WriteLine("Set your character name: "); typer = Console.ReadLine(); if (typer.CompareTo("GodMode") == 0) { Console.WriteLine("Type correct password : "******"Murloc") != 0) { Console.WriteLine("Incorrect password"); continue; } for (i = 0; i < 4; i++) { chars[i] = new Character { Name = typer }; chars[i].Name = "Godlike Creation"; chars[i].Class = "Warrior"; chars[i].str = 1500; chars[i].agi = 8000; chars[i].vit = 200000; chars[i].phatk = 25000; chars[i].def = 120000; chars[i].wis = 50000; chars[i].hp = chars[i].vit; chars[i].mp = chars[i].wis; chars[i].ep = chars[i].agi; } break; } else { chars[i] = new Character { Name = typer }; } while (true) { System.Console.Clear(); Asciidraw.drawpic("Classes"); Console.WriteLine("Choose your character class: "); typer = Console.ReadLine(); if (typer.CompareTo("Warrior") == 0) { chars[i].Class = typer; System.Console.Clear(); Asciidraw.drawpic("Warriorpic"); while (true) { Console.WriteLine("Are you satisfied with this class? (Y/N) : "); typer = Console.ReadLine(); if (typer.CompareTo("Y") == 0) { break; } else if (typer.CompareTo("N") == 0) { break; } else { Console.WriteLine("Wrong character. Try again"); continue; } } if (typer.CompareTo("Y") == 0) { chars[i].str = 15; chars[i].agi = 80; chars[i].vit = 200; chars[i].phatk = 25; chars[i].def = 12; chars[i].wis = 50; chars[i].hp = chars[i].vit; chars[i].mp = chars[i].wis; chars[i].ep = chars[i].agi; break; } else if (typer.CompareTo("N") == 0) { continue; } System.Console.ReadKey(); } else if (typer.CompareTo("Wizard") == 0) { chars[i].Class = typer; System.Console.Clear(); Asciidraw.drawpic("Wizardpic"); while (true) { Console.WriteLine("Are you satisfied with this class? (Y/N) : "); typer = Console.ReadLine(); if (typer.CompareTo("Y") == 0) { break; } else if (typer.CompareTo("N") == 0) { break; } else { Console.WriteLine("Wrong character. Try again"); continue; } } if (typer.CompareTo("Y") == 0) { chars[i].intl = 17; chars[i].agi = 30; chars[i].vit = 100; chars[i].matk = 35; chars[i].def = 4; chars[i].wis = 200; chars[i].hp = chars[i].vit; chars[i].mp = chars[i].wis; chars[i].ep = chars[i].agi; break; } else if (typer.CompareTo("N") == 0) { continue; } System.Console.ReadKey(); } else if (typer.CompareTo("Ranger") == 0) { chars[i].Class = typer; System.Console.Clear(); Asciidraw.drawpic("Rangerpic"); while (true) { Console.WriteLine("Are you satisfied with this class? (Y/N) : "); typer = Console.ReadLine(); if (typer.CompareTo("Y") == 0) { break; } else if (typer.CompareTo("N") == 0) { break; } else { Console.WriteLine("Wrong character. Try again"); continue; } } if (typer.CompareTo("Y") == 0) { chars[i].str = 8; chars[i].agi = 140; chars[i].vit = 140; chars[i].phatk = 30; chars[i].def = 9; chars[i].wis = 80; chars[i].hp = chars[i].vit; chars[i].mp = chars[i].wis; chars[i].ep = chars[i].agi; break; } else if (typer.CompareTo("N") == 0) { continue; } System.Console.ReadKey(); } else { Console.WriteLine("There is no class with that name! Try type it again"); } } System.Console.Clear(); Console.WriteLine("Set your base characteristics"); chars[i].setstat(30); System.Console.Clear(); i++; } System.Console.Clear(); Console.WriteLine("Do you wanna save your characters?(Y/N)"); typer = Console.ReadLine(); if (typer.CompareTo("Y") == 0) { Console.WriteLine("Type the name of save file:"); typer = Console.ReadLine(); using (FileStream fs = new FileStream(typer + ".sav", FileMode.Create)) { savefile.Serialize(fs, chars); Console.WriteLine("Succesfull save!"); } } else { Console.WriteLine("So, you like oldscholl hardcore. Not gonna stop you then."); } } Asciidraw.drawpic("Header"); Console.WriteLine("Choose Your Reality: Hellheim or Alvheim: "); typer = Console.ReadLine(); if (typer.CompareTo("Hellheim") == 0) { queuenames.Enqueue("GrimReaper"); queuenames.Enqueue("Succubus"); queuenames.Enqueue("Archlord"); } else if (typer.CompareTo("Alvheim") == 0) { queuenames.Enqueue("Angel"); queuenames.Enqueue("Unicorn"); queuenames.Enqueue("CentaurQueen"); } Console.WriteLine("Enjoy your endless journey!\n"); i = 0; while (true) { typer = Console.ReadLine(); if (typer.CompareTo("Characters") == 0) { for (i = 0; i < 4; i++) { chars[i].showinfo(); } } else if (typer.CompareTo("Fight") == 0) { Battle enemy = new Battle(); System.Console.Clear(); Asciidraw.drawpic("Header"); enemy.Fight(chars, queuenames, chars.Battlestats); for (int j = 0; j < 4; j++) { chars[j].hp = chars[j].vit; chars[j].ep = chars[j].agi; } } else if (typer.CompareTo("Battlestats") == 0) { Character.ShowStats(chars.Battlestats); } else if (typer.CompareTo("Save") == 0) { Console.WriteLine("Type the name of save file:"); typer = Console.ReadLine(); using (FileStream fs = new FileStream(typer + ".sav", FileMode.Create)) { savefile.Serialize(fs, chars); Console.WriteLine("Succesfull save!"); } } else { Console.WriteLine("Incorrect input, please try again"); } } }