diff --git a/assets/script/game/hero/DamageQueueComp.ts b/assets/script/game/hero/DamageQueueComp.ts index 36112a41..95d4289d 100644 --- a/assets/script/game/hero/DamageQueueComp.ts +++ b/assets/script/game/hero/DamageQueueComp.ts @@ -60,7 +60,8 @@ export class DamageQueueComp extends ecs.Comp { */ addDamageEvent(attrs: any, caster: HeroViewComp, s_uuid: number,ext_dmg:number=0,dmg_ratio:number=1): void { const timestamp = Date.now(); - const eventId = `${caster.ent.eid}_${s_uuid}_${timestamp}_${Math.random()}`; + const casterEid = caster?.ent?.eid ?? -1; + const eventId = `${casterEid}_${s_uuid}_${timestamp}_${Math.random()}`; const damageEvent: DamageEvent = { Attrs: attrs ? { ...attrs } : null, // 深拷贝属性数据