Example #1
0
 public ItemStat(ItemStat s, int level = 1, float Multipier = 0)
 {
     Name             = s.Name;
     LevelPow         = s.LevelPow;
     StatID           = s.StatID;
     Rarity           = s.Rarity;
     MinAmount        = s.MinAmount;
     MaxAmount        = s.MaxAmount;
     OnEquip          = s.OnEquip;
     OnUnequip        = s.OnUnequip;
     OnConsume        = s.OnConsume;
     RoundingCount    = s.RoundingCount;
     DisplayAsPercent = s.DisplayAsPercent;
     this.ValueCap    = s.ValueCap;
     if (Multipier != 0)
     {
         this.Multipier = Multipier;
     }
     else
     {
         this.Multipier = s.Multipier;
     }
     Amount = this.Multipier * RollValue(level);
     if (ValueCap != 0)
     {
         Amount = Mathf.Min(ValueCap, Amount);
     }
 }
Example #2
0
 /// <summary>
 /// Creates new itemStat and adds it to the database
 /// </summary>
 /// <param name="id">ID of the item, used to access it from the DB</param>
 /// <param name="Min">Min amount for the stat at level 1</param>
 /// <param name="Max">Max amount for the stat at level 1</param>
 /// <param name="name">Name of the stat, what should be displayed in the item context menu</param>
 /// <param name="rarity">range 0-7</param>
 /// <param name="LvlPower">How much should it increase per level(min max values will be powered to this amount)</param>
 public ItemStat(int id, float Min, float Max, float LvlPower, string name, int rarity, OnEquipDelegate onEquip = null, OnUnequipDelegate onUnequip = null, OnConsumeDelegate onConsume = null)
 {
     LevelPow  = LvlPower;
     StatID    = id;
     MaxAmount = Max;
     MinAmount = Min;
     Name      = name;
     Rarity    = rarity;
     OnEquip   = onEquip;
     OnUnequip = onUnequip;
     OnConsume = onConsume;
     ItemDataBase.AddStat(this);
 }
Example #3
0
 /// <summary>
 /// Creates new itemStat and adds it to the database
 /// </summary>
 /// <param name="id">ID of the item, used to access it from the DB</param>
 /// <param name="Min">Min amount for the stat at level 1</param>
 /// <param name="Max">Max amount for the stat at level 1</param>
 /// <param name="name">Name of the stat, what should be displayed in the item context menu</param>
 /// <param name="rarity">range 0-7</param>
 /// <param name="LvlPower">How much should it increase per level(min max values will be powered to this amount)</param>
 public ItemStat(int id, float Min, float Max, float LvlPower, string name, StatCompare comparingMethod, int rarity, Func <string> getValueFunc, OnEquipDelegate onEquip = null, OnUnequipDelegate onUnequip = null, OnConsumeDelegate onConsume = null)
 {
     comparing    = comparingMethod;
     LevelPow     = LvlPower;
     StatID       = id;
     MaxAmount    = Max;
     MinAmount    = Min;
     Name         = name;
     Rarity       = rarity;
     OnEquip      = onEquip;
     OnUnequip    = onUnequip;
     OnConsume    = onConsume;
     GetTotalStat = getValueFunc;
     ItemDataBase.AddStat(this);
 }
Example #4
0
 public ItemStat(ItemStat s, int level = 1)
 {
     Name             = s.Name;
     LevelPow         = s.LevelPow;
     StatID           = s.StatID;
     Rarity           = s.Rarity;
     MinAmount        = s.MinAmount;
     MaxAmount        = s.MaxAmount;
     OnEquip          = s.OnEquip;
     OnUnequip        = s.OnUnequip;
     OnConsume        = s.OnConsume;
     RoundingCount    = s.RoundingCount;
     DisplayAsPercent = s.DisplayAsPercent;
     GetTotalStat     = s.GetTotalStat;
     this.ValueCap    = s.ValueCap;
     this.Multipier   = s.Multipier;
     Amount           = RollValue(level);
     if (ValueCap != 0)
     {
         Amount = Mathf.Min(ValueCap, Amount);
     }
     Amount *= Multipier;
 }