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