🐞 fix(抽卡): 添加ur武将专用保底

This commit is contained in:
luying
2022-11-22 17:10:10 +08:00
parent 4e8d785bea
commit b94c64cd1a
7 changed files with 54 additions and 75 deletions
@@ -184,7 +184,7 @@ export class GachaResults {
public getRandomResultOfTarget(floor: GachaFloor, cnt: number) {
let target = this.list.filter(cur => cur.heroQuality == floor.heroQuality);
let targetRemoveLast = target.slice(0, target.length - 2);
let targetRemoveLast = target.slice(0, cnt + 1);
return getRandEelm(targetRemoveLast, cnt);
}
@@ -326,6 +326,7 @@ class GachaFloor {
floorType: GACHA_FLOOR_TYPE;
heroQuality: number;
param: number;
param2: number = 0;
constructor(id: number) {
let dicGachaFloor = gameData.gachaFloor.get(id);
@@ -334,6 +335,12 @@ class GachaFloor {
this.floorType = dicGachaFloor.floorType;
this.heroQuality = dicGachaFloor.heroQuality;
this.param = dicGachaFloor.param;
if(dicGachaFloor.floorType == GACHA_FLOOR_TYPE.TEN_MOST_HIGHER || dicGachaFloor.floorType == GACHA_FLOOR_TYPE.TEN_MOST_LOWER) {
this.param2 = 10;
} else if(dicGachaFloor.floorType == GACHA_FLOOR_TYPE.FIVE_MOST_LOWER) {
this.param2 = 5;
}
}
}
@@ -342,6 +349,7 @@ class GachaFloor {
GACHA_FLOOR_TYPE.MAIN_FLOOR,
GACHA_FLOOR_TYPE.ONLY_ONE,
GACHA_FLOOR_TYPE.TEN_MOST_LOWER,
GACHA_FLOOR_TYPE.FIVE_MOST_LOWER,
].indexOf(this.floorType) != -1
}
}
@@ -399,6 +407,7 @@ export class GachaPull {
break;
case GACHA_FLOOR_TYPE.TEN_MOST_HIGHER:
case GACHA_FLOOR_TYPE.TEN_MOST_LOWER:
case GACHA_FLOOR_TYPE.FIVE_MOST_LOWER:
this.setTenMostFloor(floor);
break;
}
@@ -445,7 +454,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 == floor.param2 && 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());