修改助力积分获取算法
This commit is contained in:
parent
5431a840b4
commit
cba5613353
@ -5,36 +5,36 @@
|
||||
"name": "Iron Chest",
|
||||
"initScoreMin": 75,
|
||||
"initScoreMax": 125,
|
||||
"bounsCfg": [15, 15],
|
||||
"maxBounsCount": 5,
|
||||
"probability": 4564
|
||||
"probability": 4564,
|
||||
"maxBounsScore": 75
|
||||
},
|
||||
{
|
||||
"level": 2,
|
||||
"name": "Bronze Chest",
|
||||
"initScoreMin": 175,
|
||||
"initScoreMax": 225,
|
||||
"bounsCfg": [13, 13],
|
||||
"maxBounsCount": 8,
|
||||
"probability": 3526
|
||||
"probability": 3526,
|
||||
"maxBounsScore": 105
|
||||
},
|
||||
{
|
||||
"level": 3,
|
||||
"name": "Sliver Chest",
|
||||
"initScoreMin": 375,
|
||||
"initScoreMax": 425,
|
||||
"bounsCfg": [12,12],
|
||||
"maxBounsCount": 12,
|
||||
"probability": 1724
|
||||
"probability": 1725,
|
||||
"maxBounsScore": 145
|
||||
},
|
||||
{
|
||||
"level": 4,
|
||||
"name": "Golden Chest",
|
||||
"initScoreMin": 775,
|
||||
"initScoreMax": 825,
|
||||
"bounsCfg": [11, 11],
|
||||
"maxBounsCount": 15,
|
||||
"probability": 186
|
||||
"probability": 184,
|
||||
"maxBounsScore": 175
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -2,19 +2,19 @@
|
||||
"total_sign": [
|
||||
{
|
||||
"days": 5,
|
||||
"reward": 2
|
||||
"reward": 1
|
||||
},
|
||||
{
|
||||
"days": 10,
|
||||
"reward": 3
|
||||
"reward": 2
|
||||
},
|
||||
{
|
||||
"days": 20,
|
||||
"reward": 5
|
||||
"reward": 3
|
||||
},
|
||||
{
|
||||
"days": 30,
|
||||
"reward": 10
|
||||
"reward": 4
|
||||
}
|
||||
],
|
||||
"sequential_sign": [
|
||||
@ -28,11 +28,11 @@
|
||||
},
|
||||
{
|
||||
"days": 15,
|
||||
"reward": 4
|
||||
"reward": 3
|
||||
},
|
||||
{
|
||||
"days": 30,
|
||||
"reward": 8
|
||||
"reward": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,26 +1,42 @@
|
||||
[
|
||||
{
|
||||
"score": 600,
|
||||
"level": "Challenger"
|
||||
"rankMin": 1,
|
||||
"rankMax": 1,
|
||||
"level": "1"
|
||||
},
|
||||
{
|
||||
"score": 500,
|
||||
"level": "Diamond"
|
||||
"rankMin": 2,
|
||||
"rankMax": 2,
|
||||
"level": "2"
|
||||
},
|
||||
{
|
||||
"score": 400,
|
||||
"level": "Platnum"
|
||||
"rankMin": 3,
|
||||
"rankMax": 3,
|
||||
"level": "3"
|
||||
},
|
||||
{
|
||||
"score": 100,
|
||||
"level": "Bronze"
|
||||
"rankMin": 4,
|
||||
"rankMax": 10,
|
||||
"level": "4"
|
||||
},
|
||||
{
|
||||
"score": 300,
|
||||
"level": "Gold"
|
||||
"rankMin": 11,
|
||||
"rankMax": 100,
|
||||
"level": "5"
|
||||
},
|
||||
{
|
||||
"score": 0,
|
||||
"level": "Silver"
|
||||
"rankMin": 101,
|
||||
"rankMax": 1000,
|
||||
"level": "6"
|
||||
},
|
||||
{
|
||||
"rankMin": 1001,
|
||||
"rankMax": 10000,
|
||||
"level": "7"
|
||||
},
|
||||
{
|
||||
"rankMin": 10001,
|
||||
"rankMax": 99999999,
|
||||
"level": "8"
|
||||
}
|
||||
]
|
||||
|
@ -18,7 +18,7 @@ export const CONFIRM_MAIL_HTML = `
|
||||
export const MANUAL_OPEN_GAME = false
|
||||
|
||||
// 每一步能获得的最小分数
|
||||
export const STEP_SCORE_MIN = 50
|
||||
export const STEP_SCORE_MIN = 40
|
||||
// 每一步能获得的最大分数
|
||||
export const STEP_SCORE_MAX = 50
|
||||
// 每一步能获得的宝箱的概率
|
||||
|
@ -213,7 +213,7 @@ class BoxController extends BaseController {
|
||||
if (userCurrent >= userMax) {
|
||||
throw new ZError(16, 'user enhance times exceed')
|
||||
}
|
||||
const score = Math.floor(Math.random() * (chest.bounsCfg[1] - chest.bounsCfg[0] + 1) + chest.bounsCfg[0])
|
||||
const score = chest.bounsCfg[chest.bonusUsers.length] || chest.bounsCfg[chest.bounsCfg.length - 1]
|
||||
await ActivityChest.updateOne(
|
||||
{ _id: chest.id },
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ export class ActivityChestClass extends BaseModule {
|
||||
// 最大助力次数
|
||||
@prop()
|
||||
public maxBounsCount: number
|
||||
// 助力积分配置[min, max]
|
||||
// 助力积分配置[v1, v2, v3]
|
||||
@prop({ type: () => [Number], default: [] })
|
||||
public bounsCfg: number[]
|
||||
// 基础积分
|
||||
|
@ -13,6 +13,23 @@ chestCfg.chests.forEach((cfg: any) => {
|
||||
chestLevelMap.set(cfg.level, cfg)
|
||||
})
|
||||
|
||||
const generateBounsCfg = (cfg: any) => {
|
||||
let randoms = []
|
||||
for (let i = 0; i < cfg.bounsCount; i++) {
|
||||
randoms.push(Math.random())
|
||||
}
|
||||
let total = randoms.reduce((a: number, b: number) => a + b)
|
||||
randoms = randoms.map((r: number) => r / total)
|
||||
let ys = []
|
||||
randoms.forEach((r: number) => {
|
||||
let tmp = cfg.maxBounsScore * r
|
||||
tmp = Math.min(1, Math.round(tmp))
|
||||
ys.push(tmp)
|
||||
})
|
||||
ys.sort((a: number, b: number) => b - a)
|
||||
return ys
|
||||
}
|
||||
|
||||
export const generateNewChest = (uid: string, activity: string, level = 1, status = ChestStatusEnum.LOCKED) => {
|
||||
let cfg = chestLevelMap.get(level)
|
||||
if (!cfg) {
|
||||
@ -24,7 +41,7 @@ export const generateNewChest = (uid: string, activity: string, level = 1, statu
|
||||
activity: activity,
|
||||
level: level,
|
||||
maxBounsCount: cfg.maxBounsCount,
|
||||
bounsCfg: cfg.bounsCfg,
|
||||
bounsCfg: generateBounsCfg(cfg),
|
||||
scoreInit,
|
||||
status,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user