活动:新武将抽卡活动

This commit is contained in:
qiaoxin
2021-06-23 20:56:19 +08:00
parent 03c977ec40
commit 58d8aacb4d
12 changed files with 388 additions and 15 deletions
@@ -310,3 +310,41 @@ function getSuitPaper(lv: number) {
}
return items;
}
/**
* 根据contentId获得抽卡结果 新武将抽卡活动
* @param contentId dic_zyz_gachaContent的id
* @param lv 玩家等级
* @param goodId 大于0指定id,0:随机
*/
export function getResultFromContentIdNewHeroActivity(contentId: number, goodId: number, lv: number,) {
let dic = gameData.gachaContent.get(contentId);
let { type, param, count } = dic;
if (type == GACHA_CONTENT_TYPE.HERO) {
let result = new GachaResult(contentId);
result.setHero(goodId);
return result
} else {
let pool: number[] = [];
if (type == GACHA_CONTENT_TYPE.HERO_PIECE) {
pool = getAllItemByQuality(IT_TYPE.HERO_PIECE, param[0], lv);
} else if (type == GACHA_CONTENT_TYPE.BLUEPRT) {
pool = getAllItemByQuality(IT_TYPE.BLUEPRT, param[0], lv);
} else if (type == GACHA_CONTENT_TYPE.JEWEL) {
pool = getAllJewelByLv(param[0]);
} else if (type == GACHA_CONTENT_TYPE.TERAPH_MATERIAL) {
pool = param;
} else if (type == GACHA_CONTENT_TYPE.SUIT_PAPER) {
pool = getSuitPaper(lv);
}
let item = getRandEelm(pool);
let result = new GachaResult(contentId);
result.setItem(item[0], count);
if (goodId > 0) {
result.setItem(goodId, count);
}
return result;
}
}