其他地方也添加判空处理

This commit is contained in:
luying
2022-05-27 19:20:01 +08:00
parent a25dcc5e00
commit f9ec0d782b
2 changed files with 12 additions and 2 deletions

View File

@@ -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();