public void CharacterRemovesItem() { Assert.IsTrue(Guinevere.Inventory.Contains("Memento"), "Knights should start with a Memento in their inventories."); Guinevere.Inventory.RemoveItem(ItemDAO.CreateNewItem("Memento")); Assert.IsFalse(Guinevere.Inventory.Contains("Memento"), "The Memento should be removed."); }
public Noble(string gender = "F") { Title = "Noble"; Gender = GetGender(gender); if (Gender == "Male") { Title = "Nobleman"; } else if (Gender == "Female") { Title = "Noblewoman"; } ProfessionSummary = "Wealthy and fashionable, a member of the noble class well-educated in " + "the art of oration. Has some training as a duelist, but has never been in a real fight."; BaseHealth = 20; BaseStamina = 10; BaseStaminaRegen = 10.0; StartingAttributesDict = new Dictionary <string, int>() { { "STR", 3 }, { "DEX", 5 }, { "SKL", 7 }, { "APT", 5 }, { "FOR", 3 }, { "CHA", 8 } }; StartingTalentsDict = new Dictionary <string, int>() { { "Medicine", 0 }, { "Explosives", 0 }, { "Veterancy", 0 }, { "Bestiary", 0 }, { "Engineering", 0 }, { "History", 2 } }; StartingInventoryList = new List <Item>() { ItemDAO.CreateNewItem("Coins", 3000), }; StartingEquipmentDict = new Dictionary <string, Items.Equipment.EquipmentItem>() { { "MainHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, // Rapier { "OffHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, // Bare Hand { "Body", ItemDAO.CreateNewEquipmentItem("Fancy Clothing") }, { "Charm 1", ItemDAO.CreateNewEquipmentItem("Ladybug Brooch") }, { "Charm 2", ItemDAO.CreateNewEquipmentItem("Heirloom Ring") } }; }
public Knight(string gender = "M") { Title = "Knight"; Gender = GetGender(gender); ProfessionSummary = "Knights are masters of the longsword clad in sturdy plate armor; but " + "they often neglect their academic studies in favor of drinking and skirt-chasing."; BaseHealth = 20; BaseStamina = 20; BaseStaminaRegen = 15.0; StartingAttributesDict = new Dictionary <string, int>() { { "STR", 7 }, { "DEX", 7 }, { "SKL", 7 }, { "APT", 2 }, { "FOR", 6 }, { "CHA", 4 } }; StartingTalentsDict = new Dictionary <string, int>() { { "Medicine", 0 }, { "Explosives", 0 }, { "Veterancy", 2 }, { "Bestiary", 0 }, { "Engineering", 0 }, { "History", 0 } }; StartingInventoryList = new List <Item>() { ItemDAO.CreateNewItem("Coins", 800), ItemDAO.CreateNewItem("Memento", 1) }; StartingEquipmentDict = new Dictionary <string, Items.Equipment.EquipmentItem>() { { "MainHand", ItemDAO.CreateNewEquipmentItem("Longsword") }, { "OffHand", ItemDAO.CreateNewEquipmentItem("Two-handing") }, { "Body", ItemDAO.CreateNewEquipmentItem("Plate Armor") }, { "Charm 1", ItemDAO.CreateNewEquipmentItem("Lover's Locket") }, { "Charm 2", ItemDAO.CreateNewEquipmentItem("Unadorned") } }; StartingSkills = new List <Skill>(6) { new DoubleSlash(), null, null, null, null, null }; }
public Barmaid(string gender = "F") { Title = "Barmaid"; Gender = GetGender(gender); if (gender == "Male") { Title = "Barkeep"; } ProfessionSummary = $"The charming {(gender == "female" ? "young barmaid" : "barkeep")} from the local tavern. Strong and fast, with " + "a seemingly endless supply of drink, but no combat training."; BaseHealth = 40; BaseStamina = 20; BaseStaminaRegen = 15.0; StartingAttributesDict = new Dictionary <string, int>() { { "STR", 7 }, { "DEX", 6 }, { "SKL", 1 }, { "APT", 4 }, { "FOR", 3 }, { "CHA", 8 } }; StartingTalentsDict = new Dictionary <string, int>() { { "Medicine", 0 }, { "Explosives", 0 }, { "Veterancy", 0 }, { "Bestiary", 0 }, { "Engineering", 0 }, { "History", 0 } }; StartingInventoryList = new List <Item>() { ItemDAO.CreateNewItem("Coins", 250), // Bottomless Beer Mug }; StartingEquipmentDict = new Dictionary <string, EquipmentItem>() { { "MainHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "OffHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "Body", ItemDAO.CreateNewEquipmentItem("Naked") }, { "Charm 1", ItemDAO.CreateNewEquipmentItem("Unadorned") }, { "Charm 2", ItemDAO.CreateNewEquipmentItem("Unadorned") } }; }
public void RemovingItems() { // generate new inventory with 5000 coins in it. List <Item> init = new List <Item>() { ItemDAO.CreateNewItem("Coins", 5000) }; Inventory inventory = new Inventory(init); Assert.IsTrue(inventory.ItemCounts["Coins"] == 5000, "Inventory should have 5000 coins available"); // spend 2500 coins inventory.RemoveItem(ItemDAO.CreateNewItem("Coins"), 2500); Assert.IsTrue(inventory.ItemCounts["Coins"] == 2500, "Inventory should have 2500 coins available"); }
public Footman(string gender = "M") { Title = "Footman"; Gender = GetGender(gender); ProfessionSummary = "A retired soldier. Greatly experienced with his spear and shield, but " + "his time in the military has left him uncouth, and old wounds slow him down."; BaseHealth = 20; BaseStamina = 20; BaseStaminaRegen = 10.0; StartingAttributesDict = new Dictionary <string, int>() { { "STR", 4 }, { "DEX", 2 }, { "SKL", 7 }, { "APT", 4 }, { "FOR", 7 }, { "CHA", 3 } }; StartingTalentsDict = new Dictionary <string, int>() { { "Medicine", 0 }, { "Explosives", 0 }, { "Veterancy", 3 }, { "Bestiary", 0 }, { "Engineering", 0 }, { "History", 0 } }; StartingInventoryList = new List <Item>() { ItemDAO.CreateNewItem("Coins", 700), // Healing Elixir }; StartingEquipmentDict = new Dictionary <string, Items.Equipment.EquipmentItem>() { { "MainHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "OffHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "Body", ItemDAO.CreateNewEquipmentItem("Naked") }, { "Charm 1", ItemDAO.CreateNewEquipmentItem("Unadorned") }, { "Charm 2", ItemDAO.CreateNewEquipmentItem("Unadorned") } }; }
public Scholar(string gender = "M") { Title = "Scholar"; Gender = GetGender(gender); ProfessionSummary = "The scholar is a quick learner and widely knowledgeable, but spends more" + "time reading books than on physical pursuits."; BaseHealth = 20; BaseStamina = 15; BaseStaminaRegen = 10.0; StartingAttributesDict = new Dictionary <string, int>() { { "STR", 2 }, { "DEX", 2 }, { "SKL", 3 }, { "APT", 9 }, { "FOR", 2 }, { "CHA", 3 } }; StartingTalentsDict = new Dictionary <string, int>() { { "Medicine", 1 }, { "Explosives", 0 }, { "Veterancy", 0 }, { "Bestiary", 1 }, { "Engineering", 1 }, { "History", 2 } }; StartingInventoryList = new List <Item>() { ItemDAO.CreateNewItem("Coins", 400), // Diploma }; StartingEquipmentDict = new Dictionary <string, Items.Equipment.EquipmentItem>() { { "MainHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "OffHand", ItemDAO.CreateNewEquipmentItem("History Tome") }, { "Body", ItemDAO.CreateNewEquipmentItem("Clothing") }, { "Charm 1", ItemDAO.CreateNewEquipmentItem("Quill and Inkwell") }, { "Charm 2", ItemDAO.CreateNewEquipmentItem("Unadorned") } }; }
public Alchemist(string gender = "M") { Title = "Alchemist"; Gender = GetGender(gender); ProfessionSummary = "Recently expelled from the university for burning down the " + "research hall, this pyromaniac may be more dangerous to their teammates than their enemies."; BaseHealth = 40; BaseStamina = 20; BaseStaminaRegen = 15.0; StartingAttributesDict = new Dictionary <string, int>() { { "STR", 2 }, { "DEX", 2 }, { "SKL", 6 }, { "APT", 7 }, { "FOR", 3 }, { "CHA", 1 } }; StartingTalentsDict = new Dictionary <string, int>() { { "Medicine", 0 }, { "Explosives", 3 }, { "Veterancy", 0 }, { "Bestiary", 0 }, { "Engineering", 2 }, { "History", 0 } }; StartingInventoryList = new List <Item>() { ItemDAO.CreateNewItem("Coins", 250), // singed portrait }; StartingEquipmentDict = new Dictionary <string, EquipmentItem>() { { "MainHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "OffHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "Body", ItemDAO.CreateNewEquipmentItem("Naked") }, { "Charm 1", ItemDAO.CreateNewEquipmentItem("Unadorned") }, { "Charm 2", ItemDAO.CreateNewEquipmentItem("Unadorned") } }; }
public Constable(string gender = "M") { Title = "Constable"; Gender = GetGender(gender); ProfessionSummary = "The town's venerable lawman. Knows his way around locks and is " + "well-versed in breaking up brawls. This stiffness of age is beginning to set in."; BaseHealth = 20; BaseStamina = 20; BaseStaminaRegen = 10.0; StartingAttributesDict = new Dictionary <string, int>() { { "STR", 6 }, { "DEX", 3 }, { "SKL", 6 }, { "APT", 4 }, { "FOR", 5 }, { "CHA", 5 } }; StartingTalentsDict = new Dictionary <string, int>() { { "Medicine", 0 }, { "Explosives", 0 }, { "Veterancy", 1 }, { "Bestiary", 0 }, { "Engineering", 1 }, { "History", 0 } }; StartingInventoryList = new List <Item>() { ItemDAO.CreateNewItem("Coins", 1000), }; StartingEquipmentDict = new Dictionary <string, Items.Equipment.EquipmentItem>() { { "MainHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "OffHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "Body", ItemDAO.CreateNewEquipmentItem("Naked") }, { "Charm 1", ItemDAO.CreateNewEquipmentItem("Unadorned") }, { "Charm 2", ItemDAO.CreateNewEquipmentItem("Unadorned") } }; }
public Blacksmith(string gender = "M") { Title = "Blacksmith"; Gender = GetGender(gender); ProfessionSummary = "The town blacksmith is incredibly strong and knows all the weaknesses " + "of every kind of armor, but slow and gruff."; BaseHealth = 40; BaseStamina = 20; BaseStaminaRegen = 10.0; StartingAttributesDict = new Dictionary <string, int>() { { "STR", 9 }, { "DEX", 2 }, { "SKL", 7 }, { "APT", 3 }, { "FOR", 6 }, { "CHA", 3 } }; StartingTalentsDict = new Dictionary <string, int>() { { "Medicine", 0 }, { "Explosives", 1 }, { "Veterancy", 0 }, { "Bestiary", 0 }, { "Engineering", 3 }, { "History", 0 } }; StartingInventoryList = new List <Item>() { ItemDAO.CreateNewItem("Coins", 1200), }; StartingEquipmentDict = new Dictionary <string, Items.Equipment.EquipmentItem>() { { "MainHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "OffHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "Body", ItemDAO.CreateNewEquipmentItem("Naked") }, { "Charm 1", ItemDAO.CreateNewEquipmentItem("Unadorned") }, { "Charm 2", ItemDAO.CreateNewEquipmentItem("Unadorned") } }; }
public Squire(string gender = "M") { Title = "Squire"; Gender = GetGender(gender); ProfessionSummary = "A young farmboy from one of the surrounding villages, who's passing through " + "on his way to the castle to become a squire. Energetic, but clumsy."; BaseHealth = 20; BaseStamina = 30; BaseStaminaRegen = 15.0; StartingAttributesDict = new Dictionary <string, int>() { { "STR", 5 }, { "DEX", 5 }, { "SKL", 2 }, { "APT", 4 }, { "FOR", 5 }, { "CHA", 5 } }; StartingTalentsDict = new Dictionary <string, int>() { { "Medicine", 0 }, { "Explosives", 0 }, { "Veterancy", 0 }, { "Bestiary", 2 }, { "Engineering", 0 }, { "History", 0 } }; StartingInventoryList = new List <Item>() { ItemDAO.CreateNewItem("Coins", 100), }; StartingEquipmentDict = new Dictionary <string, Items.Equipment.EquipmentItem>() { { "MainHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "OffHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "Body", ItemDAO.CreateNewEquipmentItem("Naked") }, { "Charm 1", ItemDAO.CreateNewEquipmentItem("Unadorned") }, { "Charm 2", ItemDAO.CreateNewEquipmentItem("Unadorned") } }; }
public PlagueDoctor(string gender = "F") { Title = "Plague Doctor"; Gender = GetGender(gender); ProfessionSummary = "This traveling surgeon wears an unsettling beak-shaped mask and " + "goggles. Her cures are of dubious merit, but the efficacy of her poisons is inarguable."; BaseHealth = 20; BaseStamina = 20; BaseStaminaRegen = 10.0; StartingAttributesDict = new Dictionary <string, int>() { { "STR", 4 }, { "DEX", 3 }, { "SKL", 6 }, { "APT", 5 }, { "FOR", 6 }, { "CHA", 2 } }; StartingTalentsDict = new Dictionary <string, int>() { { "Medicine", 3 }, { "Explosives", 0 }, { "Veterancy", 0 }, { "Bestiary", 2 }, { "Engineering", 0 }, { "History", 0 } }; StartingInventoryList = new List <Item>() { ItemDAO.CreateNewItem("Coins", 900), }; StartingEquipmentDict = new Dictionary <string, Items.Equipment.EquipmentItem>() { { "MainHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "OffHand", ItemDAO.CreateNewEquipmentItem("Bare Hand") }, { "Body", ItemDAO.CreateNewEquipmentItem("Naked") }, { "Charm 1", ItemDAO.CreateNewEquipmentItem("Unadorned") }, { "Charm 2", ItemDAO.CreateNewEquipmentItem("Unadorned") } }; }
public ActionResult CreateItem(ItemVM form) { ActionResult response; //Makes sure everything required was entered in the view if (ModelState.IsValid) { ItemDO itemCheck = iDAO.ViewItemByName(form.Item.Name); if (itemCheck.ItemID == 0) { //try to connect to the server and create a new item try { form.Item.Validated = false; form.Item.ImagePath = "~/Images/Items/" + form.Item.Name + ".png"; if (System.IO.File.Exists(Server.MapPath(form.Item.ImagePath))) { System.IO.File.Delete(Server.MapPath(form.Item.ImagePath)); } if (form.File != null && form.File.ContentLength > 0) { string newImage = Server.MapPath(form.Item.ImagePath); if (System.IO.File.Exists(newImage)) { System.IO.File.Delete(newImage); } string path = Server.MapPath(form.Item.ImagePath); form.File.SaveAs(path); } else { string oldImage = Server.MapPath("~/Images/Items/Item.png"); string newImage = Server.MapPath(form.Item.ImagePath); System.IO.File.Copy(oldImage, newImage); } iDAO.CreateNewItem(Mapper.Mapper.ItemPOtoDO(form.Item)); response = RedirectToAction("Index", "Item"); } //catch and log any unloged sqlExceptions encountered during db call catch (SqlException sqlEx) { if (!((bool)sqlEx.Data["Logged"] == true) || !sqlEx.Data.Contains("Logged")) { Logger.LogSqlException(sqlEx); } response = RedirectToAction("Index", "Item"); } catch (Exception ex) { if (!ex.Data.Contains("Logged") || (bool)ex.Data["Logged"] == false) { Logger.LogException(ex); } response = RedirectToAction("Index", "Item"); } } else { ModelState.AddModelError("Item.Name", "Item already exists!"); response = View(form); } } //returns to view if modelstate was false else { ModelState.AddModelError("Item.Description", "Missing information, please fill in all fields!"); response = View(form); } return(response); }
public void CharacterAddsItem() { Guinevere.Inventory.AddItem(ItemDAO.CreateNewItem("Memento")); Assert.AreEqual(2, Guinevere.Inventory.ItemCounts["Memento"], "A new Memento should be added to the character's inventory."); }