抽卡:保底调整

This commit is contained in:
luying
2022-07-08 16:00:09 +08:00
parent 040a3c96b1
commit 4e12c6e389

View File

@@ -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());