抽卡:逻辑修复
This commit is contained in:
@@ -190,8 +190,8 @@ class GachaResults {
|
||||
export class GachaPull {
|
||||
private gachaType: GACHA_ID; // 抽卡类型
|
||||
// 字典
|
||||
private dicFloor: Map<GACHA_FLOOR_TYPE, number>; // 保底次数
|
||||
private percent: { id: number, weight: number, goodId?: number }[];
|
||||
private dicFloor: Map<GACHA_FLOOR_TYPE, number> = new Map(); // 保底次数
|
||||
private percent: { id: number, weight: number, goodId?: number }[] = [];
|
||||
private bigReward: { id: number, weight: number, goodId?: number }; // 保底的一项,percent中的一项
|
||||
// 玩家数据
|
||||
private player: PlayerGachaRecord;
|
||||
@@ -262,6 +262,7 @@ export class GachaPull {
|
||||
break;
|
||||
case GACHA_FLOOR_TYPE.ASSIGN:
|
||||
this.setAssignFloor(floorCount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,18 +293,20 @@ export class GachaPull {
|
||||
public setAssignFloor(dicFloorCount: number) {
|
||||
let floorType = GACHA_FLOOR_TYPE.ASSIGN;
|
||||
let { floorCount: historyCount, hasGetFloor } = this.player.getFloorCountByFloorType(floorType);
|
||||
console.log('#### gachaResult', this.result.list)
|
||||
for(let gachaResult of this.result.list) {
|
||||
let isTarget = this.bigReward.id == gachaResult.contentId;
|
||||
console.log('#### setAssignFloor', historyCount, dicFloorCount, isTarget)
|
||||
if(++historyCount >= dicFloorCount || isTarget) {
|
||||
console.log('#### setAssignFloor', isTarget, hasGetFloor)
|
||||
if(hasGetFloor) { // 已经获得过一次保底了, 不给,换个给
|
||||
gachaResult.setContentId(getGachaContentOfHeroQuality(HERO_QUALITY_TYPE.PURPLE));
|
||||
} else {
|
||||
gachaResult.setContentId(this.bigReward.id, this.bigReward.goodId);
|
||||
hasGetFloor = false;
|
||||
hasGetFloor = true;
|
||||
}
|
||||
gachaResult.setContentId(this.bigReward.id, this.bigReward.goodId);
|
||||
historyCount = 0;
|
||||
}
|
||||
console.log('#### setAssignFloor after', historyCount, dicFloorCount)
|
||||
if(historyCount >= dicFloorCount) {
|
||||
hasGetFloor = false;
|
||||
historyCount = 0;
|
||||
@@ -342,8 +345,11 @@ export class GachaPull {
|
||||
|
||||
public pullBySimpleResult(simpleResult: {contentId: number, hid: number }[], userHeroes: HeroType[]) {
|
||||
let results = simpleResult.map(obj => {
|
||||
return new GachaResult(obj.contentId, obj.hid);
|
||||
let gachaResult = new GachaResult(obj.contentId);
|
||||
gachaResult.setHidOrGid(obj.hid);
|
||||
return gachaResult;
|
||||
});
|
||||
|
||||
return this.transferToFinalResult(results, userHeroes);
|
||||
}
|
||||
|
||||
@@ -398,7 +404,8 @@ class ContentDetail {
|
||||
}
|
||||
|
||||
public getResult() {
|
||||
switch(this.contentId) {
|
||||
let { type } = gameData.gachaContent.get(this.contentId);
|
||||
switch(type) {
|
||||
case GACHA_CONTENT_TYPE.HERO:
|
||||
return this.randomHeroByQuality(this.param[0]);
|
||||
case GACHA_CONTENT_TYPE.HERO_PIECE:
|
||||
@@ -407,6 +414,8 @@ class ContentDetail {
|
||||
return this.randomStoneByLv(this.param[0]);
|
||||
case GACHA_CONTENT_TYPE.ITEMS:
|
||||
return getRandSingleEelm(this.param);
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user