礼物显示
This commit is contained in:
parent
28051f2acd
commit
743e4dc1c8
@ -19,7 +19,7 @@ const probabilityAffectingFields = new Set([
|
||||
"rtpValueCoins",
|
||||
]);
|
||||
export const wheelPools = [
|
||||
{ key: "classic", label: "Classic", tierCount: 9 },
|
||||
{ key: "classic", label: "Classic", tierCount: 8 },
|
||||
{ key: "luxury", label: "Luxury", tierCount: 8 },
|
||||
{ key: "advanced", label: "Advanced", tierCount: 12 },
|
||||
];
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { generateWheelTierProbabilities } from "@/features/operations/hooks/useWheelPage.js";
|
||||
import { wheelConfigFormSchema } from "@/features/operations/schema";
|
||||
import { generateWheelTierProbabilities, wheelPools } from "@/features/operations/hooks/useWheelPage.js";
|
||||
|
||||
function tier(overrides) {
|
||||
return {
|
||||
@ -34,6 +35,56 @@ function expectedPayoutCoins(tiers) {
|
||||
}
|
||||
|
||||
describe("wheel prize probability generation", () => {
|
||||
test("uses eight prize slots for the classic wheel", () => {
|
||||
const classicPool = wheelPools.find((pool) => pool.key === "classic");
|
||||
const tiers = Array.from({ length: 8 }, (_, index) =>
|
||||
tier({
|
||||
displayName: `奖品 ${index + 1}`,
|
||||
rewardCoins: 100,
|
||||
rewardId: "",
|
||||
rewardType: "coin",
|
||||
rtpValueCoins: 100,
|
||||
tierId: `classic-${index + 1}`,
|
||||
}),
|
||||
);
|
||||
|
||||
expect(classicPool?.tierCount).toBe(8);
|
||||
expect(
|
||||
wheelConfigFormSchema.safeParse({
|
||||
drawPriceCoins: 100,
|
||||
effectiveFromMs: 0,
|
||||
enabled: true,
|
||||
initialPoolCoins: 0,
|
||||
maxSingleRTPPayout: 0,
|
||||
poolRatePercent: 90,
|
||||
poolReserveCoins: 0,
|
||||
settlementWindowDraws: 1000,
|
||||
targetRTPPercent: 90,
|
||||
tiers: generateWheelTierProbabilities({ drawPriceCoins: 100, targetRTPPercent: 90, tiers }),
|
||||
wheelId: "classic",
|
||||
}).success,
|
||||
).toBe(true);
|
||||
expect(
|
||||
wheelConfigFormSchema.safeParse({
|
||||
drawPriceCoins: 100,
|
||||
effectiveFromMs: 0,
|
||||
enabled: true,
|
||||
initialPoolCoins: 0,
|
||||
maxSingleRTPPayout: 0,
|
||||
poolRatePercent: 90,
|
||||
poolReserveCoins: 0,
|
||||
settlementWindowDraws: 1000,
|
||||
targetRTPPercent: 90,
|
||||
tiers: generateWheelTierProbabilities({
|
||||
drawPriceCoins: 100,
|
||||
targetRTPPercent: 90,
|
||||
tiers: [...tiers, tier({ rewardCoins: 100, rewardId: "", rewardType: "coin", rtpValueCoins: 100, tierId: "classic-9" })],
|
||||
}),
|
||||
wheelId: "classic",
|
||||
}).success,
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
test("uses the base RTP to generate coin and gift probabilities while keeping dress and prop random", () => {
|
||||
const result = generateWheelTierProbabilities({
|
||||
drawPriceCoins: 10000,
|
||||
|
||||
@ -4,7 +4,7 @@ const rewardTypes = ["coin", "gift", "prop", "dress"] as const;
|
||||
const propRewardTypes = new Set(["prop", "dress"]);
|
||||
const wheelTierCounts: Record<string, number> = {
|
||||
advanced: 12,
|
||||
classic: 9,
|
||||
classic: 8,
|
||||
luxury: 8,
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user