Example #1
0
        public StatWithMax Reduce(int amount)
        {
            StatWithMax result = this;

            Current = Math.Max(0, Current - amount);
            return(result);
        }
Example #2
0
        public object Clone()
        {
            StatWithMax copy = new StatWithMax();

            copy.max     = this.max;
            copy.current = this.current;
            return(copy);
        }
Example #3
0
        public StatWithMax Add(int amount)
        {
            StatWithMax result = this;

            if (amount == int.MaxValue)
            {
                Current = Max;
            }
            else
            {
                Current = Math.Min(Max, Current + amount);
            }
            return(result);
        }