namespace Debug; public class ChouKa { // 10 20 30 50 60 70 80 90 int currentsize = 0; int baodinum = 70; //第一次保底80 往后就用随机数80 ~ 90 int waisize = 0; //歪的几率 第一次肯定不歪 string[] putong = ["1", "2", "3"];//普通物品 string[] waile = ["薄荷", "铁锈会员10天"];// 设置歪的物品 string baozan = "name";//设置本次UP池 精品 只能有一个 //普通物品抽中数量 int putongsize = 0; //精品物品抽中数量 int baozansize = 0; //歪物品抽中数量 int waisize_A = 0, waisize_B = 0; //创建随机数生成器 private readonly Random random = new(); string message = $"普通抽卡概率:{70}%\n精品抽卡概率:{30}%\n歪概率:{10}%\n" + "保底 80~90"; public ChouKa() { // 清除控制台屏幕 Program.IsWhile = true; Console.Clear(); while (Program.IsWhile) { ModeSwitch.New("抽卡系统", ["返回首页", "普通抽卡*1", "普通抽卡*10"], (a) => { switch (a) { case 0: Program.IsWhile = false; break; case 1: Start(); break; case 2: for (int i = 0; i < 10; i++) { Start(); } break; } }, message + "\n" + "当前保底:" + baodinum + "\n当前歪概率:" + waisize + "\n当前普通概率:" + (100 - baodinum) + $"\n普通物品:{putongsize} 精品物品:{baozansize} 歪物品:薄荷{waisize_A} 铁锈会员10天{waisize_B}\n"); } _ = new Program(); } public void Start() { // 生成一个1到100之间的随机数 var randomNumber = 0; do { randomNumber = random.Next(1, 101); // 生成1到100之间的随机数 // Console.WriteLine(randomNumber + " " + random.NextDouble()); // 如果生成的数大于70,则有一定概率重新生成 if (randomNumber > baodinum && random.NextDouble() > currentsize / 100) { randomNumber = -1; // 使用-1作为标记,表示需要重新生成 } } while (randomNumber == -1); // 如果标记为-1,则重新生成 currentsize++; if (randomNumber < baodinum && currentsize < baodinum) { // Console.Write(" 普通:" + putong[new Random().Next(0, putong.Length)] + " ");//普通抽卡结果 putongsize++; } else { int v = random.Next(0, 6); // 判断是否歪 if (v < waisize) { int v1 = new Random().Next(0, waile.Length); // Console.Write(" 歪了:" + waile[v1] + " "); if (v1 == 0) { waisize_A++; } else { waisize_B++; } waisize--; } else { // Console.Write(" 精品:" + baozan + " "); baozansize++; waisize = new Random().Next(0, 6); baodinum = random.Next(80, 91); currentsize = 0; } } } }