武将:抽象武将创建接口

This commit is contained in:
luying
2021-04-23 19:32:02 +08:00
parent 2b246c4bc9
commit 0cd6939f5e
18 changed files with 213 additions and 95 deletions

View File

@@ -187,7 +187,10 @@ export const gameData = {
taskBox: dicTaskBox,
gacha: dicGacha,
gachaContent: dicGachaContent,
gachaContentHero: dicGachaContentHero
gachaContentHero: dicGachaContentHero,
gachaHope: getGachaHopePercent(),
gachaTurntable: getGachaTurntablePercent(),
heroTransPiece: getHeroTransPiece()
};
// 在此提供一些原先在gamedata中提供的方法以便更方便获取gameData数据
@@ -582,4 +585,29 @@ export function getRandExpedition(cnt = 1) {
arr.push(dicExpedition);
}
return getRandEelm(arr, cnt);
}
// 抽卡心愿单概率
function getGachaHopePercent() {
let arr = decodeArrayListStr(RECRUIT.RECRUIT_WISH_LIST);
return arr.map(cur => {
return { id: parseInt(cur[0]), weight: parseInt(cur[1]) }
});
}
// 抽卡转盘概率
function getGachaTurntablePercent() {
let arr = decodeArrayListStr(RECRUIT.RECRUIT_BONUS_HERO_QUANTITY);
return arr.map(cur => {
return { quality: parseInt(cur[0]), weight: parseInt(cur[1]) }
});
}
function getHeroTransPiece() {
let map = decodeIdCntArrayStr(RECRUIT.RECRUIT_CHANGE_SHARD, 1);
let newMap = new Map<number, number>();
for(let [id, count] of map) {
newMap.set(parseInt(id), count);
}
return newMap
}