Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
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);
     }
 }
Esempio n. 3
0
 /// <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);
     }
 }
Esempio n. 4
0
 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());
 }
Esempio n. 5
0
        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;
                }
            }
        }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
0
 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;
     }
 }
Esempio n. 8
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);
        }
Esempio n. 9
0
 public UnitChange(EDirection direction_, EStatType statType_, NamedHash name_)
 {
     Direction = direction_;
     StatType  = statType_;
     Name      = name_;
 }
Esempio n. 10
0
 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];