抽卡:求贤若渴pick武将按品质算数量
This commit is contained in:
@@ -328,7 +328,7 @@ export class GachaPull {
|
||||
let { dic: { id: randHopePosition } } = getRandEelmWithWeight(gameData.gachaHope);
|
||||
if(randHopePosition > 0) { // 按玩家设置的心愿单塞
|
||||
let hopeHero = this.player.getHopeHero(randHopePosition)
|
||||
if(hopeHero > 0) gachaResult.setHidOrGid(hopeHero);
|
||||
if(hopeHero > 0) gachaResult.setHidOrGid(hopeHero, 1);
|
||||
}
|
||||
this.player.setUserHope(gachaResult.hid); // 设置心愿单中了没有
|
||||
}
|
||||
@@ -342,7 +342,7 @@ export class GachaPull {
|
||||
public pullBySimpleResult(simpleResult: {contentId: number, hid: number }[], userHeroes: HeroType[]) {
|
||||
let results = simpleResult.map(obj => {
|
||||
let gachaResult = new GachaResult(obj.contentId);
|
||||
gachaResult.setHidOrGid(obj.hid);
|
||||
gachaResult.setHidOrGid(obj.hid, 1);
|
||||
return gachaResult;
|
||||
});
|
||||
|
||||
@@ -352,8 +352,12 @@ export class GachaPull {
|
||||
private transferToFinalResult(results: GachaResult[], userHeroes: HeroType[]) {
|
||||
let hids = userHeroes.map(cur => cur.hid);
|
||||
let items: RewardInter[] = [], heroInfo: CreateHeroParam[] = [];
|
||||
|
||||
for (let result of results) {
|
||||
let newResult: GachaResult[] = [];
|
||||
for(let result of results) {
|
||||
let cnt = result.hid > 0? result.count: 1;
|
||||
newResult.push(...new Array(cnt).fill(result.copy()));
|
||||
}
|
||||
for (let result of newResult) {
|
||||
if (result.hid > 0) {
|
||||
let hasHero = hids.indexOf(result.hid) != -1;
|
||||
if (hasHero) { // 已有转换为碎片
|
||||
@@ -368,7 +372,7 @@ export class GachaPull {
|
||||
items.push({ id: result.id, count: result.count });
|
||||
}
|
||||
}
|
||||
return { items, heroInfo, resultList: results }
|
||||
return { items, heroInfo, resultList: newResult }
|
||||
}
|
||||
|
||||
// 获得需要储存的数据
|
||||
@@ -416,13 +420,22 @@ class ContentDetail {
|
||||
}
|
||||
|
||||
private randomHeroByQuality(quality: number) {
|
||||
if(quality == 0) return this.pickHero;
|
||||
if(quality == 0) {
|
||||
this.setPickHeroCnt();
|
||||
return this.pickHero;
|
||||
}
|
||||
|
||||
let heroes = getAllHeroByQuality(quality);
|
||||
return getRandSingleEelm(heroes);
|
||||
}
|
||||
|
||||
|
||||
private setPickHeroCnt() {
|
||||
if(this.pickHero && gameData.hero.has(this.pickHero)) {
|
||||
let dicHero = gameData.hero.get(this.pickHero);
|
||||
this.count = gameData.gachaPickHeroCnt.get(dicHero.quality)??1;
|
||||
}
|
||||
}
|
||||
|
||||
private randomHeroPieceByQuality(quality: number) {
|
||||
let pieces = getAllItemByQuality(IT_TYPE.HERO_PIECE, quality);
|
||||
return getRandSingleEelm(pieces);
|
||||
|
||||
Reference in New Issue
Block a user