public double GetByType(EStatType Type) { switch (Type) { case EStatType.Minimum: return(Min); case EStatType.Maximum: return(Max); case EStatType.Average: return(Average); case EStatType.StDev: return(StandardDeviation); case EStatType.Median: return(Median); case EStatType.Count: return(MyCount); default: return(0.0); } }
/// <summary> /// Add a modifier to a specific stat /// </summary> private void AddBonusToStat(EStatType statType, EStatModifierType bonusType, float bonusValue) { if (_stats.ContainsKey(statType)) { _stats[statType].AddStatModifier(bonusType, bonusValue); } }
/// <summary> /// Remove a modifier from a specific stat /// </summary> private void RemoveBonusFromStat(EStatType statType, EStatModifierType bonusType, float bonusValue) { if (_stats.ContainsKey(statType)) { _stats[statType].RemoveStatModifier(bonusType, bonusValue); } }
private List <Effect> EffectsForStatType(EStatType statType) { return(Effects.Where(x => x.AffectedStat == statType && (x.TimingType == Effect.ETimingType.Duration && ((DateTime.Now - x.EffectStarted) <= x.Duration || x.TimingType == Effect.ETimingType.Permanent))) .ToList()); }
private static void ApplyScores(EStatType statType) { RoomStatDef rsd = Utils.GetDefByDefName <RoomStatDef>(statType.RoomStatDefName()); if (rsd != null) { for (int i = 0; i < SE_Settings.Settings.StatData[statType].Count; i++) { rsd.scoreStages[i + 1].minScore = SE_Settings.Settings.StatData[statType][i].Value; } } }
private void AddPreset(EStatType statType, params float[] values) { if (values.Length != StatData[statType].Count) { Log.Error("Length mismatch in AddPreset(). for type: " + statType.ToString() + ". Got: " + string.Join(", ", values)); return; } for (int i = 0; i < StatData[statType].Count; i++) { float value = (i < values.Length) ? values[i] : values[values.Length - 1]; StatData[statType][i].Presets.Add(value); } }
public double GetByType(EStatType Type) { switch (Type) { case EStatType.Minimum: return Min; case EStatType.Maximum: return Max; case EStatType.Average: return Average; case EStatType.StDev: return StandardDeviation; case EStatType.Median: return Median; case EStatType.Count: return MyCount; default: return 0.0; } }
private double CalculateAffectedStat(double baseValue, EStatType statType) { var modifiedValue = baseValue; var maxapEffects = EffectsForStatType(statType); foreach (var effect in maxapEffects) { switch (effect.ModifyType) { case Effect.EModifyType.Add: modifiedValue += effect.EffectValue; break; case Effect.EModifyType.Sub: modifiedValue -= effect.EffectValue; break; case Effect.EModifyType.Mul: modifiedValue += baseValue * effect.EffectValue; break; } } return(modifiedValue); }
public UnitChange(EDirection direction_, EStatType statType_, NamedHash name_) { Direction = direction_; StatType = statType_; Name = name_; }
public void Reset(EStatType statType) { StatData[statType].ForEach(s => s.Reset()); }
public static string RoomStatDefName(this EStatType statType) => RoomStatDefNames[(int)statType];
public static string HeaderKey(this EStatType statType) => HeaderKeys[(int)statType];