public override void Interact() { base.Interact(); Interface.type("Press 's' to stay at the inn for " + price + " gold, or anything else to go back."); switch (Interface.readkey().KeyChar) { case 's': Player.Purchase(price); Main.Player.hp = Main.Player.maxhp; Interface.type("Your health has been restored.", ConsoleColor.Cyan); if (!String.IsNullOrEmpty(stay)) { Interface.type(stay); } Main.Player.last_inn[0] = Map.PlayerPosition.x; Main.Player.last_inn[1] = Map.PlayerPosition.y; break; default: if (!String.IsNullOrEmpty(leave)) { Interface.type(leave); } break; } }
public static void checkver() { string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string programName = "update.exe"; string resourceName = "Realm.update.exe"; string exepath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Realm.exe"; string temppath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\test.exe"; worker(); while (!Init.init) { } if (isConnected()) { if (!Init.failed) { if (!FileCompare(exepath, temppath)) { Interface.type("New version available. Press 'p' to download. ", 0); if (Interface.readkey().KeyChar == 'p') { var p = new Plop(); p.DropAndRun(resourceName, programName); Environment.Exit(0); } } File.Delete(temppath); } } else { Interface.type("Connection error."); } }
public static void Endgame() { if (!Main.devmode) { if (Main.magiccounter >= 1) { Interface.type("You recognize the magic man from the alley in Central. It is he who stands before you."); } Interface.type("\"I am Janus.\" The man before you says. You stand in front of the protetorate, Janus. He says \"" + Main.Player.name + ", have you realized that this world is an illusion?\" You nod your head. \"You will result in the Realm\"s demise, you must be purged. Shimmering light gathers around him, and beams of blue light blast out of him."); Interface.type("I regret to say it, but we must fight."); Combat.BattleLoop(new finalboss()); Main.ach.Get("finalboss"); Interface.type("Janus defeated, the world vanishes and you both are standing on glass in a blank world of black void."); Interface.type("The protectorate kneels on the ground in front of you. \"Do you truly wish to end the illusion?\", he says. You look at him without uttering a word. \"Very well, I must ask of you one last favor; even though the realm is no more, do not let it vanish from within you.\" Everything around you goes black. (Press any key to continue)"); Interface.readkey(); Console.Clear(); } Interface.type("GAME CLEAR!", ConsoleColor.Yellow); Interface.type("==========STATS==========", ConsoleColor.Yellow); Interface.type("Name: " + Main.Player.name, ConsoleColor.Yellow); Interface.type("Race: " + Main.Player.race.ToUpperFirstLetter(), ConsoleColor.Yellow); Interface.type("Class: " + Main.Player.pclass.ToUpperFirstLetter(), ConsoleColor.Yellow); Interface.type("Level: " + Main.Player.level, ConsoleColor.Yellow); Interface.type("Gold: " + Main.Player.g, ConsoleColor.Yellow); Interface.type("Reputation " + Main.Player.reputation, ConsoleColor.Yellow); Interface.type("FINAL SCORE: " + calcScore().Item2, ConsoleColor.Yellow); Interface.type("FINAL RANK: " + calcScore().Item1, ConsoleColor.Yellow); Interface.type("=========================\r\n", ConsoleColor.Yellow); Interface.type("Press any key to continue.", ConsoleColor.White); Interface.readkey(); Console.Clear(); Credits(); }
public static void BackpackLoop() { bool loopcontrol = true; while (loopcontrol) { Console.ForegroundColor = ConsoleColor.Green; Interface.type("----------Current Equipment----------"); Interface.type("Primary: " + Main.Player.primary.name); Interface.type("Secondary: " + Main.Player.secondary.name); Interface.type("Armor: " + Main.Player.armor.name); Interface.type("Accessory: " + Main.Player.accessory.name); Interface.type("-------------------------------------"); int q = 1; Combat.CommandTable cmd = new Combat.CommandTable(); foreach (Item i in Main.Player.backpack) { Interface.type((q - 1) + ". " + i.name); backpackcommand bpcmd = new backpackcommand(i.name, (char)(q + 47)); cmd.AddCommand(bpcmd); q++; } Interface.type(""); char ch = Interface.readkey().KeyChar; if (!cmd.commandChars.Contains(ch)) { break; } cmd.ExecuteCommand(ch, Main.Player.backpack[(int)Char.GetNumericValue(ch)]); } Console.ResetColor(); }
public static void Credits() { Interface.type("A child awakes from his sleep and looks out the window feeling fulfilled as if a story has come to a close."); Interface.type("Press any key to continue.", ConsoleColor.White); Interface.readkey(); Console.Clear(); Interface.type("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ConsoleColor.DarkMagenta); Interface.type("----------------------Credits---------------------", ConsoleColor.DarkMagenta); Interface.type("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", ConsoleColor.DarkMagenta); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Executive Developer: Cooper Teixeira", ConsoleColor.Yellow); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Secondary Developer: Giorgio Lo", ConsoleColor.Yellow); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Executive Producer: Cooper Teixeira", ConsoleColor.Yellow); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Co-Producer: Giorgio Lo", ConsoleColor.Yellow); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Lead Content Designer: Giorgio Lo", ConsoleColor.Yellow); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Secondary Content Designer: Cooper Teixeira", ConsoleColor.Yellow); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Chief Tester: Rosemary Rogal", ConsoleColor.Yellow); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Lead Art Designer: Rosemary Rogal", ConsoleColor.Yellow); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Secondary Art Designer: Giorgio Lo", ConsoleColor.Yellow); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Secondary Art Designer: Cooper Teixeira", ConsoleColor.Yellow); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Concept Artist: Rosemary Rogal", ConsoleColor.Yellow); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Special thanks to:", ConsoleColor.DarkMagenta); Interface.type("- Steve Teixeira", ConsoleColor.Yellow); Interface.type("- Ryan Teixeira", ConsoleColor.Yellow); Interface.type("- Paul Pfenning", ConsoleColor.Yellow); Interface.type("- Charlie Catino", ConsoleColor.Yellow); Interface.type("- Bradley Lignoski", ConsoleColor.Yellow); Interface.type("- Alexander Pfenning", ConsoleColor.Yellow); Interface.type("- Ben Boyd", ConsoleColor.Yellow); Interface.type("__________________________________________________", ConsoleColor.DarkMagenta); Interface.type("Copyright(c) 2013", ConsoleColor.White); Interface.type("Press any key to continue.", ConsoleColor.White); Interface.readkey(); Environment.Exit(0); }
public override void Interact() { base.Interact(); Interface.type("Press 'b' to go into the buy menu, 's' to go into the sell menu, or anything else to go back."); switch (Interface.readkey().KeyChar) { case 'b': Interface.type("Press any key not listed to exit the buy menu."); bool loop = true; while (loop) { foreach (KeyValuePair <char, Item> kv in forsale) { Interface.type(kv.Key + ". " + kv.Value.name + "(" + kv.Value.value + ")", ConsoleColor.Green); } Interface.type(""); handleinput(Interface.readkey().KeyChar); } break; case 's': Interface.type("Index. Item name.....Item resale value. Press a non-listed key to go back.", ConsoleColor.Yellow); List <int> indices = new List <int>(); int itr = 1; foreach (Item item in Main.Player.backpack) { Interface.type(itr + ". " + item.name + "....." + (int)(item.value * .6)); indices.Add(itr); } char input = Interface.readkey().KeyChar; if (indices.Contains(Convert.ToInt32(input))) { Main.Player.g += (int)(Main.Player.backpack[Convert.ToInt32(input)].value * .6); Main.Player.backpack.Remove(Main.Player.backpack[Convert.ToInt32(input)]); } break; default: break; } }
public static bool LoadGame() { string tpath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\temp_save.rlm"; string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\save.rlm"; string achpath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\achievements.rlm"; string tachpath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\temp_achievements.rlm"; try { if (!File.Exists(path)) { return(false); } Interface.type("Loading Save...", ConsoleColor.White); DecryptFile(path, tpath, key); Dictionary <string, string> vals = new Dictionary <string, string>(); string line; using (StreamReader file = new StreamReader(tpath)) { while ((line = file.ReadLine()) != null) { string[] split = line.Split(new char[] { '=' }); vals.Add(split[0], split[1]); } foreach (KeyValuePair <string, string> entry in vals) { if (entry.Key == "devmode") { Exception devmode = new Exception("Devmode detected. Load save aborted."); throw devmode; } if (entry.Key == "name") { Main.Player.name = entry.Value; } if (entry.Key == "level") { Main.Player.level = Convert.ToInt32(entry.Value); } if (entry.Key == "xpos") { Map.PlayerPosition.x = Convert.ToInt32(entry.Value); } if (entry.Key == "ypos") { Map.PlayerPosition.y = Convert.ToInt32(entry.Value); } if (entry.Key == "hasmap") { Main.hasmap = true; } if (entry.Key == "wkingdead") { Main.wkingdead = true; } if (entry.Key == "ravendead") { Main.raven_dead = true; } if (entry.Key == "hp") { Main.Player.hp = Convert.ToInt32(entry.Value); } if (entry.Key == "g") { Main.Player.g = Convert.ToInt32(entry.Value); } if (entry.Key == "xp") { Main.Player.xp = Convert.ToInt32(entry.Value); } if (entry.Key == "race") { if (!String.IsNullOrEmpty(entry.Value)) { Main.Player.race = entry.Value; } else { Main.Player.race = "human"; } } if (entry.Key == "class") { if (!String.IsNullOrEmpty(entry.Value)) { Main.Player.pclass = entry.Value; } else { Main.Player.pclass = "warrior"; } } if (entry.Key == "bp1") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.backpack.Add(i); } if (entry.Key == "bp2") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.backpack.Add(i); } if (entry.Key == "bp3") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.backpack.Add(i); } if (entry.Key == "bp4") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.backpack.Add(i); } if (entry.Key == "bp5") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.backpack.Add(i); } if (entry.Key == "bp6") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.backpack.Add(i); } if (entry.Key == "bp7") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.backpack.Add(i); } if (entry.Key == "bp7") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.backpack.Add(i); } if (entry.Key == "bp8") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.backpack.Add(i); } if (entry.Key == "bp9") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.backpack.Add(i); } if (entry.Key == "bp10") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.backpack.Add(i); } if (entry.Key == "primary") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.primary = i; } if (entry.Key == "secondary") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.secondary = i; } if (entry.Key == "armor") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.armor = i; } if (entry.Key == "accessory") { Type atype = Type.GetType(entry.Value); Item i = (Item)Activator.CreateInstance(atype); Main.Player.accessory = i; } if (entry.Key == "slimecounter") { Main.slimecounter = Convert.ToInt32(entry.Value); } if (entry.Key == "goblincounter") { Main.goblincounter = Convert.ToInt32(entry.Value); } if (entry.Key == "banditcounter") { Main.banditcounter = Convert.ToInt32(entry.Value); } if (entry.Key == "drakecounter") { Main.drakecounter = Convert.ToInt32(entry.Value); } if (entry.Key == "Energy Overload") { Main.Player.abilities.AddCommand(new Combat.EnergyOverload("Energy Overload", 'e')); } if (entry.Key == "Blade Dash") { Main.Player.abilities.AddCommand(new Combat.BladeDash("Blade Dash", 'd')); } if (entry.Key == "Holy Smite") { Main.Player.abilities.AddCommand(new Combat.HolySmite("Holy Smite", 'h')); } if (entry.Key == "Consume Soul") { Main.Player.abilities.AddCommand(new Combat.ConsumeSoul("Consume Soul", 'u')); } if (entry.Key == "Curse") { Main.Player.abilities.AddCommand(new Combat.Curse("Curse", 'c')); } if (entry.Key == "Sacrifice") { Main.Player.abilities.AddCommand(new Combat.Sacrifice("Sacrifice", 's')); } if (entry.Key == "Phase") { Main.Player.abilities.AddCommand(new Combat.Phase("Phase", 'p')); } if (entry.Key == "Dawnstrike") { Main.Player.abilities.AddCommand(new Combat.Dawnstrike("Dawnstrike", 't')); } if (entry.Key == "Vorpal Blades") { Main.Player.abilities.AddCommand(new Combat.VorpalBlades("Vorpal Blades", 'v')); } if (entry.Key == "Incinerate") { Main.Player.abilities.AddCommand(new Combat.Incinerate("Incinerate", 'a')); } if (entry.Key == "Heavensplitter") { Main.Player.abilities.AddCommand(new Combat.Heavensplitter("Heavensplitter", 'z')); } if (entry.Key == "Gamble") { Main.Player.abilities.AddCommand(new Combat.Gamble("Gamble", '$')); } if (entry.Key == "Nightshade") { Main.Player.abilities.AddCommand(new Combat.Nightshade("Nightshade", 'n')); } if (entry.Key == "Safeguard") { Main.Player.abilities.AddCommand(new Combat.Safeguard("Safeguard", 'g')); } if (entry.Key == "Mimic") { Main.Player.abilities.AddCommand(new Combat.Mimic("Mimic", 'm')); } if (entry.Key == "Heal") { Main.Player.abilities.AddCommand(new Combat.Heal("Heal", 'l')); } if (entry.Key == "Lightspeed") { Main.Player.abilities.AddCommand(new Combat.Lightspeed("Lightspeed", '!')); } if (entry.Key == "Rage") { Main.Player.abilities.AddCommand(new Combat.Rage("Rage", 'r')); } if (entry.Key == "Hell's Kitchen") { Main.Player.abilities.AddCommand(new Combat.HellsKitchen("Hell's Kitchen", '@')); } if (entry.Key == "Ice Chains") { Main.Player.abilities.AddCommand(new Combat.IceChains("Ice Chains", 'i')); } if (entry.Key == "Now You See Me") { Main.Player.abilities.AddCommand(new Combat.NowYouSeeMe("Now You See Me", 'y')); } if (entry.Key == "Illusion") { Main.Player.abilities.AddCommand(new Combat.Illusion("Illusion", '?')); } if (entry.Key == "Pew Pew Pew") { Main.Player.abilities.AddCommand(new Combat.PewPewPew("Pew Pew Pew", 'w')); } if (entry.Key == "loopnumber") { Main.loop_number = Convert.ToInt32(entry.Value); } if (entry.Key == "wkingcounter") { Main.wkingcounter = Convert.ToInt32(entry.Value); } if (entry.Key == "slibcounter") { Main.slibcounter = Convert.ToInt32(entry.Value); } if (entry.Key == "forrestcounter") { Main.forrestcounter = Convert.ToInt32(entry.Value); } if (entry.Key == "libcounter") { Main.libcounter = Convert.ToInt32(entry.Value); } if (entry.Key == "centrallibcounter") { Main.centrallibcounter = Convert.ToInt32(entry.Value); } if (entry.Key == "ramsaycounter") { Main.ramsaycounter = Convert.ToInt32(entry.Value); } if (entry.Key == "magiccounter") { Main.magiccounter = Convert.ToInt32(entry.Value); } if (entry.Key == "nlibcounter") { Main.nlibcounter = Convert.ToInt32(entry.Value); } if (entry.Key == "townfolkcounter") { Main.townfolkcounter = Convert.ToInt32(entry.Value); } if (entry.Key == "nomadcounter") { Main.nomadcounter = Convert.ToInt32(entry.Value); } if (entry.Key == "minecounter") { Main.minecounter = Convert.ToInt32(entry.Value); } if (entry.Key == "frozencounter") { Main.frozencounter = Convert.ToInt32(entry.Value); } if (entry.Key == "noobcounter") { Main.noobcounter = Convert.ToInt32(entry.Value); } if (entry.Key == "is_thief") { Main.is_theif = true; } if (entry.Key == "intlbuff") { Main.intlbuff = Convert.ToInt32(entry.Value); } if (entry.Key == "atkbuff") { Main.atkbuff = Convert.ToInt32(entry.Value); } if (entry.Key == "defbuff") { Main.defbuff = Convert.ToInt32(entry.Value); } if (entry.Key == "spdbuff") { Main.spdbuff = Convert.ToInt32(entry.Value); } } Interface.type("Done.", ConsoleColor.White); file.Close(); File.Delete(tpath); File.Delete(tachpath); return(true); } } catch (Exception e) { Interface.type("Load failed. Would you like to delete your save? (press 'y' to delete)", ConsoleColor.White); char key = Interface.readkey().KeyChar; if (key == 'y') { File.Delete(path); } else if (key == 'e') { Interface.type(e.ToString()); } File.Delete(tachpath); File.Delete(tpath); WriteError(e); return(false); } }
public static void BattleLoop(Enemy enemy) { Main.game_state = 1; Main.Player.applybonus(); int enemydmg = 0; int mana = 1 + Main.Player.intl / 10; Interface.type("You have entered combat! Ready your weapons!", ConsoleColor.Red); Interface.type("Level " + enemy.level + " " + enemy.name + ":", ConsoleColor.Yellow); Interface.type("-------------------------", ConsoleColor.Yellow); Interface.type("HP: " + enemy.hp, ConsoleColor.Yellow); Interface.type("Attack: " + enemy.atk, ConsoleColor.Yellow); Interface.type("Defense: " + enemy.def, ConsoleColor.Yellow); Interface.type("-------------------------", ConsoleColor.Yellow); bool is_turn = enemy.spd < Main.Player.spd; while (enemy.hp >= 0) { Interface.type("----------------------", ConsoleColor.Cyan); Interface.type("Your HP: " + Main.Player.hp, ConsoleColor.Cyan); Interface.type("Your Mana: " + mana, ConsoleColor.Cyan); Interface.type("----------------------", ConsoleColor.Cyan); Interface.type("Enemy HP: " + enemy.hp, ConsoleColor.Red); Interface.type("----------------------", ConsoleColor.Cyan); if (is_turn && !Main.Player.stunned) { if (Main.Player.phased) { Main.Player.phased = false; } Interface.type("\r\nAVAILABLE MOVES:", ConsoleColor.Cyan); Interface.type("-------------", ConsoleColor.Cyan); int i = 0; foreach (Realm.Combat.Command c in Main.Player.abilities.commands.Values) { string src = "|| " + c.cmdchar + ". " + c.name; Interface.type(src, ConsoleColor.Cyan); i++; } Interface.type("-------------", ConsoleColor.Cyan); Interface.type(""); if (Main.Player.fire >= 3) { Main.Player.on_fire = false; } if (Main.Player.on_fire) { Main.Player.fire++; int dmg = Combat.Dice.roll(1, 3); Main.Player.hp -= dmg; Interface.type("You take " + dmg + " fire damage.", ConsoleColor.Red); } if (Main.Player.blinded) { Main.Player.blinded = false; } if (Main.Player.cursed) { Main.Player.hp -= Combat.Dice.roll(1, 6); Interface.type("You are cursed!", ConsoleColor.Red); } int oldhp = enemy.hp; char ch = Interface.readkey().KeyChar; while (!Main.Player.abilities.commandChars.Contains(ch)) { Interface.type("Invalid."); Interface.type(""); ch = Interface.readkey().KeyChar; } while (ch != 'b' && mana <= 0) { Interface.type("Out of mana!", ConsoleColor.Red); Interface.type(""); ch = Interface.readkey().KeyChar; } if (ch != 'b') { mana--; } if (ch == 'm') { Interface.type("You mimc the enemy's damage!", ConsoleColor.Cyan); enemy.hp -= enemydmg; } if (!Main.Player.blinded) { Main.Player.abilities.ExecuteCommand(ch, enemy); } else { Interface.type("You are blind!", ConsoleColor.Red); if (Combat.Dice.roll(1, 10) == 1) { Interface.type("By some miracle, you manage to hit", ConsoleColor.Cyan); Main.Player.abilities.ExecuteCommand(ch, enemy); int blindenemyhp = oldhp - enemy.hp; if (ch != 'l') { Interface.type("The enemy takes " + blindenemyhp + " damage!", ConsoleColor.Cyan); } } } int enemyhp = oldhp - enemy.hp; if (ch != 'l') { Interface.type("The enemy takes " + enemyhp + " damage!", ConsoleColor.Cyan); } if (enemy.hp <= 0) { Interface.type("Your have defeated " + enemy.name + "!", ConsoleColor.Yellow); enemy.droploot(); Main.Player.levelup(); if (enemy.name == "slime") { Main.slimecounter++; Main.ach.Get("1slime"); } else if (enemy.name == "goblin") { Main.ach.Get("1goblin"); Main.goblincounter++; } else if (enemy.name == "bandit") { Main.banditcounter++; Main.ach.Get("1bandit"); } else if (enemy.name == "drake") { Main.ach.Get("1drake"); Main.drakecounter++; } return; } if (!Main.Player.phased) { is_turn = false; } } else if (Main.Player.stunned) { Interface.type("You are stunned!", ConsoleColor.Red); Main.Player.stunned = false; if (Main.Player.fire >= 3) { Main.Player.on_fire = false; } if (Main.Player.on_fire) { Main.Player.fire++; int dmg = Combat.Dice.roll(1, 3); Main.Player.hp -= dmg; Interface.type("You take " + dmg + " fire damage.", ConsoleColor.Red); } if (Main.Player.cursed) { Main.Player.hp -= Combat.Dice.roll(1, 6); Interface.type("You are cursed!", ConsoleColor.Red); } is_turn = false; } else if (!is_turn && !enemy.stunned) { if (enemy.fire >= 3) { enemy.on_fire = false; } if (Main.Player.guard >= 2) { Main.Player.guarded = false; } if (Main.Player.guarded) { Main.Player.guard++; } if (enemy.blinded) { enemy.blinded = false; } if (enemy.on_fire) { enemy.fire++; int dmg = Combat.Dice.roll(1, 3); enemy.hp -= dmg; Interface.type(enemy.name + " takes " + dmg + " fire damage.", ConsoleColor.Cyan); if (enemy.hp <= 0) { Interface.type("Your have defeated " + enemy.name + "!", ConsoleColor.Yellow); enemy.droploot(); Main.Player.levelup(); if (enemy.name == "slime") { Main.slimecounter++; Main.ach.Get("1slime"); } else if (enemy.name == "goblin") { Main.ach.Get("1goblin"); Main.goblincounter++; } else if (enemy.name == "bandit") { Main.banditcounter++; Main.ach.Get("1bandit"); } else if (enemy.name == "drake") { Main.ach.Get("1drake"); Main.drakecounter++; } return; } } if (enemy.cursed) { Interface.type(enemy.name + " is cursed!", ConsoleColor.Cyan); enemy.hp -= Combat.Dice.roll(1, 6); if (enemy.hp <= 0) { Interface.type("Your have defeated " + enemy.name + "!", ConsoleColor.Yellow); enemy.droploot(); Main.Player.levelup(); return; } } if (enemy.trapped) { Interface.type("Your trap has sprung!"); int dmg = (Main.Player.level / 5) + (Main.Player.intl / 3) + Combat.Dice.roll(1, 5); enemy.hp -= dmg; Interface.type(enemy.name + " takes " + dmg + " damage!", ConsoleColor.Cyan); if (enemy.hp <= 0) { Interface.type("Your have defeated " + enemy.name + "!", ConsoleColor.Yellow); enemy.droploot(); Main.Player.levelup(); return; } } if (enemy.hp <= 0) { Interface.type("Your have defeated " + enemy.name + "!", ConsoleColor.Yellow); enemy.droploot(); Main.Player.levelup(); return; } int oldhp = Main.Player.hp; string ability; if (!Main.Player.guarded && !enemy.blinded) { enemy.attack(out ability); enemydmg = oldhp - Main.Player.hp; Interface.type(enemy.name + " used " + ability, ConsoleColor.Red); Interface.type("You take " + enemydmg + " damage!", ConsoleColor.Red); } else { if (Main.Player.blinded) { Interface.type(enemy.name + "is blind!", ConsoleColor.Cyan); if (Combat.Dice.roll(1, 10) == 1) { Interface.type("By some miracle, " + enemy.name + " manages to hit you!", ConsoleColor.Red); enemy.attack(out ability); enemydmg = oldhp - Main.Player.hp; Interface.type(enemy.name + " used " + ability, ConsoleColor.Red); Interface.type("You take " + enemydmg + " damage!", ConsoleColor.Red); } } else if (Main.Player.guarded) { Interface.type("Safeguard prevented damage!", ConsoleColor.Cyan); } } if (Main.Player.hp <= 0) { End.GameOver(); } is_turn = true; } else if (enemy.stunned) { Interface.type(enemy.name + " is stunned!", ConsoleColor.Cyan); enemy.stunned = false; if (enemy.fire >= 3) { enemy.on_fire = false; } if (enemy.on_fire) { enemy.fire++; int dmg = Combat.Dice.roll(1, 3); enemy.hp -= dmg; Interface.type(enemy.name + " takes " + dmg + " fire damage.", ConsoleColor.Cyan); } if (enemy.cursed) { Interface.type(enemy.name + " is cursed!", ConsoleColor.Cyan); enemy.hp -= Combat.Dice.roll(1, 6); } if (enemy.hp <= 0) { Interface.type("Your have defeated " + enemy.name + "!", ConsoleColor.Yellow); enemy.droploot(); Main.Player.levelup(); if (enemy.name == "slime") { Main.slimecounter++; Main.ach.Get("1slime"); } else if (enemy.name == "goblin") { Main.ach.Get("1goblin"); Main.goblincounter++; } else if (enemy.name == "bandit") { Main.banditcounter++; Main.ach.Get("1bandit"); } else if (enemy.name == "drake") { Main.ach.Get("1drake"); Main.drakecounter++; } return; } is_turn = true; } } }
public static void CaveLoop() { caveplace currPlace = new caveplace(); Main.Player.applybonus(); while (Main.Player.hp > 0) { Enemy enemy = new Enemy(); Main.Player.levelup(); currPlace = Map.cavemap[Map.CavePosition]; if (Main.Player.hp > Main.Player.maxhp) { Main.Player.hp = Main.Player.maxhp; } if (Combat.CheckBattle() && currPlace.getEnemyList() != null) { enemy = currPlace.getEnemyList(); Combat.BattleLoop(enemy); } if (!Main.devmode) { Main.Player.applybonus(); } else { Main.Player.applydevbonus(); } if (!Main.devmode) { Interface.type("-------------------------------------"); Interface.type(Main.Player.name + "(" + Main.Player.race + ")," + " Level " + Main.Player.level + " " + Main.Player.pclass + ":"); Interface.type("HP: " + Main.Player.hp + "/" + Main.Player.maxhp); Interface.type("Attack: " + Main.Player.atk + " / Defense: " + Main.Player.def + " / Speed: " + Main.spdbuff + " / Intelligence: " + Main.Player.intl); Interface.type("Mana: " + (1 + (Main.Player.intl / 10))); Interface.type("Gold: " + Main.Player.g + " / Exp to Level: " + (Main.Player.xp_next - Main.Player.xp)); Interface.type("-------------------------------------"); } if (!Main.devmode) { Interface.type(currPlace.Description); } else { Interface.type(currPlace.ToString()); } ConsoleKeyInfo command = Interface.readkey(); if (command.KeyChar == 'x') { Interface.type("\r\nAre you sure?"); char surecommand = Interface.readkey().KeyChar; if (surecommand == 'y') { End.GameOver(); } } else if (command.Key == ConsoleKey.Escape) { Environment.Exit(0); } else if (command.KeyChar == '-' && Main.devmode) { string input = Interface.readinput(); if (input == "e") { End.Endgame(); } else if (input == "c") { string combat_input = Interface.readinput(); Type etype = Type.GetType("Realm." + combat_input); Enemy e = (Enemy)Activator.CreateInstance(etype); Combat.BattleLoop(e); } else if (input == "n") { Main.Player.name = Interface.readinput(); } else if (input == "a") { string add_input = Interface.readinput(); Type atype = Type.GetType("Realm." + add_input); Item i = (Item)Activator.CreateInstance(atype); if (Main.Player.backpack.Count <= 10) { Main.Player.backpack.Add(i); } else { Interface.type("Not enough space."); } Interface.type("Obtained '" + i.name + "'!"); } else if (input == "p") { string p_input = Interface.readinput(); Type atype = Type.GetType("Realm." + p_input); Item i = (Item)Activator.CreateInstance(atype); Main.Player.primary = i; } else if (input == "t") { string place_input = Interface.readinput(); Type ptype = Type.GetType("Realm." + place_input); Place p = (Place)Activator.CreateInstance(ptype); } } else { currPlace.handleInput(command.KeyChar); } Main.loop_number++; } }
public override bool Execute(object Data) { Item i = (Item)Data; Interface.type(i.name); Interface.type("Description: " + i.desc, ConsoleColor.Green); Interface.type("Attack Buff: " + i.atkbuff + " / Defense Buff: " + i.defbuff + " / Speed Buff: " + i.spdbuff + " / Intelligence Buff: " + i.intlbuff, ConsoleColor.Green); if (i.slot == 1) { Interface.type("Slot: Primary", ConsoleColor.Green); } else if (i.slot == 2) { Interface.type("Slot: Secondary", ConsoleColor.Green); } else if (i.slot == 3) { Interface.type("Slot: Armor", ConsoleColor.Green); } else if (i.slot == 4) { Interface.type("Slot: Accessory", ConsoleColor.Green); } Interface.type("Tier: ", ConsoleColor.Green); Interface.typeOnSameLine(i.tier.ToString(), (i.tier == 0 ? ConsoleColor.Gray : i.tier == 1 ? ConsoleColor.White : i.tier == 2 ? ConsoleColor.Blue : i.tier == 3 ? ConsoleColor.Yellow : i.tier == 4 ? ConsoleColor.Red : i.tier == 5 ? ConsoleColor.Magenta : i.tier == 6 ? ConsoleColor.Cyan : ConsoleColor.DarkMagenta)); Interface.type("Enter (y) to equip this item, (d) to destroy and anything else to go back.", ConsoleColor.Green); char c = Interface.readkey().KeyChar; switch (c) { case 'y': if (i.slot == 1) { Main.Player.primary = i; } else if (i.slot == 2) { Main.Player.secondary = i; } else if (i.slot == 3) { Main.Player.armor = i; } else if (i.slot == 4) { Main.Player.accessory = i; } break; case 'd': if (i.slot == 1) { if (Main.Player.primary == i) { Main.Player.primary = new Item(); } Main.Player.backpack.Remove(i); } else if (i.slot == 2) { if (Main.Player.secondary == i) { Main.Player.secondary = new Item(); } Main.Player.backpack.Remove(i); } else if (i.slot == 3) { if (Main.Player.armor == i) { Main.Player.armor = new Item(); } Main.Player.backpack.Remove(i); } else if (i.slot == 4) { if (Main.Player.accessory == i) { Main.Player.accessory = new Item(); } Main.Player.backpack.Remove(i); } break; default: return(false); } return(true); }
public static void Tutorial() { List <string> racelist = new List <string> { "human", "elf", "rockman", "giant", "zephyr", "shade" }; List <string> classlist = new List <string> { "warrior", "paladin", "mage", "thief" }; List <string> secret = new List <string>(); if (achieve["100slimes"]) { secret.Add("Slime"); } if (achieve["100goblins"]) { secret.Add("Goblin"); } if (achieve["100bandits"]) { secret.Add("Bandit"); } if (achieve["100drakes"]) { secret.Add("Drake"); } is_typing = true; Interface.type("Welcome, "); Interface.typeOnSameLine(Player.name, ConsoleColor.White); Interface.typeOnSameLine(", to Realm."); if (achieve["finalboss"]) { Player.backpack.Add(new nightbringer()); } if (!devmode) { Interface.type("Skip the tutorial? (y/n)"); if (Interface.readkey().KeyChar == 'n') { Interface.type("To do anything in Realm, simply press one of the listed commands."); Interface.type("If at any time, you wish to you view you stats, press 'v'"); Interface.type("Make sure to visit every library! They offer many valuable abilities as well as experience."); Interface.type("When in combat, select an availible move. All damage is randomized. Mana is refilled after each fight."); Interface.type("While in the backpack, simply select a number corresponding to an item. You may swap this item in or out. Make sure to equip an item once you pick it up!"); Interface.type("At any specified time, you may press x, then y. This will cause you to commit suicide."); Interface.type("At any specified time, you may press #. Doing so will save the game."); } Interface.type("In Realm, every player selects a race. Each race gives its own bonuses. You may choose from Human, Elf, Rockman, Giant, Zephyr, or Shade."); if (achieve["100slimes"] || achieve["100goblins"] || achieve["100bandits"] || achieve["100drakes"]) { Interface.type("Secret Races: ", ConsoleColor.Yellow); for (int i = 0; i < secret.Count; i++) { if (i > 1) { Interface.typeOnSameLine(", ", ConsoleColor.Yellow); } Interface.type(secret[i], ConsoleColor.Yellow); } foreach (string s in secret) { racelist.Add(s); } } Interface.type("Please enter a race. "); is_typing = false; string race = Interface.readinput(); while (!racelist.Contains(race)) { Interface.type("Invalid. Please try again. "); race = Interface.readinput(); } Player.race = race; Interface.type("You have selected " + Interface.ToUpperFirstLetter(Player.race) + ".", ConsoleColor.Magenta); Interface.type("Each player also has a class. You may choose from Warrior, Paladin, Mage, or Thief."); Interface.type("Please enter a class. "); string pclass = Interface.readinput(); while (!classlist.Contains(pclass)) { Interface.type("Invalid. Please try again. "); pclass = Interface.readinput(); } Player.pclass = pclass; Interface.type("You have selected " + Interface.ToUpperFirstLetter(Player.pclass) + ".", ConsoleColor.Magenta); Interface.type("You are now ready to play Realm. Good luck!"); Interface.type("Press any key to continue.", ConsoleColor.White); Interface.readkey(); Map.PlayerPosition.x = 0; Map.PlayerPosition.y = 6; if (Player.race == "giant") { Player.hp = 15; } } MainLoop(); }
public static void MainLoop() { game_state = 0; Place currPlace; while (Player.hp > 0) { if (slimecounter == 100) { ach.Get("100slimes"); } if (goblincounter == 100) { ach.Get("100goblins"); } if (banditcounter == 100) { ach.Get("100bandits"); } if (drakecounter == 100) { ach.Get("100drakes"); } Tuple <int, int> xy = Map.CoordinatesOf(typeof(Nomad)); Map.map[xy.Item1, xy.Item2] = new Place(); Tuple <int, int> nextNomad = Map.getRandomBlankTile(); Map.map[nextNomad.Item1, nextNomad.Item2] = new Nomad(); foreach (Place p in Map.map) { if (p.GetType() == typeof(Place)) { p.is_npc_active = false; } } Tuple <int, int> randomTile = Map.getRandomBlankTile(); if (rand.NextDouble() <= .1) { Map.map[randomTile.Item1, randomTile.Item2].is_npc_active = true; } if (devmode) { Interface.type("Dev Powers!", ConsoleColor.DarkMagenta); Player.primary = new phantasmal_claymore(); Player.secondary = new spectral_bulwark(); Player.armor = new illusory_plate(); Player.accessory = new void_cloak(); hasmap = true; } Player.applybonus(); Enemy enemy = new Enemy(); Player.levelup(); currPlace = Map.map[Map.PlayerPosition.x, Map.PlayerPosition.y]; if (Player.hp > Player.maxhp) { Player.hp = Player.maxhp; } if (loop_number >= 1) { if (Combat.CheckBattle() && currPlace.getEnemyList() != null && !devmode) { enemy = currPlace.getEnemyList(); Combat.BattleLoop(enemy); } } Item pc = new phantasmal_claymore(); Item sb = new spectral_bulwark(); Item ip = new illusory_plate(); Item vc = new void_cloak(); if ((Player.backpack.Contains(pc) && Player.backpack.Contains(sb) && Player.backpack.Contains(ip) && Player.backpack.Contains(vc)) || devmode) { if (!Player.abilities.commandChars.Contains('*')) { Player.abilities.AddCommand(new Combat.EndtheIllusion("End the Illusion", '*')); } ach.Get("set"); } if (devmode) { Interface.type(Map.PlayerPosition.x + " " + Map.PlayerPosition.y); } if (!devmode) { Player.applybonus(); } else { Player.applydevbonus(); } if (gbooks >= 3 && !Player.abilities.commandChars.Contains('@')) { Interface.type("Having read all of the Ramsay books, you are enlightened in the ways of Gordon Ramsay."); Player.abilities.AddCommand(new Combat.HellsKitchen("Hell's Kitchen", '@')); } if (!devmode) { Interface.type(currPlace.Description); } else { Interface.type(currPlace.ToString()); } char[] currcommands = currPlace.getAvailableCommands(); Interface.typeOnSameLine("\r\nYour current commands are x", ConsoleColor.Cyan); foreach (char c in currcommands) { Interface.typeOnSameLine(", " + c, ConsoleColor.Cyan); } Interface.type(""); ConsoleKeyInfo command = Interface.readkey(); if (command.KeyChar == 'x') { Interface.type("\r\nAre you sure?", ConsoleColor.Red); char surecommand = Interface.readkey().KeyChar; if (surecommand == 'y') { End.GameOver(); } } else if (command.Key == ConsoleKey.Escape) { Environment.Exit(0); } else if (command.KeyChar == '-' && devmode) { string input = Interface.readinput(); if (input == "end") { End.Endgame(); } else if (input == "combat") { string combat_input = Interface.readinput(); Type etype = Type.GetType("Realm." + combat_input); try { Enemy e = (Enemy)Activator.CreateInstance(etype); Combat.BattleLoop(e); } catch (ArgumentNullException) { Interface.type("Invalid Enemy."); } } else if (input == "name") { Player.name = Interface.readinput(); } else if (input == "additem") { string add_input = Interface.readinput(); Type atype = Type.GetType("Realm." + add_input); try { Item i = (Item)Activator.CreateInstance(atype); if (Player.backpack.Count <= 10) { Player.backpack.Add(i); Interface.type("Obtained '" + i.name + "'!"); } else { Interface.type("Not enough space."); } } catch (ArgumentNullException) { Interface.type("Invalid Item."); } } else if (input == "droploot") { if (Main.rand.NextDouble() <= .1d) { Main.Player.backpack.Add(MainItemList[Main.rand.Next(0, MainItemList.Count - 1)]); Interface.type("Obtained " + MainItemList[Main.rand.Next(0, MainItemList.Count - 1)].name + "!", ConsoleColor.Green); } else { Interface.type("Nothing dropped."); } } else if (input == "teleport") { int xcoord = Int32.Parse(Interface.readinput()); int ycoord = Int32.Parse(Interface.readinput()); Map.PlayerPosition.x = xcoord; Map.PlayerPosition.y = ycoord; } else if (input == "level") { Main.Player.level = Convert.ToInt32(Interface.readinput()); } else if (input == "levelup") { Main.Player.xp += Main.Player.xp_next; } else if (input == "getach") { ach.Get(Interface.readinput()); } else if (input == "suicide") { End.GameOver(); } } else { currPlace.handleInput(command.KeyChar); } loop_number++; } }