the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 31 lines 889 B view raw
1#include "stdafx.h" 2 3#include "RangedAttribute.h" 4 5RangedAttribute::RangedAttribute(eATTRIBUTE_ID id, double defaultValue, double minValue, double maxValue) : BaseAttribute(id, defaultValue) 6{ 7 this->minValue = minValue; 8 this->maxValue = maxValue; 9 10 //if (minValue > maxValue) throw new IllegalArgumentException("Minimum value cannot be bigger than maximum value!"); 11 //if (defaultValue < minValue) throw new IllegalArgumentException("Default value cannot be lower than minimum value!"); 12 //if (defaultValue > maxValue) throw new IllegalArgumentException("Default value cannot be bigger than maximum value!"); 13} 14 15double RangedAttribute::getMinValue() 16{ 17 return minValue; 18} 19 20double RangedAttribute::getMaxValue() 21{ 22 return maxValue; 23} 24 25double RangedAttribute::sanitizeValue(double value) 26{ 27 if (value < minValue) value = minValue; 28 if (value > maxValue) value = maxValue; 29 30 return value; 31}