using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; partial class EquipAttrDesc { public long GetPropValue(Random rand , long lucky , out bool max ) { if(rand == null) { rand = new Random(); } max = false; var a = CommParamDescMgr.Instance.LuckAttrInc.int_list[0] / 10_000; long allWeight = minweight + maxweight + lucky * a; long w = rand.NextInt64(allWeight); if(w < minweight) { if (unit == 0) { return minInterval[0]; } else { long df = minInterval[1] - minInterval[0]; long c = df / unit; long r = rand.NextInt64(c); return minInterval[0] + r * unit; } } else { if (unit == 0) { return minInterval[0]; } else { long df = maxInterval[1] - maxInterval[0]; long c = df / unit; long r = rand.NextInt64(c + 2); var v = maxInterval[0] + r * unit; if(v > maxInterval[1]) { v = maxInterval[1]; } max = v == maxInterval[1]; return v; } } } }