Exemplo n.º 1
0
        public void AddToStatBasic(StatBasic statType, Int32 delta)
        {
            //StatAdditionOutcome returnValue = StatAdditionOutcome.Unremarkable;
            UInt16 statValue = _statsBasic[(sbyte)statType, 0];

            if (delta < 0 && statValue <= Math.Abs(delta))
            {
                _statsBasic[(sbyte)statType, 0] = 0;
                // if stat is HP, creature dies
                if (statType == StatBasic.HP)
                {
                    this.Death();
                }
            }
            else if ((statValue + delta) >= _statsBasic[(sbyte)statType, 1])
            {
                _statsBasic[(sbyte)statType, 0] = _statsBasic[(sbyte)statType, 1];
                // if stat is XP, level up
                if (statType == StatBasic.XP)
                {
                    this.LevelUp();
                }
            }
            else
            {
                _statsBasic[(sbyte)statType, 0] = (UInt16)(statValue + delta);
            }

            if (statType == StatBasic.AP)
            {
                // Update unit move-range
                _myMoveRangeCalculator.Update();
            }



            //return returnValue;
        }
Exemplo n.º 2
0
 public void SetStatBasic(StatBasic statType, bool current, UInt16 value)
 {
     _statsBasic[(sbyte)statType, current ? 0 : 1] = value;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Returns the value of the basic stat of the type requested.
 /// If 'current' is true, returns current value; otherwise returns max value.
 /// </summary>
 public UInt16 GetStatBasic(StatBasic statType, bool current)
 {
     return(_statsBasic[(sbyte)statType, current ? 0 : 1]);
 }