Exemple #1
0
        /// <summary>
        /// Generates an ItemBonus with random values.
        /// </summary>
        /// <returns>An ItemBonus with values within the template's ranges.</returns>
        public ItemBonus Generate()
        {
            float     Flat  = RNG.Next(this.FlatMin, this.FlatMax);
            float     Multi = RNG.Next(this.MultiMin, this.MultiMax) / 100.0f;
            ItemBonus b     = new ItemBonus()
            {
                FlatValue = Flat, Multiplier = Multi, Effecttext = this.Effectstring, LineColour = GUI.Renderer.ColourBlue, Type = this.Type
            };

            return(b);
        }
        /// <summary>
        /// Creates an ItemEquip based on the template.
        /// </summary>
        /// <returns>The created ItemEquip.</returns>
        public Items.ItemEquip CreateResult()
        {
            Items.ItemEquip result = new Items.ItemEquip
            {
                Name       = Name,
                NameColour = Item.GradeToColour(this.Grade)
            };
            result.StatValues = this.MainStats;


            foreach (Items.ItemBonus add in this.Adds)
            {
                Items.ItemBonus bonus = (Items.ItemBonus)add.Clone();
                result.Bonuses.Add(bonus);
            }
            result.SubType = Type;
            result.Variant = Variant;


            return(result);
        }