示例#1
0
    public static void Grow(Item.Property prop)
    {
        // also remove dry property
        if (prop.item.HasProperty("dry"))
        {
            Item.Property growProp = prop.item.GetProperty("dry");
            TimeManager.GetInstance().onNextHour -= growProp.HandleOnNextHour;
        }


        Item.Remove(prop.item);

        string targetItemName = prop.param;

        Item newItem = Item.GetDataItem(targetItemName);

        newItem = Item.CreateNew(newItem);

        Tile.GetCurrent.AddItem(newItem);

        Phrase.SetOverrideItem(newItem);
        string str = "&un chien (override item)& apparait à la place &du chien (main item)&";

        Phrase.Write(str);
    }
示例#2
0
 public Item.Property GetItemProperty()
 {
     var prop = new Item.Property();
     prop.info = ItemPropertyInfo.Find(this.prop);
     prop.param = param;
     prop.value = max;
     prop.min = min;
     prop.max = max;
     return prop;
 }
示例#3
0
    public static void Dry(Item.Property prop)
    {
        // remove grow event also
        Item.Property growProp = prop.item.GetProperty("grow");
        TimeManager.GetInstance().onNextHour -= growProp.HandleOnNextHour;

        Item.Remove(prop.item);

        Item newItem = Item.GetDataItem("pousse morte");

        newItem = Item.CreateNew(newItem);
        Tile.GetCurrent.AddItem(newItem);

        Phrase.SetOverrideItem(newItem);
        Phrase.Write("&le chien (override item)& a sêché et laisse place à une pousse morte");
    }
示例#4
0
 private static void AddAffix(Item item, MagicAffix affix)
 {
     foreach (var mod in affix.mods)
     {
         if (mod.code == null)
         {
             break;
         }
         var prop = new Item.Property();
         prop.info          = ItemPropertyInfo.Find(mod.code);
         prop.param         = mod.param;
         prop.value         = Random.Range(mod.min, mod.max + 1);
         prop.min           = mod.min;
         prop.max           = mod.max;
         prop.classSpecific = affix.classSpecific;
         item.properties.Add(prop);
     }
 }
示例#5
0
    static public bool GenerateUnique(Item item)
    {
        if (item.info.uniques.Count == 0)
        {
            return(false);
        }

        UniqueItem unique = SelectUniqueForItem(item);

        if (unique == null)
        {
            return(false);
        }

        item.name     = unique.name;
        item.unique   = unique;
        item.levelReq = unique.levelReq;

        foreach (var mod in unique.props)
        {
            if (mod.prop == null)
            {
                break;
            }

            var prop = new Item.Property();
            prop.info  = ItemPropertyInfo.Find(mod.prop);
            prop.param = mod.param;
            prop.value = Random.Range(mod.min, mod.max + 1);
            prop.min   = mod.min;
            prop.max   = mod.max;
            item.properties.Add(prop);
        }

        return(true);
    }
示例#6
0
    static public bool GenerateSetItem(Item item)
    {
        if (item.info.setItems.Count == 0)
        {
            return(false);
        }

        SetItem setItem = SelectSetItem(item);

        if (setItem == null)
        {
            return(false);
        }

        item.name     = setItem.name;
        item.setItem  = setItem;
        item.levelReq = setItem.levelReq;

        foreach (var mod in setItem.props)
        {
            if (mod.prop == null)
            {
                break;
            }

            var prop = new Item.Property();
            prop.info  = ItemPropertyInfo.Find(mod.prop);
            prop.param = mod.param;
            prop.value = Random.Range(mod.min, mod.max + 1);
            prop.min   = mod.min;
            prop.max   = mod.max;
            item.properties.Add(prop);
        }

        for (int i = 0; i < setItem.additionalProps.Length; ++i)
        {
            var mod = setItem.additionalProps[i];
            if (mod.prop == null)
            {
                continue;
            }

            var prop = new Item.Property();
            prop.info  = ItemPropertyInfo.Find(mod.prop);
            prop.param = mod.param;
            prop.value = Random.Range(mod.min, mod.max + 1);
            prop.min   = mod.min;
            prop.max   = mod.max;
            if (setItem.addFunc == 0)
            {
                item.properties.Add(prop);
            }
            else
            {
                int blockSize  = 2;
                int blockIndex = i / blockSize;
                while (blockIndex >= item.setItemProperties.Count)
                {
                    item.setItemProperties.Add(new List <Item.Property>());
                }
                item.setItemProperties[blockIndex].Add(prop);
            }
        }

        return(true);
    }
示例#7
0
    public override void GetCell(int rowIndex, List <string> cells)
    {
        base.GetCell(rowIndex, cells);

        if (rowIndex < 1)
        {
            return;
        }

        if (cells.Count > 0 && string.IsNullOrEmpty(cells[0]))
        {
            return;
        }

        // create new item
        Item newItem = new Item();

        // new word
        Word itemWord = new Word();

        itemWord.SetText(cells[0]);

        // word
        newItem.word = itemWord;
        //newItem.index = rowIndex-1;
        newItem.index = itemIndex;
        itemWord.UpdateGenre(cells[1]);

        // weight
        newItem.word.adjectiveType = cells[2].ToLower();

        if (cells[3].Length > 1)
        {
            newItem.word.SetLocationPrep(cells[3]);
        }

        newItem.stackable = cells[4] == "TRUE";

        // property
        string[] property_lines = cells[5].Split('\n');

        if (string.IsNullOrEmpty(property_lines[0]))
        {
        }
        else
        {
            foreach (var property_line in property_lines)
            {
                Item.Property newProperty = new Item.Property();

                string[] propertyLine_parts = property_line.Split('/');


                Item.Property.Type type = (Item.Property.Type)System.Enum.Parse(typeof(Item.Property.Type), propertyLine_parts[0]);
                newProperty.type = type;

                newProperty.name = propertyLine_parts[1];

                newProperty.SetContent(propertyLine_parts[2]);

                newProperty.param = propertyLine_parts[3];

                /// s'il y avait plusieurs parametres ///

                /*for (int i = 2; i < propertyLine_parts.Length; i++)
                 * {
                 *  string param = propertyLine_parts[i];
                 *  Debug.Log("adding param : " + param + " to item " + newItem.word.text);
                 *  newProperty.parameters.Add(param);
                 * }*/

                // !!! reel probleme ici, pourquoi mes trucs se mettent en copie ? !!!
                // pas sûr que ce soit d'actualité à vérifier
                newItem.AddProperty(newProperty);
            }
        }
        //

        // add to item list
        Item.dataItems.Add(newItem);

        // actions
        int verbIndex = 0;

        for (int cellIndex = 6; cellIndex < cells.Count; cellIndex++)
        {
            if (verbIndex >= Verb.GetVerbs.Count)
            {
                //Debug.LogError(verbIndex + " / " + Verb.GetVerbs.Count);
                continue;
            }

            Verb verb = Verb.GetVerbs[verbIndex];

            string cell = cells[cellIndex];

            if (cell.Length >= 2)
            {
                // verb out of range
                Combination newCombination = new Combination();
                newCombination.content   = cell;
                newCombination.itemIndex = newItem.index;

                verb.AddCombination(newCombination);
            }

            ++verbIndex;
        }

        ++itemIndex;
    }