コード例 #1
0
        public void UseShieldPot(Player player, Item item, HUD hud)
        {
            if (stockItems[(int)ITEM.POTSHELL] > 0)
            {
                DecreaseStock(ITEM.POTSHELL);
                player.HealShell(item.Power(Global.ITEM_AVATAR(ITEM.POTSHELL)), this, hud);

                //update HUD bar and display to HUD text box
                hud.setHudHealthAndShield(player.Health(), player.Shield());
                hud.Draw();// updates visible inventory
                hud.UpdateHotBar(player, this);
            }
            else
            {
                hud.DisplayText($"< {player.Name()} {Global.MESSAGE_POTSHIELDMISSING} >", false);
            }
        }
コード例 #2
0
        public void PickupFoundItems(Player player, List <Item> items, HUD hud)
        {
            for (int i = 0; i < items.Count; i++)
            {
                if (items[i].PickedUpByPlayer())
                {
                    //switch statement changed to if else to accept Global parameter

                    /*for (int j = 0; j < Global.globalAccess.itemIDs.Count; j++)
                     *                  {
                     *                          string ID = j.ToString();
                     *                          if (items[i].Avatar() == Global.ITEM_AVATAR(ID))
                     *                          {
                     *                                  IncreaseStock(ID);
                     *                          }
                     *                  }*/

                    if (items[i].Avatar() == Global.ITEM_AVATAR(ITEM.POTHEAL))
                    {
                        IncreaseStock(ITEM.POTHEAL);
                    }
                    else if (items[i].Avatar() == Global.ITEM_AVATAR(ITEM.POTSHELL))
                    {
                        IncreaseStock(ITEM.POTSHELL);
                    }
                    else if (items[i].Avatar() == Global.ITEM_AVATAR(ITEM.KEYBIG))
                    {
                        IncreaseStock(ITEM.KEYBIG);
                    }
                    else if (items[i].Avatar() == Global.ITEM_AVATAR(ITEM.KEYSMALL))
                    {
                        IncreaseStock(ITEM.KEYSMALL);
                    }

                    hud.UpdateHotBar(player, this);
                    hud.Draw();
                    hud.DisplayText($"< {player.Name()} picked up {items[i].Name()} [{items[i].Avatar()}] >", false);
                    items[i].PickedUpByPlayer(false);                     // removes the items ability to be picked up /this completes the process of putting the item in the invetory, otherwise pick up every item set to pickedup every time player picks up new item
                }
            }
        }
