public void AddItem(Game game, Item item, int number = 1) { for (int i = 0; i < number; ++i) { Item itemCopy = item.Copy(game); game._AddObject(itemCopy); Items.Add(itemCopy); } }
public bool MoveItemToSlot(Item item, string slotName, Config config) { var variable = GetVariableByName(slotName, config); if (item.Scheme == null || !SchemeExecutor.CheckTypeCompatibility(variable.Type, item.Scheme.Name, config)) { return(false); } variable.Value = item; return(true); }
public void MoveItemToBag(Item item, Config config) { // we search for the slot in which the item is, and remove the item from it foreach (var slot in config.CharacterConfig.InventorySlots) { var slotVariable = GetVariableByName(slot.Name, config); if (slotVariable.Value == item) { slotVariable.Value = null; return; } } }
// used to evaluate classes that provide items for characters public void EvaluateClassItemSpellModifiers(Game game) { foreach (ObjectVariable var in Variables) { if (game.Config.IsClassType(var.Type)) { Class @class = (Class)var.Value; List <ItemModifier> itemModifiers = @class.GetItemModifiers(); foreach (ItemModifier im in itemModifiers) { Item item = game.GetObjectById(im.ItemName); AddItem(game, item, im.ItemNumber); } List <SpellModifier> spellModifiers = @class.GetSpellModifiers(); foreach (SpellModifier sm in spellModifiers) { Spell spell = game.GetObjectById(sm.SpellName); AddSpell(spell); } } } }
public void RemoveSpell(Spell spell) { Spells.Remove(spell); }
public void AddSpell(Spell spell) { Spells.Add(spell); }
public void RemoveItem(Item item, Config config) { MoveItemToBag(item, config); // remove item from slot (if inside one) Items.Remove(item); }
public void AddItemWithoutCopy(Item item) { Items.Add(item); }