社团前缀和抽卡概率优化

This commit is contained in:
milimoe 2025-01-10 19:45:31 +08:00
parent b5231db724
commit 1b8d547a0c
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
2 changed files with 14 additions and 13 deletions

View File

@ -3881,7 +3881,7 @@ namespace Oshima.Core.Controllers
string pattern = @"^[a-zA-Z-_=+*%#^~.?!;:'"",]{3,4}$";
if (!Regex.IsMatch(clubPrefix, pattern))
{
return NetworkUtility.JsonSerialize($"社团的前缀只能包含总共3-4个英文字母和允许的特殊字符,此前缀不满足条件。");
return NetworkUtility.JsonSerialize($"社团的前缀只能包含总共3-4个英文字母和数字、允许的特殊字符,此前缀不满足条件。");
}
HashSet<long> clubids = [];
@ -4407,7 +4407,7 @@ namespace Oshima.Core.Controllers
{
if (values[0].Length >= 2 && values[0].Length <= 10)
{
return NetworkUtility.JsonSerialize("社团名称只能包含2至10个字符!");
return NetworkUtility.JsonSerialize("社团名称只能包含2至15个字符!");
}
club.Name = values[0];
msg = "修改成功,新的社团名称是:" + club.Name;
@ -4422,15 +4422,16 @@ namespace Oshima.Core.Controllers
{
return NetworkUtility.JsonSerialize("只有社长可以修改社团前缀!");
}
string pattern = @"^[a-zA-Z-_=+*%#^~.?!;:'"",]{3,4}$";
string pattern = @"^[a-zA-Z0-9-_=+*%#^~.?!;:'"",]{3,4}$";
if (values.Length > 0)
{
string clubPrefix = values[0];
if (!Regex.IsMatch(clubPrefix, pattern))
{
return NetworkUtility.JsonSerialize($"社团的前缀只能包含总共3-4个英文字母和允许的特殊字符,此前缀不满足条件。");
return NetworkUtility.JsonSerialize($"社团的前缀只能包含总共3-4个英文字母和数字、允许的特殊字符,此前缀不满足条件。");
}
club.Prefix = clubPrefix;
msg = "修改成功,新的社团前缀是:" + club.Prefix;
}
else
{

View File

@ -581,18 +581,18 @@ namespace Oshima.Core.Utils
{
msg = $"消耗 {reduce} {General.GameplayEquilibriumConstant.InGameCurrency},恭喜你抽到了:";
}
int r = Random.Shared.Next(8);
double q = Random.Shared.NextDouble() * 100;
QualityType type = q switch
QualityType type = QualityType.White;
foreach (QualityType typeTemp in DrawCardProbabilities.Keys.OrderByDescending(o => (int)o))
{
<= 69.53 => QualityType.White,
> 69.53 and <= 69.53 + 15.35 => QualityType.Green,
> 69.53 + 15.35 and <= 69.53 + 15.35 + 9.48 => QualityType.Blue,
> 69.53 + 15.35 + 9.48 and <= 69.53 + 15.35 + 9.48 + 4.25 => QualityType.Purple,
> 69.53 + 15.35 + 9.48 + 4.25 and <= 69.53 + 15.35 + 9.48 + 4.25 + 1.33 => QualityType.Orange,
> 69.53 + 15.35 + 9.48 + 4.25 + 1.33 and <= 69.53 + 15.35 + 9.48 + 4.25 + 1.33 + 0.06 => QualityType.Red,
_ => QualityType.White
};
if (q <= DrawCardProbabilities[typeTemp])
{
type = typeTemp;
break;
}
}
switch (r)
{