예제 #1
0
 public void TickTempMods()
 {
     if (TempMods.RemoveAll(tm => tm.Duration < 1) > 0)
     {
         AddedTempEvent?.Invoke();
         IsDirty = true;
     }
 }
예제 #2
0
 public void AddTempMod(TempStatMod mod)
 {
     if (TempMods.Exists(tm => tm.Source.Equals(mod.Source)))
     {
         TempStatMod toChange          = TempMods.Find(tm => tm.Source.Equals(mod.Source));
         float       diminishingReturn = (float)toChange.Duration / mod.Duration;
         int         toIncrease        = Mathf.Max(0, Mathf.FloorToInt(mod.Duration / Mathf.Max(1, 2 * diminishingReturn)));
         toChange.IncreaseDuration(toIncrease);
     }
     else
     {
         // Clone otherwise diminishingReturn doesn't work as duration increase on both.
         TempMods.Add(new TempStatMod(mod.Value, mod.ModType, mod.Source, mod.Duration));
     }
     IsDirty = true;
     AddedTempEvent?.Invoke();
 }