/// <summary> /// Removes associated stat bonuses /// </summary> /// <param name="Item">Item to remove</param> public void UnequipItem(Items.ItemEquip Item) { if (Item == null) { return; } //remove mainstats List <Items.ItemBonus> mains = Item.MainStats; if (mains?.Count != 0) { foreach (Items.ItemBonus b in mains) { StatBonuses.Remove(b); } } //remove any item bonuses if (Item.Bonuses != null) { foreach (Items.ItemBonus b in Item.Bonuses) { StatBonuses.Remove(b); } } //remove socket bonuses if (Item.SocketCount != 0) { for (int i = 0; i < Item.SocketCount; i++) { StatBonuses.Remove(Item.Sockets[i].AddedEffect); } } }
/// <summary> /// Removes associated stat bonuses /// </summary> /// <param name="Item">Item to remove</param> public void UnequipItem(Items.ItemEquip Item) { if (Item == null) { return; } if (Item.Bonuses != null) { foreach (Items.ItemBonus b in Item.Bonuses) { StatBonuses.Remove(b); } } }
/// <summary> /// Applies the stat bonuses /// </summary> /// <param name="Item"></param> private void EquipItem(Items.ItemEquip Item) { if (!CanEquip(Item)) { return; } if (Item != null && Item.Bonuses != null) { foreach (Items.ItemBonus b in Item.Bonuses) { StatBonuses.Add(b); } } }
/// <summary> /// Removes item from the corresponding equip slot /// </summary> /// <param name="Item">Item to remove - needed to undo stat bonuses</param> /// <param name="slot">Slot to remove from</param> public void UnequipItem(Items.ItemEquip Item, int slot) { if (slot >= 0 && slot < this.Equipment.Length) { this.Equipment[slot] = null; Tuple <string, Matrix> attach = GetEquipParent(slot); if (attach != null) { this.Model.FindPart(attach.Item1).Children.Clear(); this.Model.Dirty = true; } this.UnequipItem(Item); } }
/// <summary> /// Places the item in player's equipment slot, if possible /// </summary> /// <param name="Item">Item to equip</param> /// <param name="slot">Slot</param> public void EquipItem(Items.ItemEquip Item, int slot) { if (slot >= 0 && slot < this.Equipment.Length) { this.Equipment[slot] = Item; Tuple <string, Matrix> attach = GetEquipParent(slot); if (attach != null) { GameModel.Model m = Item.GetModel(); if (m != null) { this.Model.FindPart(attach.Item1).Append(m.Children[0], attach.Item2); this.Model.Dirty = true; } } this.EquipItem(Item); } }
public MapEntities.Actors.Monster GenerateOneMonster() { MapEntities.Actors.Monster monster = new MapEntities.Actors.Monster(); monster.Model = GameModel.ModelGeometryCompiler.LoadModel("default"); monster.DisplayName = "monster. kill me please."; Vector3 pos = new Vector3(RNG.Next(63), 0, RNG.Next(63)); monster.Position = pos; monster.LeashRadius = 30; monster.PrimaryLootRollCount = 2; monster.PrimaryLootTable = new List <Tuple <int, Item> >(); Items.ItemConsumable potA = new Items.ItemConsumable { Colour = new Color(200, 50, 0), Name = "HP potion" }; Items.ItemConsumable potB = new Items.ItemConsumable { Colour = new Color(0, 100, 200), Name = "MP potion" }; Items.Material matA = Items.Material.MaterialTemplates.GetRandomMaterial(); Items.ItemEquip weapA = new Items.ItemEquip(); BonusPool p = BonusPool.Load("heavy_0_10"); weapA.Bonuses.Add(p.PickBonus()); weapA.Bonuses.Add(p.PickBonus()); weapA.SubType = RNG.Next(0, 1) * 4; weapA.PrimaryMaterial = Material.MaterialTemplates.GetRandomMaterial(); weapA.SecondaryMaterial = Material.MaterialTemplates.GetRandomMaterial(); monster.PrimaryLootTable.Add(new Tuple <int, Item>(5, potA)); monster.PrimaryLootTable.Add(new Tuple <int, Item>(5, potB)); monster.PrimaryLootTable.Add(new Tuple <int, Item>(1, matA)); monster.PrimaryLootTable.Add(new Tuple <int, Item>(3, null)); monster.PrimaryLootTable.Add(new Tuple <int, Item>(10, weapA)); return(monster); }
/// <summary> /// Applies the stat bonuses /// </summary> /// <param name="Item"></param> private void EquipItem(Items.ItemEquip Item) { if (!CanEquip(Item)) { return; } if (Item == null) { return; } //add mainstats as bonuses List <Items.ItemBonus> mains = Item.MainStats; if (mains?.Count != 0) { foreach (Items.ItemBonus b in mains) { StatBonuses.Add(b); } } //add other bonuses if (Item.Bonuses != null) { foreach (Items.ItemBonus b in Item.Bonuses) { StatBonuses.Add(b); } } //add any socket bonuses if (Item.SocketCount != 0) { for (int i = 0; i < Item.SocketCount; i++) { StatBonuses.Add(Item.Sockets[i].AddedEffect); } } }
/// <summary> /// Checks if specific item can be equipped by the player (based on level, class etc) /// </summary> /// <param name="Item">Item to check</param> /// <returns></returns> public bool CanEquip(Items.ItemEquip Item) { //TODO actual requirement checking return(true); }