其他地方也添加判空处理
This commit is contained in:
@@ -259,7 +259,9 @@ async function matchRobot(chosenOpps: string[], role: RoleType, score: number, d
|
||||
let dicHero = gameData.hero.get(actorId);
|
||||
if (!dicHero) continue;
|
||||
let heroInfo = new PvpHeroInfo();
|
||||
let { attribute, ce, lv } = getRobotAttribute(actorId, ratio, score);
|
||||
let robotInfo = getRobotAttribute(actorId, ratio, score);
|
||||
if(!robotInfo) continue;
|
||||
let { attribute, ce, lv } = robotInfo;
|
||||
heroInfo.setRobotInfo(dicHero, lv);
|
||||
defCe += ce;
|
||||
heroInfo.setAttribute(attribute);
|
||||
@@ -373,6 +375,7 @@ export function refreshRefOppCnt(pvpDefense: PvpDefenseType) {
|
||||
export function getRobotAttribute(hid: number, posRatio: number, score: number) {
|
||||
|
||||
let difficultRatio = getPvpDifficultByScore(score);
|
||||
if(!difficultRatio) return null
|
||||
let dicHero = gameData.hero.get(hid);
|
||||
|
||||
let newAttribute = new AttributeCal();
|
||||
|
||||
@@ -456,7 +456,14 @@ export function getPvpHeroRewardsByScore(score: number) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null
|
||||
return getMaxPvpHeroRewards()
|
||||
}
|
||||
|
||||
function getMaxPvpHeroRewards() {
|
||||
if(gameData.pvpHeroRewards.length <= 0) return null
|
||||
return gameData.pvpHeroRewards.reduce((pre, cur) => {
|
||||
return cur.max > pre.max? cur: pre;
|
||||
}, gameData.pvpHeroRewards[0])
|
||||
}
|
||||
|
||||
export function getPvpRankRewardsByRank(rankLv: number) {
|
||||
|
||||
Reference in New Issue
Block a user