diff --git a/assets/script/game/hero/Mon.ts b/assets/script/game/hero/Mon.ts index 17f7882f..961175ee 100644 --- a/assets/script/game/hero/Mon.ts +++ b/assets/script/game/hero/Mon.ts @@ -35,7 +35,7 @@ export class Monster extends ecs.Entity { } /** 加载角色 */ - load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,lv:number=1,monType:MonType=MonType.NORMAL, buffs: BuffConf[] = [],is_call=false, lane: number = 0, spawnOrder: number = 0) { + load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,lv:number=1,monType:MonType=MonType.NORMAL, buffs: BuffConf[] = [],is_call=false, lane: number = 0, spawnOrder: number = 0, gameTime: number = 0) { scale=-1 let size=1 var scene = smc.map.MapView.scene; @@ -71,7 +71,7 @@ export class Monster extends ecs.Entity { model.is_kalami = true; } // 根据等级和类型获取怪物属性(使用新的动态成长系统) - const {hp, mp, ap, def, speed} = getMonAttr(lv, uuid, monType); + const {hp, mp, ap, def, speed} = getMonAttr(lv, uuid, monType, gameTime); // 初始化属性数组 model.Attrs = getAttrs(); model.hp = model.Attrs[Attrs.HP_MAX] = hp; diff --git a/assets/script/game/map/MissionMonComp.ts b/assets/script/game/map/MissionMonComp.ts index 4ff881e7..1dabf913 100644 --- a/assets/script/game/map/MissionMonComp.ts +++ b/assets/script/game/map/MissionMonComp.ts @@ -32,6 +32,8 @@ export class MissionMonCompComp extends CCComp { private eventProcessed: boolean = false; // 事件是否已处理 /** 全局生成顺序计数器,用于层级管理 */ private globalSpawnOrder: number = 0; + /** 游戏进行时间(秒) */ + private gameTime: number = 0; onLoad(){ @@ -56,6 +58,9 @@ export class MissionMonCompComp extends CCComp { protected update(dt: number): void { if(!smc.mission.play||smc.mission.pause) return + // 累加游戏时间 + this.gameTime += dt; + // 处理随机事件 @@ -167,7 +172,8 @@ export class MissionMonCompComp extends CCComp { monsterData.position, monsterData.type, monsterData.level, - monsterData.buffs + monsterData.buffs, + this.gameTime ); // 增加召唤计数 this.spawnCount++; @@ -180,8 +186,8 @@ export class MissionMonCompComp extends CCComp { i: number = 0, monType: number = 0, lv: number = 1, - buffs: BuffConf[] = [] - + buffs: BuffConf[] = [], + gameTime: number = 0 ) { let mon = ecs.getEntity(Monster); let scale = -1; @@ -199,7 +205,7 @@ export class MissionMonCompComp extends CCComp { this.globalSpawnOrder = (this.globalSpawnOrder + 1) % 999; // 防止无限增长,在999处循环重置 // 生成怪物,传递线路和生成顺序 - mon.load(pos, scale, uuid, lv, monType, buffs, false, lane, this.globalSpawnOrder); + mon.load(pos, scale, uuid, lv, monType, buffs, false, lane, this.globalSpawnOrder, gameTime); }