diff --git a/game-server/app/services/pvpService.ts b/game-server/app/services/pvpService.ts index d314aded9..9cb913f8c 100644 --- a/game-server/app/services/pvpService.ts +++ b/game-server/app/services/pvpService.ts @@ -240,7 +240,7 @@ async function matchRobot(oppPlayers: OppPlayer[], role: RoleType, score: number if (!dicHero) continue; let heroInfo = new PvpHeroInfo(); let { attribute, ce, lv } = getRobotAttribute(actorId, ratio, score); - heroInfo.setRobotInfo(actorId, lv); + heroInfo.setRobotInfo(dicHero, lv); defCe += ce; heroInfo.setAttribute(attribute); let enemy = new PvpEnemies(h, heroInfo, 0, ce); diff --git a/shared/domain/dbGeneral.ts b/shared/domain/dbGeneral.ts index 58b9924ca..03d418f37 100644 --- a/shared/domain/dbGeneral.ts +++ b/shared/domain/dbGeneral.ts @@ -2,7 +2,7 @@ import { prop, mongoose, Ref } from '@typegoose/typegoose'; import { DicWarJson } from '../pubUtils/dictionary/DicWarJson'; import Hero, { HeroType } from '../db/Hero'; import { nowSeconds } from '../pubUtils/timeUtil'; -import { gameData } from '../pubUtils/data'; +import { DicHero } from '../pubUtils/dictionary/DicHero'; // 从玩家数据中覆盖warjson的部分字段 export class PvpHeroInfo { @@ -42,10 +42,9 @@ export class PvpHeroInfo { this.quality = hero.quality; } - setRobotInfo(actorId: number, lv: number) { - let dicHero = gameData.hero.get(actorId); - this.actorId = actorId; - this.skinId = actorId; + setRobotInfo(dicHero: DicHero, lv: number) { + this.actorId = dicHero.heroId; + this.skinId = dicHero.heroId; this.actorName = dicHero.name; this.star = dicHero.initialStars; this.lv = lv;