/// <summary> /// Create Stat modification /// -1 for infinity duration /// </summary> /// <param name="statType"> stat type </param> /// <param name="value"></param> /// <param name="timer">-1 for infinity </param> /// public StatBuff(Stats.StatType _statType, float _value, float _delay, string _id = null) { statType = _statType; value = _value; timer = _delay; id = _id; }
public static HamsterData Breed(HamsterData a, HamsterData b, string childFirstName) { System.Random rnd = new System.Random(); Stats.StatType[] statTypes = Stats.AllStatTypes.OrderBy(x => rnd.Next()).ToArray(); Dictionary <Stats.StatType, int> childStats = new Dictionary <Stats.StatType, int>(); int split = statTypes.Length / 2; for (int i = 0; i < statTypes.Length; ++i) { Stats.StatType statType = statTypes[i]; if (i < split) { childStats.Add(statType, a.statValues[statType] + RandomSignedStatModifier()); } else { childStats.Add(statType, b.statValues[statType] + RandomSignedStatModifier()); } } Color childBellyColor; Color childBodyColor; float colorSelector = Random.value; if (colorSelector < 0.5f) { childBellyColor = a.bellyColor + b.bellyColor; childBodyColor = a.bodyColor + b.bodyColor; } else if (colorSelector < 0.75f) { childBellyColor = a.bellyColor; childBodyColor = a.bodyColor; } else { childBellyColor = b.bellyColor; childBodyColor = b.bodyColor; } string lastName; float nameSelector = Random.value; if (nameSelector < 0.5f) { lastName = a.lastName; } else { lastName = a.firstName; } return(new HamsterData(childBodyColor, childBellyColor, childFirstName, lastName, HamsterStatus.Unborn, childStats)); }
float BonusFromGear(Stats.StatType _t) { float bonus = 0; foreach (NewItem itm in Gear.items) { if (itm) { StatsAttribute attr = itm.GetAttribute <StatsAttribute>(); if (attr) { if (attr.enabled[(int)_t]) { bonus += attr.stats[(int)_t]; } } } } return(bonus); }
public int GetStat(Stats.StatType statType) { return(_hamsterData.statModifiers[statType] + _hamsterData.statValues[statType]); }