Esempio n. 1
0
 public void TakeDamage(int dmg)
 {
     if (dmg < armor)
     {
         dmg = 0;
     }
     else
     {
         dmg -= armor;
     }
     Hp -= dmg;
     MainGame.Say("You recieved ", 25);
     MainGame.Say(dmg + " damage.\n", ConsoleColor.DarkRed, 25);
     if (hp == 0)
     {
         MainGame.Say("----------YOU DIED----------\n", ConsoleColor.DarkRed, 25);
         MainGame.Say("Restart?(y/n)\n", 25);
         if (StrInput.YNInput())
         {
             MainGame.Restart = true;
         }
         else
         {
             MainGame.Restart = false;
         }
     }
 }
Esempio n. 2
0
 private void Equip(int ind)                     //equpping item
 {
     if (slots.ContainsKey(inventory[ind].Slot)) //if slot already has item we ask should we replace it
     {
         MainGame.Say("This slot is occupied. Replace?(y/n)", 25);
         if (StrInput.YNInput())
         {//replacin
             Console.Write("\n");
             Item tmp = inventory[ind];
             inventory[ind]             = slots[inventory[ind].Slot];
             slots[inventory[ind].Slot] = tmp;
             MainGame.Say("You replaced ", 25);
             MainGame.Say(inventory[ind].Name, MainGame.GetColor(inventory[ind].Rareness), 25);;
             MainGame.Say(" with ", 25);
             MainGame.Say(slots[inventory[ind].Slot].Name + ".\n", MainGame.GetColor(slots[inventory[ind].Slot].Rareness), 25);
         }
         else//ok den
         {
             Console.Write("\n");
             return;
         }
     }
     else//or we can just equip it
     {
         slots[inventory[ind].Slot] = inventory[ind];
         MainGame.Say("You equipped ", 25);
         MainGame.Say(slots[inventory[ind].Slot].Name + ".\n", MainGame.GetColor(slots[inventory[ind].Slot].Rareness), 25);
         inventory.RemoveAt(ind);
     }
     StatCalc();//recalc stats
 }
Esempio n. 3
0
 //----------------------------------NAME----------------------------------------
 public void GetName()//name check
 {
     MainGame.Say("\n-So what you're callin yourself?\n", ConsoleColor.Yellow, 25);
     do
     {
         name = StrInput.CleanInput();
         if (string.IsNullOrWhiteSpace(name))
         {
             MainGame.Say("-Speak louder, I can't hear!\n", ConsoleColor.Yellow, 25);
         }
     } while (string.IsNullOrWhiteSpace(name));
     name = name.Trim();//deleting space
 }
Esempio n. 4
0
        public static void LootRoom(Player player)
        {
            Room room = player.currentRoom;

            Say("You search room for loot\n", 25);
            room.ListItems();
            if (player.InventoryIsFull)
            {
                MainGame.Say("Your inventory is full\n", 25);
            }
            else if (room.Loot.Count != 0 && !player.InventoryIsFull)//obvious cheking if room has looot and player's pockets aren't full(just because WE CAN check)
            {
                string choice;
                char[] items;                      //we will need them
                MainGame.Say("Which one you want to pick?(Write nums of items through space, 'A' to pick all, 'Enter' to move on)\n", 25);
                choice = StrInput.CleanInput();    //player writes item nums in string through space(but honestly we don't beacuse we wiil read as single num them anyway)
                items  = ParseStringDigit(choice); //taking only digits from string that was submitted and putting them in char array
                Console.Write("\n");
                if (choice == "" || items.Length == 0)
                {
                }                                            //if player choses nothing he inputs emty string so we just move forward
                else if (items[0] == 'A' || items[0] == 'a') //if player wants to take all he submits a letter A in front of string and we procced
                {
                    foreach (Item item in room.Loot)
                    {
                        player.GetItem(item);
                        if (player.InventoryIsFull)
                        {
                            break;
                        }
                    }
                    room.Loot.RemoveRange(0, room.Loot.Count);
                }
                else//else we just watchin what player submitted
                {
                    foreach (char ch in items)
                    {
                        if (ch <= 48 || ch - 48 > room.Loot.Count || ch == 'a' || ch == 'A')
                        {
                            continue;
                        }
                        if (room.Loot[ch - 49] != null)
                        {
                            player.GetItem(room.Loot[ch - 49]);
                            room.Loot[ch - 49] = null;//we make item place in list null so order in list doesn't change
                        }
                    }
                }
                room.EraseNulls();//erasing nulls because it may disrupt us
            }
        }
Esempio n. 5
0
        public void OpenEquipment()
        {
            string slot;
            int    c;

st:
            if (slots.ContainsKey("head"))
            {
                slots["head"].ShortStats();
            }
            if (slots.ContainsKey("chest"))
            {
                slots["chest"].ShortStats();
            }
            if (slots.ContainsKey("legs"))
            {
                slots["legs"].ShortStats();
            }
            if (slots.ContainsKey("weapon"))
            {
                slots["weapon"].ShortStats();
            }
            Condition();
            slot = StrInput.NoDigitSpace();
            slots[slot].ItemStats();
            MainGame.Say("Press 'E' to unequip slot, 'B' to choose another slot, 'C' to close equipment", 25);
            do
            {
                c = InvControl(0);
                if (c == 'e')
                {
                    Unequip(slot);
                }
                else if (c == 'b')
                {
                    goto st;
                }
                else if (c == 'c')
                {
                    return;
                }
            } while (c != 'e');
            goto st;
        }
Esempio n. 6
0
        //----------------------------------STATS---------------------------------------
        public void GetStats()//askin about stats
        {
            int pts = 15;

            MainGame.Say("-A'right, " + name + ", now I wanna test your skills, wanna se what you're capable of.\n", ConsoleColor.Yellow, 25);
            MainGame.Say("You have 15 point that you can spend in 3 stats: ", 25);
            MainGame.Say("strength", ConsoleColor.Red, 25);
            MainGame.Say(", ", 25);
            MainGame.Say("agility", ConsoleColor.Green, 25);
            MainGame.Say(" and ", 25);
            MainGame.Say("intellect", ConsoleColor.Blue, 25);
            MainGame.Say(".\n", 25);
            MainGame.Say("Each stat affects some of your stats and can maximum have 9 points.\n\n", 25);
            StatField(ref strength, ref pts, ConsoleColor.Red);
            StatField(ref agility, ref pts, ConsoleColor.Green);
            StatField(ref intellect, ref pts, ConsoleColor.Blue);
            StatCalc();
            do
            {
                MainGame.Say("\nSo you have:\n", 25);
                StatOut();
                if (pts != 0)
                {
                    MainGame.Say("You have " + pts + " unused points. ", 25);
                }
                MainGame.Say("Are you sure you want to continue?(y/n)", 25);
                if (StrInput.YNInput())
                {
                    return;
                }
                else
                {
                    Console.Write("\n");
                    StatField(ref intellect, ref pts, ConsoleColor.Blue);
                    StatCalc();
                }
            } while (true);
        }