Example #1
0
        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();
        }
Example #2
0
            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);
            }
Example #3
0
        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++;
            }
        }