Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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;
         }
     }
 }
Ejemplo n.º 4
0
        // 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);
                    }
                }
            }
        }
Ejemplo n.º 5
0
 public void RemoveSpell(Spell spell)
 {
     Spells.Remove(spell);
 }
Ejemplo n.º 6
0
 public void AddSpell(Spell spell)
 {
     Spells.Add(spell);
 }
Ejemplo n.º 7
0
 public void RemoveItem(Item item, Config config)
 {
     MoveItemToBag(item, config); // remove item from slot (if inside one)
     Items.Remove(item);
 }
Ejemplo n.º 8
0
 public void AddItemWithoutCopy(Item item)
 {
     Items.Add(item);
 }