From 4e12c6e38965a3ef3d61b15cf8e1a470f5a7f04e Mon Sep 17 00:00:00 2001 From: luying Date: Fri, 8 Jul 2022 16:00:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E5=8D=A1=EF=BC=9A=E4=BF=9D=E5=BA=95?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/services/activity/gachaService.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/game-server/app/services/activity/gachaService.ts b/game-server/app/services/activity/gachaService.ts index 653694fca..62949c60d 100644 --- a/game-server/app/services/activity/gachaService.ts +++ b/game-server/app/services/activity/gachaService.ts @@ -199,15 +199,14 @@ export class GachaResults { } public getTargetCnt(floor: GachaFloor) { - return this.getTarget(floor).length; + let target = this.list.filter(cur => cur.heroQuality == floor.heroQuality); + return target.length; } public getRandomResultOfTarget(floor: GachaFloor, cnt: number) { - return getRandEelm(this.getTarget(floor), cnt); - } - - private getTarget(floor: GachaFloor) { - return this.list.filter(cur => cur.heroQuality == floor.heroQuality); + let target = this.list.filter(cur => cur.heroQuality == floor.heroQuality); + let targetRemoveLast = target.slice(0, target.length - 2); + return getRandEelm(targetRemoveLast, cnt); } // 具体的卡池 @@ -440,6 +439,7 @@ export class GachaPull { if(replacePlan) gachaResult.changePlan(replacePlan.planId, replacePlan.heroQuality); } else { // 设置为保底 let replacePlan = this.percent.getFloorTarget(floor.heroQuality); + if(replacePlan) gachaResult.changePlan(replacePlan.planId, replacePlan.heroQuality); hasGetFloor = true; } @@ -456,7 +456,7 @@ export class GachaPull { // 10连最多多少个武将 private setTenMostFloor(floor: GachaFloor) { let targetCnt = this.result.getTargetCnt(floor); - if(this.result.count == 10 && targetCnt >= floor.param) { + if(this.result.count == 10 && targetCnt > floor.param) { let gachaResults = this.result.getRandomResultOfTarget(floor, targetCnt - floor.param); for(let gachaResult of gachaResults) { let replacePlan = this.percent.getReplacePlan(gachaResult.heroQuality, floor.isReplaceLower());