コード例 #3
0
        private void UseInvetoryOutput(Player player, Item item, TradeMenu tradeMenu)         // SpaceBar Input / HOLDS OBJECT USE SLOTS /
        {
            Weapon weapon = player.EquipedWeapon();

            if (menuInput.Key == ConsoleKey.Spacebar)
            {
                //item slots // max 20

                /*for (int i = 0; i < this.itemPos.GetLength(0); i++)
                 *              {
                 *                      if (cursorPos == i)
                 *                      {
                 *                              for (int j = 0; j < Global.globalAccess.itemIDs.Count; j++)
                 *                              {
                 *                                      string ID = j.ToString();
                 *                                      if (item.Avatar() == Global.globalAccess.ItemValues.avatars[j])
                 *                                      {
                 *                                              if (Global.globalAccess.ItemValues.effects[i] == "none" || Global.globalAccess.ItemValues.effects[i] == null) // should be enum
                 *                                              {
                 *                                                      hud.DisplayText($"< this item is insignificant >", false);
                 *                                              }
                 *                                              else if (Regex.IsMatch(Global.globalAccess.ItemValues.desc[i], @"^[a-zA-Z]+$"))
                 #region regex explaination
                 *                                                      /// ^ start of the string
                 *                                                      /// [] character set
                 *                                                      /// \ one time
                 *                                                      /// + continious
                 *                                                      /// $ end of the string
                 #endregion
                 *                                              {
                 *                                                      if (cursorPos == i) { hud.DisplayText($" \"{Global.globalAccess.ItemValues.desc[i]}\"", false); }
                 *                                                      else { hud.DisplayText($"< i can't seem to remember what this is >", false); }
                 *
                 *                                                      if (Global.globalAccess.ItemValues.powers[i] > 0)
                 *                                                      {
                 *                                                              UsePot(player, item, hud, Global.globalAccess.ItemValues.effects[i]);
                 *                                                      }
                 *                                                      else { hud.DisplayText($"< it has no effect >", false); }
                 *                                              }
                 *                                              else
                 *                                              {  }
                 *                                      }
                 *                              }
                 *                      }
                 *              }
                 */
                if (cursorPos == 1)
                {
                    UseHealthPot(player, item, hud);
                }
                else if (cursorPos == 2)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 3)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 4)
                {
                    hud.DisplayText(" \"A Big Key, for Big Problems, I mean Big Doors\"", false);
                }
                else if (cursorPos == 5)
                {
                    hud.DisplayText(" \"A Small Key, it looks generic, I bet it would fit most locks\"", false);
                }
                else if (cursorPos == 6)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 7)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 8)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 9)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 10)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 11)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 12)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 13)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 14)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 15)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 16)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 17)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else if (cursorPos == 18)
                {
                    hud.DisplayText($"< empty >", false);
                }
                else
                {
                    hud.DisplayText($"< empty >", false);
                }

                //weapon slots
                for (int i = 0; i < Global.globalAccess.weaponIDs.Count; i++)
                {
                    string ID = i.ToString();
                    if (cursorPos == 20 + i && stockWeapons[Global.globalAccess.weaponIDs[ID]])
                    {
                        player.damageMultiplier = tradeMenu.kaliburnDamageMultiplier; player.EquipWeapon(ID); hud.DisplayText($"< {player.Name()} Equiped {weapon.Name()} >", false);
                    }
                    else
                    {
                        hud.DisplayText($"< {player.Name()} Equiped nothing... >", false);
                    }
                }

                /*else if (navigator == 20 && _stockWeapons[(int)WEAPON.FISTS]) { player.EquipWeapon(WEAPON.FISTS); hud.DisplayText($"< {player.Name()} Equiped {weapon.Name()} >", false); }
                 * else if (navigator == 21 && _stockWeapons[(int)WEAPON.DAGGER]) { hud.DisplayText($"< {player.Name()} Equiped nothing... >", false); } else { player.damageMultiplier = tradeMenu.daggerDamageMultiplier; player.EquipWeapon(WEAPON.DAGGER); hud.DisplayText($"< {player.Name()} Equiped {weapon.Name()} >", false); }
                 * else if (navigator == 22 && _stockWeapons[(int)WEAPON.SHORTSWORD]) { hud.DisplayText($"< {player.Name()} Equiped nothing... >", false); } else { player.damageMultiplier = tradeMenu.shortswordDamageMultiplier; player.EquipWeapon(WEAPON.SHORTSWORD); hud.DisplayText($"< {player.Name()} Equiped {weapon.Name()} >", false); }
                 * else if (navigator == 23 && _stockWeapons[(int)WEAPON.BROADSWORD]) { hud.DisplayText($"< {player.Name()} Equiped nothing... >", false); } else { player.damageMultiplier = tradeMenu.broadswordDamageMultplier; player.EquipWeapon(WEAPON.BROADSWORD); hud.DisplayText($"< {player.Name()} Equiped {weapon.Name()} >", false); }
                 * else if (navigator == 24 && _stockWeapons[(int)WEAPON.LONGSWORD]) { hud.DisplayText($"< {player.Name()} Equiped nothing... >", false); } else { player.damageMultiplier = tradeMenu.longswordDamageMultplier; player.EquipWeapon(WEAPON.LONGSWORD); hud.DisplayText($"< {player.Name()} Equiped {weapon.Name()} >", false); }
                 * else if (navigator == 25 && _stockWeapons[(int)WEAPON.CLAYMORE]) { hud.DisplayText($"< {player.Name()} Equiped nothing... >", false); } else { player.damageMultiplier = tradeMenu.claymoreDamageMultiplier; player.EquipWeapon(WEAPON.CLAYMORE); hud.DisplayText($"< {player.Name()} Equiped {weapon.Name()} >", false); }
                 * if (navigator == 26 && _stockWeapons[(int)WEAPON.KALIBURN]) { player.damageMultiplier = tradeMenu.kaliburnDamageMultiplier; player.EquipWeapon(WEAPON.KALIBURN); hud.DisplayText($"< {player.Name()} Equiped {weapon.Name()} >", false); }
                 * else { hud.DisplayText($"< {player.Name()} Equiped nothing... >", false); }*/

                hud.UpdateHotBar(player, this);                 // update hotbar on inventory use
            }
        }