mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-12-05 16:16:35 +00:00
品质总量
This commit is contained in:
parent
5f52730115
commit
6957cd58e5
@ -150,19 +150,32 @@ namespace Oshima.FunGame.OshimaServers.Service
|
|||||||
item.Name = GenerateRandomChineseName();
|
item.Name = GenerateRandomChineseName();
|
||||||
item.ItemType = ItemType.MagicCard;
|
item.ItemType = ItemType.MagicCard;
|
||||||
item.RemainUseTimes = 1;
|
item.RemainUseTimes = 1;
|
||||||
if (qualityType != null) item.QualityType = qualityType.Value;
|
|
||||||
|
|
||||||
GenerateAndAddSkillToMagicCard(item, magicId, str, agi, intelligence);
|
GenerateAndAddSkillToMagicCard(item, qualityType, magicId, str, agi, intelligence);
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GenerateAndAddSkillToMagicCard(Item item, long magicId = 0, int str = 0, int agi = 0, int intelligence = 0)
|
public static void GenerateAndAddSkillToMagicCard(Item item, QualityType? qualityType = null, long magicId = 0, int str = 0, int agi = 0, int intelligence = 0)
|
||||||
{
|
{
|
||||||
int total = str + agi + intelligence;
|
int total = str + agi + intelligence;
|
||||||
if (total == 0)
|
if (total == 0)
|
||||||
{
|
{
|
||||||
total = Random.Shared.Next(1, 43);
|
if (qualityType != null)
|
||||||
|
{
|
||||||
|
item.QualityType = qualityType.Value;
|
||||||
|
total = item.QualityType switch
|
||||||
|
{
|
||||||
|
QualityType.Green => Random.Shared.Next(7, 13),
|
||||||
|
QualityType.Blue => Random.Shared.Next(13, 19),
|
||||||
|
QualityType.Purple => Random.Shared.Next(19, 25),
|
||||||
|
QualityType.Orange => Random.Shared.Next(25, 31),
|
||||||
|
QualityType.Red => Random.Shared.Next(31, 37),
|
||||||
|
QualityType.Gold => Random.Shared.Next(37, 43),
|
||||||
|
_ => Random.Shared.Next(1, 7)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else total = Random.Shared.Next(1, 43);
|
||||||
|
|
||||||
// 随机决定将多少个属性赋给其中一个属性,确保至少一个不为零
|
// 随机决定将多少个属性赋给其中一个属性,确保至少一个不为零
|
||||||
int nonZeroAttributes = Random.Shared.Next(1, Math.Min(4, total + 1)); // 随机决定非零属性的数量,确保在 total = 1 时最多只有1个非零属性
|
int nonZeroAttributes = Random.Shared.Next(1, Math.Min(4, total + 1)); // 随机决定非零属性的数量,确保在 total = 1 时最多只有1个非零属性
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user