示例#1
0
 public static void update(Player p)
 {
     Directory.CreateDirectory("/DungeonCrawl/morgue");
     StreamWriter morgue = new StreamWriter("/DungeonCrawl/morgue/" + DateTime.Now.ToBinary() + ".morgue");
     morgue.Write(p.name + " was a " + p.species.name + " " + p.career.name + " (CoD: " + p.death + ") who on turn " + Program.currTurn + " died at " + Program.renderX + "/" + Program.renderY + " on floor " + Program.area + " " + Program.floor);
     morgue.Close();
 }
示例#2
0
 public void useAbility(Player p)
 {
     if (p.stats.mana >= etherCost)
     {
         p.stats.mana -= etherCost;
         p.hurt(healthCost, true, "You drained some health to perform " + name + "!");
         if (effect == AbilityEffect.RESTHEAL)
         {
             p.stats.health += (int)(0.25f * p.stats.maxHealth);
             if (p.stats.health > p.stats.maxHealth)
             {
                 p.stats.health = p.stats.maxHealth;
             }
             Program.msgLog.Add("You feel rested!");
         }
         if (effect == AbilityEffect.TOGGLEFLIGHT)
         {
             if (p.status.hasAttr("Fly"))
             {
                 p.status.removeAttr("Fly");
             }
             else
             {
                 p.status.addStatus(new Status("Fly", 1, true, ConsoleForeground.Cyan, ConsoleBackground.Black));
             }
         }
     }
 }
示例#3
0
 public static double calcInvWeight(Player p)
 {
     double i = 0;
     for (int x = 0; x < p.inventory.Length; x++)
     {
         if (p.inventoryStacks[x] > 0)
         {
             i += p.inventory[x].weight * p.inventoryStacks[x];
         }
     }
     return i;
 }
示例#4
0
 public void useItem(Player p)
 {
     if (edible)
     {
         p.hunger += foodFill;
     }
 }
示例#5
0
        public static void showMainMenu()
        {
            Boolean hasSelectedSpecies = false;
            Boolean hasSelectedClass = false;

            //Draw the species list
            while (!hasSelectedSpecies)
            {
                string bufferClear = "";
                for (int x = 0; x < 69; x++)
                {
                    bufferClear += " ";
                }
                ConsoleEx.DrawRectangle(BorderStyle.Text, 0, 0, 70, Species.speciesList.Length + 3, false);
                Util.writeLn("Select a species", 2, 0);
                Species.drawAllSpecies();
                Util.writeLn(bufferClear, 1, Species.speciesList.Length + 2);
                Util.writeLn(Species.speciesList[selectedSpecies].lore, 1, Species.speciesList.Length + 2);
                ConsoleKeyInfo keyInfo = Console.ReadKey();
                if (keyInfo.Key == ConsoleKey.DownArrow)
                {
                    selectedSpecies++;
                    if (selectedSpecies > Species.speciesList.Length - 1)
                    {
                        selectedSpecies = 0;
                    }
                }
                if (keyInfo.Key == ConsoleKey.UpArrow)
                {
                    selectedSpecies--;
                    if (selectedSpecies < 0)
                    {
                        selectedSpecies = Species.speciesList.Length - 1;
                    }
                }
                if (keyInfo.Key == ConsoleKey.Enter)
                {
                    currSpecies = Species.speciesList[selectedSpecies];
                    hasSelectedSpecies = true;
                }
            }
            Console.Clear();
            selectedSpecies = 0;
            while (!hasSelectedClass)
            {
                ConsoleEx.TextColor(ConsoleForeground.DarkGray, ConsoleBackground.Black);
                ConsoleEx.DrawRectangle(BorderStyle.Text, 0, Class.classList.Length + 2, 70, Species.speciesList.Length + 3, false);
                Util.writeLn("Select a species", Class.classList.Length + 4, 0);
                Species.drawAllSpecies(Class.classList.Length + 2);
                Util.writeLn(currSpecies.lore, 1, Species.speciesList.Length + 2 + Class.classList.Length + 2);

                ConsoleEx.TextColor(ConsoleForeground.LightGray, ConsoleBackground.Black);
                ConsoleEx.DrawRectangle(BorderStyle.Text, 0, 0, 70, Class.classList.Length + 1, false);
                Util.writeLn("Select a class--Species: " + currSpecies.abbrv, 2, 0);
                Class.drawAllClasses();
                ConsoleKeyInfo keyInfo = Console.ReadKey();
                if (keyInfo.Key == ConsoleKey.DownArrow)
                {
                    selectedSpecies++;
                    if (selectedSpecies > Species.speciesList.Length - 1)
                    {
                        selectedSpecies = 0;
                    }
                }
                if (keyInfo.Key == ConsoleKey.UpArrow)
                {
                    selectedSpecies--;
                    if (selectedSpecies < 0)
                    {
                        selectedSpecies = Species.speciesList.Length - 1;
                    }
                }
                if (keyInfo.Key == ConsoleKey.Enter)
                {
                    currClass = Class.classList[selectedSpecies];
                    hasSelectedClass = true;
                }
            }
            Console.Clear();
            Console.WriteLine("What is your name?");
            player = new Player(Console.ReadLine(), currSpecies, currClass);
            //Console.WriteLine("You are a " + player.identifier);
            Console.WriteLine();
            player.WriteStats();
            player.stats.calcStats();
            Console.ReadLine();
            world.genMap();
            levelMap.Add(Program.area + ":" + Program.floor, world);
            startGame();
        }