This commit is contained in:
Putoo
2026-07-03 18:16:47 +08:00
parent 5eb0bfd792
commit ea32e7046e
29 changed files with 390 additions and 75 deletions

View File

@@ -380,7 +380,7 @@ public static class GameBus
return null;
}
public static List<TowerGet> GetRandomGoods(RandomModel random, int count = 1, int luck = 0)
public static List<TowerGet> GetRandomGoods(RandomModel random, int count = 1, decimal luck = 0)
{
List<TowerGet> result = new List<TowerGet>();
for (int i = 0; i < count; i++)
@@ -419,11 +419,11 @@ public static class GameBus
return result;
}
private static List<RandomData> RandomHandleByWeight(RandomModel random, int luck = 0)
private static List<RandomData> RandomHandleByWeight(RandomModel random, decimal luck = 0)
{
var _randomInstance = new Random();
List<RandomData> result = new List<RandomData>();
int empty = random.empty - luck;
int empty = random.empty - Convert.ToInt32(luck * 100);
if (_randomInstance.Next(0, 100) < empty)
{
return result;
@@ -450,11 +450,11 @@ public static class GameBus
return result;
}
private static List<RandomData> RandomHandleByChance(RandomModel random, int luck = 0)
private static List<RandomData> RandomHandleByChance(RandomModel random, decimal luck = 0)
{
var _randomInstance = new Random();
List<RandomData> result = new List<RandomData>();
int empty = random.empty - luck;
int empty = random.empty;
if (_randomInstance.Next(0, 100) < empty)
{
return result;
@@ -468,7 +468,7 @@ public static class GameBus
foreach (var item in random.data)
{
double rnd = _randomInstance.NextDouble();
double okChance = item.chance / 100;
double okChance = (item.chance / 100) * (1.0 + Convert.ToDouble(luck));
if (rnd < okChance)
{
result.Add(item);