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; }
public void SetStatBasic(StatBasic statType, bool current, UInt16 value) { _statsBasic[(sbyte)statType, current ? 0 : 1] = value; }
/// <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]); }