抽卡:修复伪随机逻辑
This commit is contained in:
@@ -168,25 +168,23 @@ export class GachaPull {
|
|||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
} else if (this.dicFloorType == GACHA_FLOOR_TYPE.ASSIGN) {
|
} else if (this.dicFloorType == GACHA_FLOOR_TYPE.ASSIGN) {
|
||||||
|
let result = base;
|
||||||
|
if(isTarget || this.floorCount + 1 >= this.dicFloorCount) {
|
||||||
|
if(this.hasGetFloor) { // 已经获得过一次保底了, 不给,换个给
|
||||||
|
let { dic } = getRandEelmWithWeight(this.percent.filter(cur => cur.id != this.dicFloor.id));
|
||||||
|
result = dic
|
||||||
|
} else {
|
||||||
|
this.hasGetFloor = true;
|
||||||
|
result = this.dicFloor;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.floorCount ++;
|
this.floorCount ++;
|
||||||
console.log('******', this.floorCount, this.dicFloorCount, this.hasGetFloor )
|
|
||||||
if(this.floorCount >= this.dicFloorCount) {
|
if(this.floorCount >= this.dicFloorCount) {
|
||||||
if(!this.hasGetFloor) isTarget = true;
|
|
||||||
this.hasGetFloor = false;
|
this.hasGetFloor = false;
|
||||||
this.floorCount = 0;
|
this.floorCount = 0;
|
||||||
}
|
}
|
||||||
console.log('******2', this.floorCount, this.dicFloorCount, this.hasGetFloor, isTarget )
|
console.log('******', this.floorCount, this.dicFloorCount, this.hasGetFloor )
|
||||||
if(isTarget) {
|
return result;
|
||||||
if(this.hasGetFloor) { // 已经获得过一次保底了, 不给,换个给
|
|
||||||
let { dic } = getRandEelmWithWeight(this.percent.filter(cur => cur.id != this.dicFloor.id));
|
|
||||||
return dic
|
|
||||||
} else {
|
|
||||||
this.hasGetFloor = true;
|
|
||||||
return this.dicFloor;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return base
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return base
|
return base
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user