private static void FixStat( ref int stat, int diff, int max ) { stat += diff; if ( stat < 0 ) stat = 0; else if ( stat > max ) stat = max; }