武将:抽象武将创建接口
This commit is contained in:
@@ -15,7 +15,7 @@ import { RECRUIT } from "../pubUtils/dicParam";
|
||||
*/
|
||||
export async function getLimitGacha(activityId: number) {
|
||||
|
||||
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId, true);
|
||||
let activityData = await ActivityModel.findActivity(activityId, true);
|
||||
if(!activityData) return false;
|
||||
|
||||
let gachaData = new GachaData(activityData);
|
||||
@@ -224,10 +224,9 @@ function getPoolByHope(hope: Hope[], qualtiy: number) {
|
||||
if(h.hasGet) hasGetHope.push(h.id);
|
||||
}
|
||||
|
||||
let list = decodeArrayListStr(RECRUIT.RECRUIT_WISH_LIST).map(cur => {
|
||||
let curHope = hopeMap.get(parseInt(cur[0]));
|
||||
return { id: parseInt(cur[0]), hasGet: curHope?.hasGet||false, weight: parseInt(cur[1]) }
|
||||
});
|
||||
let list = gameData.gachaHope.map(cur => {
|
||||
return {...cur, hasGet: hopeMap.get(cur.id)?.hasGet||false};
|
||||
})
|
||||
let { dic: { id, hasGet } } = getRandomWithWeight(list);
|
||||
if(id == 0 || hasGet) {
|
||||
return getAllHeroByQuality(qualtiy).filter(cur => !hasGetHope.includes(cur) );
|
||||
@@ -249,7 +248,7 @@ function getPoolByHope(hope: Hope[], qualtiy: number) {
|
||||
* 根据品质获得武将池
|
||||
* @param quality 品质
|
||||
*/
|
||||
function getAllHeroByQuality(quality: number) {
|
||||
export function getAllHeroByQuality(quality: number) {
|
||||
if(quality == 0) return [ GACHA_OCCUPY_HID ];
|
||||
|
||||
let allHero: number[] = [];
|
||||
@@ -300,10 +299,3 @@ function getSuitPaper(lv: number) {
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
export function transPiece(hid: number) {
|
||||
let dicHero = gameData.hero.get(hid);
|
||||
let { pieceId, quality } = dicHero;
|
||||
let dicPiece = decodeIdCntArrayStr(RECRUIT.RECRUIT_CHANGE_SHARD, 1); // 多少品质对应多少碎片
|
||||
return { pieceId, count: dicPiece.get(quality.toString()) }
|
||||
}
|
||||
Reference in New Issue
Block a user