46 lines
1.3 KiB
C#

using System.Collections.Generic;
namespace ET.Server
{
public static class GachaTests
{
// 2.0.4.5
public static void TestDistribution10000()
{
int times = 10_000;
int rare5 = 0;
for (int i = 0; i < times; i++)
{
int roll = CryptoRandomGenerator.Next(0, 10000);
if (roll >= 9500) rare5++;
}
float ratio = rare5 / (float)times;
Log.Info($"[Test][Gacha] rare5 ratio={ratio}");
}
// 2.0.4.6
public static void TestGuaranteeAt90()
{
GachaComponent gacha = new();
BagComponent bag = new();
bag.AddItem(2, 9999);
List<RewardEntry> last = null;
for (int i = 0; i < 90; i++)
{
last = gacha.Draw(2, GachaDrawType.Single, bag);
}
Log.Info($"[Test][Gacha] draw90 reward={last?[0].ItemId}");
}
// 2.0.4.7
public static void TestNaturalReset()
{
GachaComponent gacha = new();
gacha.UpdateGuarantee(1, 5, 90);
int remain = gacha.GetGuaranteeRemain(1);
Log.Info($"[Test][Gacha] natural reset remain={remain}");
}
}
}