captainbattle 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/dist/core/CallID.d.ts +121 -105
  2. package/dist/core/CallID.js +128 -105
  3. package/dist/core/ListenID.d.ts +503 -443
  4. package/dist/core/ListenID.js +513 -443
  5. package/dist/core/config/AccessoriesDrawCfg.d.ts +9 -0
  6. package/dist/core/config/AccessoriesDrawCfg.js +8 -0
  7. package/dist/core/config/BadgeCfg.d.ts +76 -19
  8. package/dist/core/config/BadgeCfg.js +76 -19
  9. package/dist/core/config/BountyTaskCfg.d.ts +1 -1
  10. package/dist/core/config/BuffCfg.d.ts +3 -0
  11. package/dist/core/config/BuffCfg.js +3 -0
  12. package/dist/core/config/Cfg.d.ts +224 -120
  13. package/dist/core/config/Cfg.js +251 -121
  14. package/dist/core/config/ChatChannelCfg.d.ts +8 -2
  15. package/dist/core/config/ChatChannelCfg.js +7 -1
  16. package/dist/core/config/ChatEmojiCfg.d.ts +0 -2
  17. package/dist/core/config/Const.d.ts +3 -1
  18. package/dist/core/config/Const.js +2 -0
  19. package/dist/core/config/DailyTrialMapCfg.d.ts +1 -2
  20. package/dist/core/config/EmailCfg.d.ts +13 -1
  21. package/dist/core/config/EmailCfg.js +13 -1
  22. package/dist/core/config/FirstRechargeCfg.d.ts +1 -0
  23. package/dist/core/config/FuncDescCfg.d.ts +33 -3
  24. package/dist/core/config/FuncDescCfg.js +33 -3
  25. package/dist/core/config/FusionLevelCfg.d.ts +10 -0
  26. package/dist/core/config/FusionLevelCfg.js +8 -0
  27. package/dist/core/config/GuildBonusLogCfg.d.ts +8 -0
  28. package/dist/core/config/GuildBonusLogCfg.js +8 -0
  29. package/dist/core/config/GuildBossRankRewardCfg.d.ts +2 -1
  30. package/dist/core/config/GuildConfigCfg.d.ts +1 -1
  31. package/dist/core/config/GuildConfigCfg.js +1 -1
  32. package/dist/core/config/GuildDonateCfg.d.ts +4 -2
  33. package/dist/core/config/GuildIslandBuildCfg.d.ts +16 -0
  34. package/dist/core/config/GuildIslandBuildCfg.js +8 -0
  35. package/dist/core/config/GuildIslandBuildItemCfg.d.ts +11 -0
  36. package/dist/core/config/GuildIslandBuildItemCfg.js +8 -0
  37. package/dist/core/config/GuildIslandConfigCfg.d.ts +19 -0
  38. package/dist/core/config/GuildIslandConfigCfg.js +16 -0
  39. package/dist/core/config/GuildIslandIslandCfg.d.ts +9 -0
  40. package/dist/core/config/GuildIslandIslandCfg.js +8 -0
  41. package/dist/core/config/GuildIslandRankCfg.d.ts +11 -0
  42. package/dist/core/config/GuildIslandRankCfg.js +8 -0
  43. package/dist/core/config/GuildIslandZoneCfg.d.ts +11 -0
  44. package/dist/core/config/GuildIslandZoneCfg.js +8 -0
  45. package/dist/core/config/GuildLogCfg.d.ts +1 -0
  46. package/dist/core/config/GuildLvCfg.d.ts +1 -1
  47. package/dist/core/config/InviteConfigCfg.d.ts +14 -0
  48. package/dist/core/config/InviteConfigCfg.js +11 -0
  49. package/dist/core/config/InviteRewardCfg.d.ts +9 -0
  50. package/dist/core/config/InviteRewardCfg.js +8 -0
  51. package/dist/core/config/ItemsCfg.d.ts +5 -1
  52. package/dist/core/config/ItemsCfg.js +4 -0
  53. package/dist/core/config/MarqueeContentCfg.d.ts +7 -0
  54. package/dist/core/config/MarqueeContentCfg.js +7 -1
  55. package/dist/core/config/ModAffixLvCfg.d.ts +12 -0
  56. package/dist/core/config/ModAffixLvCfg.js +8 -0
  57. package/dist/core/config/PetCfg.d.ts +0 -2
  58. package/dist/core/config/PetConfigCfg.d.ts +19 -0
  59. package/dist/core/config/PetConfigCfg.js +16 -0
  60. package/dist/core/config/PetDrawCfg.d.ts +9 -0
  61. package/dist/core/config/PetDrawCfg.js +8 -0
  62. package/dist/core/config/PetSkillCfg.d.ts +2 -1
  63. package/dist/core/config/PrivilegeCfg.d.ts +2 -0
  64. package/dist/core/config/PrivilegeCfg.js +2 -0
  65. package/dist/core/config/ProDefineCfg.d.ts +2 -0
  66. package/dist/core/config/QualityCfg.d.ts +1 -0
  67. package/dist/core/config/RelicDungeonConfigCfg.d.ts +14 -4
  68. package/dist/core/config/RelicDungeonConfigCfg.js +14 -4
  69. package/dist/core/config/RelicDungeonGrowCfg.d.ts +7 -0
  70. package/dist/core/config/RelicDungeonGrowCfg.js +8 -0
  71. package/dist/core/config/RelicDungeonLevelCfg.d.ts +4 -10
  72. package/dist/core/config/RelicDungeonRankRewardCfg.d.ts +9 -0
  73. package/dist/core/config/RelicDungeonRankRewardCfg.js +8 -0
  74. package/dist/core/config/RelicDungeonScoreCfg.d.ts +11 -0
  75. package/dist/core/config/RelicDungeonScoreCfg.js +8 -0
  76. package/dist/core/config/RelicDungeonScoreRewardCfg.d.ts +9 -0
  77. package/dist/core/config/RelicDungeonScoreRewardCfg.js +8 -0
  78. package/dist/core/config/RelicTiesCfg.d.ts +1 -0
  79. package/dist/core/config/RobotConfigCfg.d.ts +17 -0
  80. package/dist/core/config/RobotConfigCfg.js +8 -0
  81. package/dist/core/config/RoleCfg.d.ts +1 -0
  82. package/dist/core/config/RuleDescCfg.d.ts +12 -2
  83. package/dist/core/config/RuleDescCfg.js +12 -2
  84. package/dist/core/config/SeaArenaConfigCfg.d.ts +22 -0
  85. package/dist/core/config/SeaArenaConfigCfg.js +19 -0
  86. package/dist/core/config/SeaArenaRankRewardCfg.d.ts +10 -0
  87. package/dist/core/config/SeaArenaRankRewardCfg.js +8 -0
  88. package/dist/core/config/SeaArenaRobotCfg.d.ts +8 -0
  89. package/dist/core/config/SeaArenaRobotCfg.js +8 -0
  90. package/dist/core/config/SeaArenaTierCfg.d.ts +13 -0
  91. package/dist/core/config/SeaArenaTierCfg.js +8 -0
  92. package/dist/core/config/ShopCfg.d.ts +1 -0
  93. package/dist/core/config/SkillLvCfg.d.ts +10 -0
  94. package/dist/core/config/SkillLvCfg.js +8 -0
  95. package/dist/core/config/SkinSkillCfg.d.ts +2 -1
  96. package/dist/core/config/SprintActivityConfigCfg.d.ts +18 -3
  97. package/dist/core/config/SprintActivityConfigCfg.js +18 -3
  98. package/dist/core/config/StageCfg.d.ts +2 -0
  99. package/dist/core/config/TConfig.d.ts +1 -1
  100. package/dist/core/config/TConfig.js +6 -4
  101. package/dist/core/config/TalentTreeLvCfg.d.ts +1 -1
  102. package/dist/core/config/TurretFusionLevelCfg.d.ts +10 -0
  103. package/dist/core/config/TurretFusionLevelCfg.js +8 -0
  104. package/dist/core/config/TurretModAffixLvCfg.d.ts +12 -0
  105. package/dist/core/config/TurretModAffixLvCfg.js +8 -0
  106. package/dist/core/config/TurretModCfg.d.ts +20 -0
  107. package/dist/core/config/TurretModCfg.js +8 -0
  108. package/dist/core/config/TurretModConfigCfg.d.ts +20 -0
  109. package/dist/core/config/TurretModConfigCfg.js +17 -0
  110. package/dist/core/config/TurretModQualityCfg.d.ts +12 -0
  111. package/dist/core/config/TurretModQualityCfg.js +8 -0
  112. package/dist/core/config/TurretSkillLvCfg.d.ts +10 -0
  113. package/dist/core/config/TurretSkillLvCfg.js +8 -0
  114. package/dist/core/config/VehicleWashAffixCfg.d.ts +14 -0
  115. package/dist/core/config/VehicleWashAffixCfg.js +8 -0
  116. package/dist/core/config/VehicleWashLevelCfg.d.ts +6 -2
  117. package/dist/core/framework/Pool.d.ts +4 -1
  118. package/dist/core/framework/Pool.js +19 -21
  119. package/dist/core/framework/Time.js +13 -3
  120. package/dist/core/framework/Watcher.js +0 -1
  121. package/dist/core/framework/collections/MinSortList.d.ts +0 -2
  122. package/dist/core/framework/collections/MinSortList.js +9 -33
  123. package/dist/core/framework/collections/ObjectPool.js +6 -3
  124. package/dist/core/framework/notify/Notifier.d.ts +1 -1
  125. package/dist/core/framework/notify/Notifier.js +5 -4
  126. package/dist/core/framework/notify/NotifyID.d.ts +2 -1
  127. package/dist/core/framework/notify/NotifyID.js +1 -0
  128. package/dist/core/framework/notify/NotifyListener.js +35 -9
  129. package/dist/core/module/arena/ArenaBattleModule.d.ts +7 -0
  130. package/dist/core/module/arena/ArenaBattleModule.js +32 -0
  131. package/dist/core/module/arena/index.d.ts +1 -0
  132. package/dist/core/module/arena/index.js +13 -0
  133. package/dist/core/module/battle/Game.d.ts +104 -13
  134. package/dist/core/module/battle/Game.js +218 -45
  135. package/dist/core/module/battle/IGameModule.d.ts +6 -0
  136. package/dist/core/module/battle/IGameModule.js +19 -6
  137. package/dist/core/module/battle/battle.interface.d.ts +31 -7
  138. package/dist/core/module/battle/battle.interface.js +5 -1
  139. package/dist/core/module/battle/buff/BuffMgr.d.ts +25 -0
  140. package/dist/core/module/battle/buff/BuffMgr.js +43 -0
  141. package/dist/core/module/battle/buff/BuffTrigger.js +9 -1
  142. package/dist/core/module/battle/buff/buffitem/AddPhysicDamBuff.js +2 -2
  143. package/dist/core/module/battle/buff/buffitem/ChangeSetpAddDamageBuff.js +3 -2
  144. package/dist/core/module/battle/buff/buffitem/DeltaUseSkillBuff.js +3 -2
  145. package/dist/core/module/battle/buff/buffitem/DiceAddCritBuff.d.ts +8 -0
  146. package/dist/core/module/battle/buff/buffitem/DiceAddCritBuff.js +35 -0
  147. package/dist/core/module/battle/buff/buffitem/FireHurtLayerBuff.d.ts +7 -0
  148. package/dist/core/module/battle/buff/buffitem/FireHurtLayerBuff.js +28 -0
  149. package/dist/core/module/battle/buff/buffitem/ForceTargetBuff.js +2 -1
  150. package/dist/core/module/battle/buff/buffitem/HitBoundAddDamageBuff.js +1 -1
  151. package/dist/core/module/battle/buff/buffitem/HitBoundAddScaleBuff.d.ts +11 -0
  152. package/dist/core/module/battle/buff/buffitem/HitBoundAddScaleBuff.js +79 -0
  153. package/dist/core/module/battle/buff/buffitem/LinkCurseBuff.js +3 -2
  154. package/dist/core/module/battle/buff/buffitem/MonitorBuff.js +10 -12
  155. package/dist/core/module/battle/buff/buffitem/PosionBanCureBuff.d.ts +3 -0
  156. package/dist/core/module/battle/buff/buffitem/PosionBanCureBuff.js +18 -0
  157. package/dist/core/module/battle/buff/buffitem/PosionBuff.d.ts +1 -0
  158. package/dist/core/module/battle/buff/buffitem/PosionBuff.js +15 -4
  159. package/dist/core/module/battle/buff/buffitem/ProjectileOrbLinkBuff.js +1 -1
  160. package/dist/core/module/battle/buff/buffitem/ProjectileScaleUpBuff.js +4 -2
  161. package/dist/core/module/battle/buff/buffitem/SameHitAddDamageBuff.js +8 -0
  162. package/dist/core/module/battle/buff/buffitem/SlayBuff.js +1 -1
  163. package/dist/core/module/battle/buff/buffitem/TimeAddDamageBuff.d.ts +1 -1
  164. package/dist/core/module/battle/buff/buffitem/TimeAddDamageBuff.js +36 -27
  165. package/dist/core/module/battle/buff/buffitem/index.d.ts +4 -0
  166. package/dist/core/module/battle/buff/buffitem/index.js +5 -1
  167. package/dist/core/module/battle/entity/BaseEntityData.d.ts +15 -1
  168. package/dist/core/module/battle/entity/BaseEntityData.js +27 -0
  169. package/dist/core/module/battle/entity/DragonBodyData.d.ts +19 -1
  170. package/dist/core/module/battle/entity/DragonBodyData.js +34 -0
  171. package/dist/core/module/battle/entity/DragonData.d.ts +18 -1
  172. package/dist/core/module/battle/entity/DragonData.js +32 -0
  173. package/dist/core/module/battle/entity/EntityPool.d.ts +1 -2
  174. package/dist/core/module/battle/entity/EntityPool.js +9 -18
  175. package/dist/core/module/battle/entity/FighterData.d.ts +114 -3
  176. package/dist/core/module/battle/entity/FighterData.js +350 -6
  177. package/dist/core/module/battle/entity/ProjectileData.d.ts +2 -0
  178. package/dist/core/module/battle/entity/ProjectileData.js +25 -0
  179. package/dist/core/module/battle/entity/RoleData.d.ts +12 -1
  180. package/dist/core/module/battle/entity/RoleData.js +19 -0
  181. package/dist/core/module/battle/entity/TurnUnit.d.ts +36 -0
  182. package/dist/core/module/battle/entity/TurnUnit.js +74 -0
  183. package/dist/core/module/battle/entity/index.d.ts +1 -1
  184. package/dist/core/module/battle/entity/index.js +1 -1
  185. package/dist/core/module/battle/event/EntityEvent.d.ts +13 -0
  186. package/dist/core/module/battle/event/EntityEvent.js +14 -0
  187. package/dist/core/module/battle/event/EntityEventBus.d.ts +10 -0
  188. package/dist/core/module/battle/event/EntityEventBus.js +35 -0
  189. package/dist/core/module/battle/event/EventListener.d.ts +6 -1
  190. package/dist/core/module/battle/event/EventListener.js +140 -7
  191. package/dist/core/module/battle/event/GameEvent.d.ts +8 -0
  192. package/dist/core/module/battle/event/GameEvent.js +9 -0
  193. package/dist/core/module/battle/factory/FighterFactory.js +26 -10
  194. package/dist/core/module/battle/fsm-state/AnyFighterStateTransitions.js +24 -12
  195. package/dist/core/module/battle/fsm-state/AnyFighterStates.js +9 -5
  196. package/dist/core/module/battle/fsm-state/Boss18110CallState.d.ts +1 -1
  197. package/dist/core/module/battle/fsm-state/Boss18110State.d.ts +1 -1
  198. package/dist/core/module/battle/fsm-state/FighterStateMachine.d.ts +2 -0
  199. package/dist/core/module/battle/fsm-state/FighterStateMachine.js +6 -0
  200. package/dist/core/module/battle/fsm-state/FighterStateProfiles.d.ts +8 -1
  201. package/dist/core/module/battle/fsm-state/FighterStateProfiles.js +31 -0
  202. package/dist/core/module/battle/fsm-state/FighterStateRegistry.d.ts +3 -0
  203. package/dist/core/module/battle/fsm-state/FighterStateRegistry.js +27 -8
  204. package/dist/core/module/battle/fsm-state/FighterStateShared.js +2 -2
  205. package/dist/core/module/battle/fsm-state/FighterStateType.d.ts +2 -1
  206. package/dist/core/module/battle/fsm-state/FighterStateType.js +2 -1
  207. package/dist/core/module/battle/fsm-state/TurnState.d.ts +29 -0
  208. package/dist/core/module/battle/fsm-state/TurnState.js +208 -0
  209. package/dist/core/module/battle/fsm-state/TurnTransitions.d.ts +36 -0
  210. package/dist/core/module/battle/fsm-state/TurnTransitions.js +90 -0
  211. package/dist/core/module/battle/fsm-state/index.d.ts +2 -0
  212. package/dist/core/module/battle/fsm-state/index.js +3 -1
  213. package/dist/core/module/battle/manager/EntityManager.d.ts +1 -0
  214. package/dist/core/module/battle/manager/EntityManager.js +138 -20
  215. package/dist/core/module/battle/skill/SkillData.d.ts +27 -0
  216. package/dist/core/module/battle/skill/SkillData.js +43 -0
  217. package/dist/core/module/battle/skill/emitter/SkillEmitter.js +4 -1
  218. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter1.d.ts +3 -0
  219. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter1.js +30 -2
  220. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter10.js +2 -2
  221. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter13.d.ts +1 -0
  222. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter13.js +25 -2
  223. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter15.js +1 -1
  224. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter2.js +1 -1
  225. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter23.d.ts +9 -0
  226. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter23.js +75 -11
  227. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter24.js +1 -1
  228. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter26.js +4 -0
  229. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter28.js +1 -1
  230. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter3.d.ts +14 -8
  231. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter3.js +127 -31
  232. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter30.d.ts +36 -0
  233. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter30.js +235 -0
  234. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter31.d.ts +13 -0
  235. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter31.js +47 -0
  236. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter4.d.ts +1 -0
  237. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter4.js +25 -2
  238. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter6.js +10 -6
  239. package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter8.js +2 -2
  240. package/dist/core/module/battle/skill/emitter/projectiles/index.d.ts +2 -0
  241. package/dist/core/module/battle/skill/emitter/projectiles/index.js +3 -1
  242. package/dist/core/module/battle/skill/impacts/Impact1.js +2 -0
  243. package/dist/core/module/battle/skill/impacts/Impact10.js +1 -1
  244. package/dist/core/module/battle/skill/impacts/Impact100.d.ts +13 -0
  245. package/dist/core/module/battle/skill/impacts/Impact100.js +61 -0
  246. package/dist/core/module/battle/skill/impacts/Impact101.d.ts +13 -0
  247. package/dist/core/module/battle/skill/impacts/Impact101.js +49 -0
  248. package/dist/core/module/battle/skill/impacts/Impact17.d.ts +1 -1
  249. package/dist/core/module/battle/skill/impacts/Impact18.d.ts +1 -1
  250. package/dist/core/module/battle/skill/impacts/Impact19.d.ts +13 -0
  251. package/dist/core/module/battle/skill/impacts/Impact19.js +31 -0
  252. package/dist/core/module/battle/skill/impacts/Impact2.js +1 -1
  253. package/dist/core/module/battle/skill/impacts/Impact3.js +6 -5
  254. package/dist/core/module/battle/skill/impacts/index.d.ts +3 -0
  255. package/dist/core/module/battle/skill/impacts/index.js +4 -1
  256. package/dist/core/module/battle/skill/pool/SkillEmitterPool.js +11 -6
  257. package/dist/core/module/battle/system/BornSystem.js +2 -2
  258. package/dist/core/module/battle/system/BuffSystem.d.ts +8 -5
  259. package/dist/core/module/battle/system/BuffSystem.js +47 -22
  260. package/dist/core/module/battle/system/CollisionSystem.d.ts +4 -0
  261. package/dist/core/module/battle/system/CollisionSystem.js +31 -22
  262. package/dist/core/module/battle/system/DestroySystem.d.ts +6 -0
  263. package/dist/core/module/battle/system/DestroySystem.js +61 -20
  264. package/dist/core/module/battle/system/InputSystem.d.ts +3 -1
  265. package/dist/core/module/battle/system/InputSystem.js +15 -4
  266. package/dist/core/module/battle/system/ProjectileSystem.d.ts +1 -0
  267. package/dist/core/module/battle/system/ProjectileSystem.js +49 -29
  268. package/dist/core/module/battle/system/SkillSystem.d.ts +3 -1
  269. package/dist/core/module/battle/system/SkillSystem.js +55 -25
  270. package/dist/core/module/battle/system/TurnPhaseSystem.d.ts +52 -0
  271. package/dist/core/module/battle/system/TurnPhaseSystem.js +189 -0
  272. package/dist/core/module/battle/system/TurnSchedulerSystem.d.ts +51 -0
  273. package/dist/core/module/battle/system/TurnSchedulerSystem.js +363 -0
  274. package/dist/core/module/battle/target/CloseAngleTargetSelection.js +30 -10
  275. package/dist/core/module/battle/target/CloseDownTargetSelection.js +64 -17
  276. package/dist/core/module/battle/target/CloseTargetSelection.js +22 -5
  277. package/dist/core/module/battle/target/RandomRangeTargetSelection.js +8 -8
  278. package/dist/core/module/battle/target/SelfRandomTargetSelection.js +2 -0
  279. package/dist/core/module/battle/target/SelfRandomTowerTargetSelection.js +0 -1
  280. package/dist/core/module/battle/turn/TurnBattleGame.d.ts +85 -0
  281. package/dist/core/module/battle/turn/TurnBattleGame.js +453 -0
  282. package/dist/core/module/battle/turn/TurnBattleModule.d.ts +14 -0
  283. package/dist/core/module/battle/turn/TurnBattleModule.js +65 -0
  284. package/dist/core/module/battle/turn/TurnBattleTypes.d.ts +25 -0
  285. package/dist/core/module/battle/turn/TurnBattleTypes.js +15 -0
  286. package/dist/core/module/battle/util/BattleInputCodec.d.ts +2 -3
  287. package/dist/core/module/battle/util/BattleInputCodec.js +14 -3
  288. package/dist/core/module/battle/util/BattleUtils.d.ts +21 -1
  289. package/dist/core/module/battle/util/BattleUtils.js +217 -41
  290. package/dist/core/module/battle/util/EllipseArc.d.ts +2 -0
  291. package/dist/core/module/battle/util/EllipseArc.js +43 -0
  292. package/dist/core/module/battle/util/HitDataPool.js +3 -1
  293. package/dist/core/module/battle/util/Random.js +13 -4
  294. package/dist/core/module/dailyTrial/DailyTrialBattleModule.d.ts +11 -0
  295. package/dist/core/module/dailyTrial/DailyTrialBattleModule.js +103 -0
  296. package/dist/core/module/dailyTrial/index.d.ts +1 -0
  297. package/dist/core/module/dailyTrial/index.js +13 -0
  298. package/dist/core/module/guild/view/boss/GuildBossBattleModule.d.ts +2 -1
  299. package/dist/core/module/guild/view/boss/GuildBossBattleModule.js +12 -2
  300. package/dist/core/module/module.interface.d.ts +1 -0
  301. package/dist/core/module/property/Property.d.ts +22 -3
  302. package/dist/core/module/property/Property.js +43 -5
  303. package/dist/core/module/property/PropertyUtil.d.ts +17 -2
  304. package/dist/core/module/property/PropertyUtil.js +67 -7
  305. package/dist/core/module/relicDungeon/RelicBattleModule.d.ts +5 -0
  306. package/dist/core/module/relicDungeon/RelicBattleModule.js +26 -2
  307. package/dist/core/module/stage/StageBattleModule.js +1 -0
  308. package/dist/core/proto/CommonProto.d.ts +24671 -14643
  309. package/dist/core/proto/Proto.d.ts +289 -77
  310. package/dist/index.d.ts +39 -3
  311. package/dist/index.js +220 -13
  312. package/dist/register-all.d.ts +2 -0
  313. package/dist/register-all.js +2 -0
  314. package/package.json +1 -1
@@ -0,0 +1,13 @@
1
+ import { IImpact } from "../../battle.interface";
2
+ import type FighterData from "../../entity/FighterData";
3
+ import type { HitData } from "../../util/HitDataPool";
4
+ import { SkillData } from "../SkillData";
5
+ import { SkillImpact } from "./SkillImpact";
6
+ /**
7
+ * 修改最终伤害浮动,注意,需要监听攻击相关事件有传递hitData才行
8
+ * p1: 浮动最小值万分比
9
+ * p2: 浮动最大值万分比
10
+ */
11
+ export declare class Impact19 extends SkillImpact {
12
+ execute(fighter: FighterData, skillData: SkillData, effectFighters: FighterData[], impactData: IImpact, hitData?: HitData): boolean;
13
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.Impact19 = void 0;
10
+ const ImpactRegistry_1 = require("./ImpactRegistry");
11
+ const SkillImpact_1 = require("./SkillImpact");
12
+ /**
13
+ * 修改最终伤害浮动,注意,需要监听攻击相关事件有传递hitData才行
14
+ * p1: 浮动最小值万分比
15
+ * p2: 浮动最大值万分比
16
+ */
17
+ let Impact19 = class Impact19 extends SkillImpact_1.SkillImpact {
18
+ execute(fighter, skillData, effectFighters, impactData, hitData) {
19
+ const min = impactData.p1;
20
+ const max = impactData.p2;
21
+ const random = fighter.game.randomRange(min, max);
22
+ if (hitData) {
23
+ hitData.hurt = Math.ceil(hitData.hurt * (random / 10000));
24
+ }
25
+ return true;
26
+ }
27
+ };
28
+ exports.Impact19 = Impact19;
29
+ exports.Impact19 = Impact19 = __decorate([
30
+ (0, ImpactRegistry_1.registerImpact)(19)
31
+ ], Impact19);
@@ -31,7 +31,7 @@ let Impact2 = class Impact2 extends SkillImpact_1.SkillImpact {
31
31
  for (let i = 0; i < fighters.length; i++) {
32
32
  let fighter = fighters[i];
33
33
  let curbuff = Cfg_1.Cfg.Buff.get(impactData.p1);
34
- let buffPer = impactData.p2 || 10000;
34
+ let buffPer = typeof impactData.p2 === 'number' ? impactData.p2 : 10000;
35
35
  let hit = true;
36
36
  if (impactData.belong && impactData.belong !== fighter.cfg.id)
37
37
  continue;
@@ -95,7 +95,8 @@ let Impact3 = class Impact3 extends SkillImpact_1.SkillImpact {
95
95
  let emitterType = impactData.value || 0;
96
96
  let delta = impactData.p7 || 0;
97
97
  let angle = impactData.p8 || 0;
98
- let delayTime = impactData.time || 0;
98
+ let projectileDelayTime = impactData.projectileTime || 0;
99
+ let bornDelayTime = impactData.time || 0;
99
100
  let atkDir = skillData.atkDir;
100
101
  let effectCfg = Cfg_1.Cfg.EffectPath.get(impactData.effectId);
101
102
  let collision = effectCfg?.Collision || [0, 40, 40];
@@ -108,7 +109,7 @@ let Impact3 = class Impact3 extends SkillImpact_1.SkillImpact {
108
109
  let impact = (0, SkillImpact_1.appendImpactPath)(this.impactPath, SkillImpact_1.SUB_IMPACT);
109
110
  let impact2 = impactData.subImpact2 ? (0, SkillImpact_1.appendImpactPath)(this.impactPath, SkillImpact_1.SUB_IMPACT2) : undefined;
110
111
  let impact3 = impactData.subImpact3 ? (0, SkillImpact_1.appendImpactPath)(this.impactPath, SkillImpact_1.SUB_IMPACT3) : undefined;
111
- let bornDelayTime = delayTime * (index + 1);
112
+ let bornTime = bornDelayTime + projectileDelayTime * (index + 1);
112
113
  let pro = EntityPool_1.EntityPool.spawn("ProjectileData");
113
114
  pro.game = owner.game;
114
115
  pro.owner = owner.ID;
@@ -139,7 +140,7 @@ let Impact3 = class Impact3 extends SkillImpact_1.SkillImpact {
139
140
  pro.scaleX = Property_1.PropertyHelper.scaleProjectile(impactData.effectScale || 1, owner.property) * parentEffectScale;
140
141
  pro.scaleY = Property_1.PropertyHelper.scaleProjectile(impactData.effectScaleY || impactData.effectScale || 1, owner.property) * parentEffectScale;
141
142
  pro.originScale = pro.scaleY;
142
- pro.delayBornTime = bornDelayTime;
143
+ pro.delayBornTime = bornTime;
143
144
  this.parseHitContext(owner, pro, hurtData);
144
145
  owner.game.addProjectile(pro);
145
146
  owner.hasProjectileNum++;
@@ -200,7 +201,7 @@ let Impact3 = class Impact3 extends SkillImpact_1.SkillImpact {
200
201
  pro.emitter.shootDir.y = SkillImpactShared_1.tempVec2.y;
201
202
  pro.emitter.offsetDegress = offsetdegress;
202
203
  pro.emitter.attackRange = Property_1.PropertyHelper.attackDis(skillData.cfg.skillArea && skillData.cfg.skillArea[1] || 9999, owner.property);
203
- let f = (0, BattleUtils_1.getClassByName)(pro.emitter.emitterName);
204
+ let f = pro.emitter.emitterClass;
204
205
  if (f) {
205
206
  f.execute(pro, fighter, impactData.p9, impactData.p10, impactData.p11);
206
207
  }
@@ -215,7 +216,7 @@ let Impact3 = class Impact3 extends SkillImpact_1.SkillImpact {
215
216
  pro.shape.isActive = false;
216
217
  }
217
218
  if (skillData.isNormalAttack) {
218
- pro.skillNumIndex = skillData.allSkillNum - skillData.skillNum;
219
+ pro.skillNumIndex = Math.max(0, skillData.allSkillNum - skillData.skillNum - 1);
219
220
  }
220
221
  else {
221
222
  pro.skillNumIndex = 0;
@@ -1,6 +1,8 @@
1
1
  import "./Impact0";
2
2
  import "./Impact1";
3
3
  import "./Impact10";
4
+ import "./Impact100";
5
+ import "./Impact101";
4
6
  import "./Impact11";
5
7
  import "./Impact12";
6
8
  import "./Impact13";
@@ -9,6 +11,7 @@ import "./Impact15";
9
11
  import "./Impact16";
10
12
  import "./Impact17";
11
13
  import "./Impact18";
14
+ import "./Impact19";
12
15
  import "./Impact2";
13
16
  import "./Impact3";
14
17
  import "./Impact4";
@@ -8,11 +8,13 @@
8
8
  // Cocos 的资源系统会把 assets 下所有脚本加载一遍,所以引擎里天然成立;
9
9
  // Node 只执行从入口 import 可达的模块,不引这一下,注册表就是空的。
10
10
  //
11
- // 共 23 个模块。下面的 import 只为副作用,不需要用到导出。
11
+ // 共 26 个模块。下面的 import 只为副作用,不需要用到导出。
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  require("./Impact0");
14
14
  require("./Impact1");
15
15
  require("./Impact10");
16
+ require("./Impact100");
17
+ require("./Impact101");
16
18
  require("./Impact11");
17
19
  require("./Impact12");
18
20
  require("./Impact13");
@@ -21,6 +23,7 @@ require("./Impact15");
21
23
  require("./Impact16");
22
24
  require("./Impact17");
23
25
  require("./Impact18");
26
+ require("./Impact19");
24
27
  require("./Impact2");
25
28
  require("./Impact3");
26
29
  require("./Impact4");
@@ -15,16 +15,21 @@ class _SkillEmitterPool {
15
15
  this._pool[item.emitterName].push(item);
16
16
  }
17
17
  spawn(id) {
18
- if (!this._pool[id]) {
19
- this._pool[id] = new ObjectPool_1.ObjectPool(() => {
20
- const emitter = (0, BattleUtils_1.getClassByName)(id);
21
- if (!emitter) {
18
+ let pool = this._pool[id];
19
+ if (!pool) {
20
+ pool = this._pool[id] = new ObjectPool_1.ObjectPool(() => {
21
+ const emitterClass = (0, BattleUtils_1.getClassByName)(id);
22
+ if (!emitterClass) {
22
23
  throw new Error(`SkillEmitterPool spawn emitter not found: ${id}`);
23
24
  }
24
- return emitter.getData();
25
+ const emitter = emitterClass.getData();
26
+ // 实例与 emitterName 一一对应,类只在创建时解析一次:
27
+ // 每帧的 onUpdate / 每次命中的 hit 都直接用实例上的引用,不再做字符串查表
28
+ emitter.emitterClass = emitterClass;
29
+ return emitter;
25
30
  });
26
31
  }
27
- return this._pool[id].pop();
32
+ return pool.pop();
28
33
  }
29
34
  }
30
35
  exports.SkillEmitterPool = new _SkillEmitterPool();
@@ -358,7 +358,7 @@ class BornSystem extends GameSystem_1.GameSystem {
358
358
  this.fighterBorn(fighter);
359
359
  }
360
360
  if (isfinish) {
361
- gameContext.waitBornInfo.splice(i, 1);
361
+ BattleUtils_1.BattleUtils.removeAt(gameContext.waitBornInfo, i);
362
362
  }
363
363
  }
364
364
  for (let i = gameContext.waitCreateFighterInfo.length - 1; i >= 0; i--) {
@@ -397,7 +397,7 @@ class BornSystem extends GameSystem_1.GameSystem {
397
397
  //记录自杀倒计时,由 judeKillSelfTime 统一处理
398
398
  gameContext.waitKillSelfList.push({ entityId: fighter.ID, killTime: info.killTime });
399
399
  }
400
- gameContext.waitCreateFighterInfo.splice(i, 1);
400
+ BattleUtils_1.BattleUtils.removeAt(gameContext.waitCreateFighterInfo, i);
401
401
  }
402
402
  }
403
403
  }
@@ -8,7 +8,8 @@ export default class BuffSystem extends GameSystem {
8
8
  init(): void;
9
9
  onDestroy(): void;
10
10
  onUpdate(dt: number): void;
11
- enter(entity: FighterData, buff: Buff.BuffItem): void;
11
+ updateBuffs(dt: number): void;
12
+ enter(entity: FighterData, buff: Buff.BuffItem): boolean;
12
13
  execute(entity: FighterData, buff: Buff.BuffItem, dt: number): any;
13
14
  exit(entity: FighterData, buff: Buff.BuffItem): void;
14
15
  private addBuffEffect;
@@ -19,10 +20,6 @@ export default class BuffSystem extends GameSystem {
19
20
  * @return {*}
20
21
  */
21
22
  fliterBuffTag(fighter: FighterData, buffTag: number): number[];
22
- /**
23
- * 事件入口:EventListener 会把事件 id 追加在参数末尾,这里先丢弃再转发,
24
- * 避免它顶掉 clearBuffByType 的默认参数(例如只传 2 个参数时会把事件 id 当成 hasTime)。
25
- */
26
23
  clearBuffByType(fighter: FighterData, type?: number, hasTime?: boolean, fromSkillId?: number): void;
27
24
  clearByBuff(fighter: FighterData, buff: Buff.BuffItem): void;
28
25
  getBuffsValueByType(fighter: FighterData, type: number): number;
@@ -32,4 +29,10 @@ export default class BuffSystem extends GameSystem {
32
29
  private _initBuffItem;
33
30
  trigger(entity: FighterData, param: any | HitData, param2: any): void;
34
31
  private registerTrigger;
32
+ /**
33
+ * 快照恢复后重挂实体全部 buff 触发器:
34
+ * 回滚窗口内进入/退出的 buff 会留下过期注册(isUseCount 下重复注册会叠加计数),
35
+ * 必须先按 context 整体清掉本系统在该实体上的注册,再按恢复后的 buff 列表重挂。
36
+ */
37
+ restoreBuffTriggers(fighter: FighterData): void;
35
38
  }
@@ -14,6 +14,7 @@ const BuffTrigger_1 = require("../buff/BuffTrigger");
14
14
  const EntityEvent_1 = require("../event/EntityEvent");
15
15
  const EventBind_1 = require("../event/EventBind");
16
16
  const GameEvent_1 = require("../event/GameEvent");
17
+ const BattleUtils_1 = require("../util/BattleUtils");
17
18
  const GameSystem_1 = require("./GameSystem");
18
19
  class BuffSystem extends GameSystem_1.GameSystem {
19
20
  name = "BuffSystem";
@@ -26,6 +27,13 @@ class BuffSystem extends GameSystem_1.GameSystem {
26
27
  (0, EventBind_1.bindGameEvents)(this, this.game, false);
27
28
  }
28
29
  onUpdate(dt) {
30
+ if (this.game.gameModule.moduleState.isTurn) {
31
+ //回合制的回合结束主动调用一次
32
+ return;
33
+ }
34
+ this.updateBuffs(dt);
35
+ }
36
+ updateBuffs(dt) {
29
37
  const fighters = this.game.gameContext.fighters;
30
38
  for (let i = 0; i < fighters.length; i++) {
31
39
  let fighter = fighters[i];
@@ -37,8 +45,7 @@ class BuffSystem extends GameSystem_1.GameSystem {
37
45
  let boo = this.execute(fighter, buffs[i], dt);
38
46
  if (!boo) {
39
47
  this.exit(fighter, buffs[i]);
40
- let buff = buffs.splice(i, 1);
41
- BuffPool_1.BuffPool.despawn(buff[0]);
48
+ BuffPool_1.BuffPool.despawn(BattleUtils_1.BattleUtils.removeAt(buffs, i));
42
49
  }
43
50
  }
44
51
  }
@@ -50,16 +57,17 @@ class BuffSystem extends GameSystem_1.GameSystem {
50
57
  let func = BuffMgr_1.Buff.bufferCache[buff.buffTypeId];
51
58
  if (!func) {
52
59
  console.log('buff func is null', buff.buffTypeId);
60
+ return false;
53
61
  }
54
62
  func.layerChange(entity, buff, buff.buffLayer + 1);
55
63
  let casterer = entity.game.getEntityLogic(buff.caster);
56
64
  if (casterer) {
57
- casterer.game.emit(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff });
65
+ casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff });
58
66
  }
59
67
  if (buff.triggerType && buff.triggerType.length > 0) {
60
68
  this.registerTrigger(entity, buff.triggerType, true);
61
69
  }
62
- entity.game.emit(entity, EntityEvent_1.EntityEvent.BuffTrigger, buff.buffTypeId);
70
+ entity.game.emit1(entity, EntityEvent_1.EntityEvent.BuffTrigger, buff.buffTypeId);
63
71
  if (entity.game.gameModule.moduleState.showEffect && (buff.buffTime < 0 || buff.buffTime >= 0.1)) {
64
72
  if (cfg.buffEffectPath && cfg.buffEffectPath.length) {
65
73
  for (let i = 0, len = cfg.buffEffectPath.length; i < len; i++) {
@@ -85,7 +93,7 @@ class BuffSystem extends GameSystem_1.GameSystem {
85
93
  if (buff.triggerType && buff.triggerType.length > 0) {
86
94
  this.registerTrigger(entity, buff.triggerType, false);
87
95
  }
88
- entity.game.emit(entity, EntityEvent_1.EntityEvent.BuffExit, buff.buffTypeId);
96
+ entity.game.emit1(entity, EntityEvent_1.EntityEvent.BuffExit, buff.buffTypeId);
89
97
  if (entity.game.gameModule.moduleState.showEffect && (buff.buffTime < 0 || buff.buffTime >= 0.1)) {
90
98
  if (cfg.buffEffectPath && cfg.buffEffectPath.length) {
91
99
  for (let i = 0, len = cfg.buffEffectPath.length; i < len; i++) {
@@ -119,7 +127,8 @@ class BuffSystem extends GameSystem_1.GameSystem {
119
127
  if (effectitem) {
120
128
  effectitem.count--;
121
129
  if (effectitem.count <= 0) {
122
- // delete this.mgr.buffEffectMap[effectPath];
130
+ // 不能在这里 delete:FighterRender.updateBuffEffect 靠这条 count=0 的记录找到挂点
131
+ // 并回收特效节点,回收完成后由渲染层删除该 key。逻辑层只负责计数。
123
132
  }
124
133
  }
125
134
  }
@@ -141,10 +150,6 @@ class BuffSystem extends GameSystem_1.GameSystem {
141
150
  }
142
151
  return bufftype;
143
152
  }
144
- /**
145
- * 事件入口:EventListener 会把事件 id 追加在参数末尾,这里先丢弃再转发,
146
- * 避免它顶掉 clearBuffByType 的默认参数(例如只传 2 个参数时会把事件 id 当成 hasTime)。
147
- */
148
153
  clearBuffByType(fighter, type = 0, hasTime = false, fromSkillId) {
149
154
  if (type == 0) { //清空所有buff
150
155
  for (let k in fighter.buffList) {
@@ -152,8 +157,7 @@ class BuffSystem extends GameSystem_1.GameSystem {
152
157
  if (buffs && buffs.length) {
153
158
  for (let i = buffs.length - 1; i >= 0; i--) {
154
159
  this.exit(fighter, buffs[i]);
155
- let buff = buffs.splice(i, 1);
156
- BuffPool_1.BuffPool.despawn(buff[0]);
160
+ BuffPool_1.BuffPool.despawn(BattleUtils_1.BattleUtils.removeAt(buffs, i));
157
161
  }
158
162
  }
159
163
  }
@@ -169,8 +173,7 @@ class BuffSystem extends GameSystem_1.GameSystem {
169
173
  if (fromSkillId && buffs[i].skillId != fromSkillId)
170
174
  continue;
171
175
  this.exit(fighter, buffs[i]);
172
- let buff = buffs.splice(i, 1);
173
- BuffPool_1.BuffPool.despawn(buff[0]);
176
+ BuffPool_1.BuffPool.despawn(BattleUtils_1.BattleUtils.removeAt(buffs, i));
174
177
  }
175
178
  }
176
179
  if (fighter.buffList[type].length == 0) {
@@ -187,8 +190,7 @@ class BuffSystem extends GameSystem_1.GameSystem {
187
190
  for (let i = buffs.length - 1; i >= 0; i--) {
188
191
  if (buff === buffs[i]) {
189
192
  this.exit(fighter, buffs[i]);
190
- let buff = buffs.splice(i, 1);
191
- BuffPool_1.BuffPool.despawn(buff[0]);
193
+ BuffPool_1.BuffPool.despawn(BattleUtils_1.BattleUtils.removeAt(buffs, i));
192
194
  break;
193
195
  }
194
196
  }
@@ -266,7 +268,7 @@ class BuffSystem extends GameSystem_1.GameSystem {
266
268
  if (buff.caster === param.caster) {
267
269
  isfindSame = true;
268
270
  if (buffCfg.sameMergeType === 2) { //相同或者释放者是由同一个buff造成的
269
- buffs.splice(i, 1);
271
+ BattleUtils_1.BattleUtils.removeAt(buffs, i);
270
272
  this.exit(entity, buff);
271
273
  BuffPool_1.BuffPool.despawn(buff);
272
274
  break;
@@ -288,8 +290,9 @@ class BuffSystem extends GameSystem_1.GameSystem {
288
290
  func.layerChange(entity, buff, buff.buffLayer + 1);
289
291
  let casterer = entity.game.getEntityLogic(buff.caster);
290
292
  if (casterer) {
291
- casterer.game.emit(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff });
292
- casterer.game.emit(casterer, EntityEvent_1.EntityEvent.BuffLayerNumRatio, { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff });
293
+ const args = { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff };
294
+ casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, args);
295
+ casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNumRatio, args);
293
296
  }
294
297
  if (entity.game.gameModule.moduleState.showEffect && (buff.buffTime < 0 || buff.buffTime >= 0.1)) {
295
298
  if (buffCfg.buffEffectPath && buffCfg.buffEffectPath.length) {
@@ -318,7 +321,7 @@ class BuffSystem extends GameSystem_1.GameSystem {
318
321
  let buff = buffs[i]; //只需要检查第一个即可
319
322
  if (buffCfg.diffMergeType == 2) {
320
323
  if (buff && buff.caster != null && buff.caster != param.caster) {
321
- buffs.splice(i, 1);
324
+ BattleUtils_1.BattleUtils.removeAt(buffs, i);
322
325
  this.exit(entity, buff);
323
326
  BuffPool_1.BuffPool.despawn(buff);
324
327
  }
@@ -336,14 +339,14 @@ class BuffSystem extends GameSystem_1.GameSystem {
336
339
  func.layerChange(entity, buff, buff.buffLayer + 1);
337
340
  let casterer = entity.game.getEntityLogic(buff.caster);
338
341
  if (casterer) {
339
- casterer.game.emit(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff });
342
+ casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff });
340
343
  }
341
344
  }
342
345
  else {
343
346
  buff.buffLayer += 1;
344
347
  let casterer = entity.game.getEntityLogic(buff.caster);
345
348
  if (casterer) {
346
- casterer.game.emit(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff });
349
+ casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff });
347
350
  }
348
351
  }
349
352
  if (entity.game.gameModule.moduleState.showEffect && (buff.buffTime < 0 || buff.buffTime >= 0.1)) {
@@ -421,11 +424,33 @@ class BuffSystem extends GameSystem_1.GameSystem {
421
424
  entity.game.off(entity.ID, type[0], this.trigger, this);
422
425
  }
423
426
  }
427
+ /**
428
+ * 快照恢复后重挂实体全部 buff 触发器:
429
+ * 回滚窗口内进入/退出的 buff 会留下过期注册(isUseCount 下重复注册会叠加计数),
430
+ * 必须先按 context 整体清掉本系统在该实体上的注册,再按恢复后的 buff 列表重挂。
431
+ */
432
+ restoreBuffTriggers(fighter) {
433
+ this.game.gameContext.entityEvents.targetOff(fighter.ID, this);
434
+ for (let k in fighter.buffList) {
435
+ let buffs = fighter.buffList[k];
436
+ if (buffs && buffs.length) {
437
+ for (let i = 0; i < buffs.length; i++) {
438
+ this.registerTrigger(fighter, buffs[i].triggerType, true);
439
+ }
440
+ }
441
+ }
442
+ }
424
443
  }
425
444
  exports.default = BuffSystem;
445
+ __decorate([
446
+ (0, EventBind_1.GameEventListener)(GameEvent_1.GameEvent.StepBuff)
447
+ ], BuffSystem.prototype, "updateBuffs", null);
426
448
  __decorate([
427
449
  (0, EventBind_1.GameEventListener)(GameEvent_1.GameEvent.BuffClearByType)
428
450
  ], BuffSystem.prototype, "clearBuffByType", null);
429
451
  __decorate([
430
452
  (0, EventBind_1.GameEventCall)(GameEvent_1.GameEvent.BuffAddBuff)
431
453
  ], BuffSystem.prototype, "addBuff", null);
454
+ __decorate([
455
+ (0, EventBind_1.GameEventListener)(GameEvent_1.GameEvent.BuffRestoreTriggers)
456
+ ], BuffSystem.prototype, "restoreBuffTriggers", null);
@@ -70,7 +70,11 @@ export default class CollisionSystem extends GameSystem {
70
70
  * narrow-phase / 配对状态机 / 碰撞组过滤 / worldAABB 更新全部复用。
71
71
  */
72
72
  oneTestSap(game: Game, dt: number): void;
73
+ /** forEach 回调无法携带局部变量,sweep 期间经成员传递当前帧 id */
74
+ private _sweepFrameId;
73
75
  private endTrigger;
76
+ /** 标记本帧未命中的遗留碰撞对,补发 onExit(语义与旧 for...in 版本一致) */
77
+ private _markExitPairs;
74
78
  private _doCollide;
75
79
  onCollisionEnter(entity1: BaseEntityData, entity2: BaseEntityData): void;
76
80
  onCollisionStay(_entity1: BaseEntityData, _entity2: BaseEntityData): void;
@@ -16,6 +16,7 @@ const GameSystem_1 = require("./GameSystem");
16
16
  let _x = 0.0;
17
17
  let _y = 0.0;
18
18
  const tempArray = [];
19
+ const tempDelete = [];
19
20
  function transformMat4(out, a, mat) {
20
21
  _x = a.x;
21
22
  _y = a.y;
@@ -226,6 +227,7 @@ class CollisionSystem extends GameSystem_1.GameSystem {
226
227
  clearMgr() {
227
228
  tempArr.length = 0;
228
229
  tempArray.length = 0;
230
+ tempDelete.length = 0;
229
231
  this._tree.clear();
230
232
  }
231
233
  removeCollider(collider) {
@@ -390,7 +392,7 @@ class CollisionSystem extends GameSystem_1.GameSystem {
390
392
  }
391
393
  id = (aid * (aid + 1) >> 1) + bid - 1; //NOTE: 康拓配对函数
392
394
  let pairs = game.gameContext.collisionPairs;
393
- let data = pairs[id];
395
+ let data = pairs.get(id);
394
396
  if (data !== undefined) {
395
397
  data.frameId = game.gameContext.collisionFrameId;
396
398
  data.state = CollisionType.onStay;
@@ -403,7 +405,7 @@ class CollisionSystem extends GameSystem_1.GameSystem {
403
405
  frameId: game.gameContext.collisionFrameId,
404
406
  state: CollisionType.onEnter,
405
407
  };
406
- pairs[id] = data;
408
+ pairs.set(id, data);
407
409
  }
408
410
  this._doCollide(icollider, jcollider, data.state);
409
411
  }
@@ -456,7 +458,7 @@ class CollisionSystem extends GameSystem_1.GameSystem {
456
458
  }
457
459
  id = (aid * (aid + 1) >> 1) + bid - 1; //NOTE: 康拓配对函数
458
460
  let pairs = game.gameContext.collisionPairs;
459
- let data = pairs[id];
461
+ let data = pairs.get(id);
460
462
  if (data !== undefined) {
461
463
  data.frameId = game.gameContext.collisionFrameId;
462
464
  data.state = CollisionType.onStay;
@@ -469,7 +471,7 @@ class CollisionSystem extends GameSystem_1.GameSystem {
469
471
  frameId: game.gameContext.collisionFrameId,
470
472
  state: CollisionType.onEnter,
471
473
  };
472
- pairs[id] = data;
474
+ pairs.set(id, data);
473
475
  }
474
476
  this._doCollide(icollider, jcollider, data.state);
475
477
  }
@@ -566,7 +568,7 @@ class CollisionSystem extends GameSystem_1.GameSystem {
566
568
  }
567
569
  id = (aid * (aid + 1) >> 1) + bid - 1;
568
570
  const pairs = game.gameContext.collisionPairs;
569
- let data = pairs[id];
571
+ let data = pairs.get(id);
570
572
  if (data !== undefined) {
571
573
  data.frameId = game.gameContext.collisionFrameId;
572
574
  data.state = CollisionType.onStay;
@@ -579,7 +581,7 @@ class CollisionSystem extends GameSystem_1.GameSystem {
579
581
  frameId: game.gameContext.collisionFrameId,
580
582
  state: CollisionType.onEnter,
581
583
  };
582
- pairs[id] = data;
584
+ pairs.set(id, data);
583
585
  }
584
586
  this._doCollide(icollider, jcollider, data.state);
585
587
  }
@@ -588,26 +590,33 @@ class CollisionSystem extends GameSystem_1.GameSystem {
588
590
  // ⑤ N<2 也必须跑 endTrigger:对遗留 collisionPairs 补发 onExit,避免泄漏
589
591
  this.endTrigger(game);
590
592
  }
593
+ /** forEach 回调无法携带局部变量,sweep 期间经成员传递当前帧 id */
594
+ _sweepFrameId = 0;
591
595
  endTrigger(game) {
592
- let deletes = [];
596
+ tempDelete.length = 0;
593
597
  let pairs = game.gameContext.collisionPairs;
594
- let frameId = game.gameContext.collisionFrameId;
595
- for (let key in pairs) {
596
- let value = pairs[key];
597
- tempArray.length = 0;
598
- game.getColliderEntity(value.colliderA, value.colliderB, tempArray);
599
- let icollider = tempArray[0];
600
- let jcollider = tempArray[1];
601
- if (value.frameId != frameId || icollider.isDead || jcollider.isDead || !icollider.shape.isActive || !jcollider.shape.isActive) {
602
- this._doCollide(icollider, jcollider, CollisionType.onExit);
603
- deletes.push(value.id);
604
- }
598
+ this._sweepFrameId = game.gameContext.collisionFrameId;
599
+ // forEach + 成员回调:零闭包分配,替代旧 for...in 的字符串键迭代
600
+ pairs.forEach(this._markExitPairs, this);
601
+ for (let i = tempDelete.length - 1; i >= 0; i--) {
602
+ pairs.delete(tempDelete[i]);
603
+ }
604
+ }
605
+ /** 标记本帧未命中的遗留碰撞对,补发 onExit(语义与旧 for...in 版本一致) */
606
+ _markExitPairs(value) {
607
+ tempArray.length = 0;
608
+ this.game.getColliderEntity(value.colliderA, value.colliderB, tempArray);
609
+ const icollider = tempArray[0];
610
+ const jcollider = tempArray[1];
611
+ // 任一端已从实体表移除(同帧死亡并被回收)时补发不了 onExit,直接丢弃该配对,避免读悬空引用
612
+ if (!icollider || !jcollider) {
613
+ tempDelete.push(value.id);
614
+ return;
605
615
  }
606
- let length = deletes.length - 1;
607
- while (length >= 0) {
608
- delete pairs[deletes[length--]];
616
+ if (value.frameId != this._sweepFrameId || icollider.isDead || jcollider.isDead || !icollider.shape.isActive || !jcollider.shape.isActive) {
617
+ this._doCollide(icollider, jcollider, CollisionType.onExit);
618
+ tempDelete.push(value.id);
609
619
  }
610
- deletes.length = 0;
611
620
  }
612
621
  _doCollide(collider1, collider2, type) {
613
622
  collider1.shape.debugHitState = type === CollisionType.onExit ? 0 : 1;
@@ -8,6 +8,12 @@ export default class DestroySystem extends GameSystem {
8
8
  init(): void;
9
9
  pushToDestroyList(obj: BaseEntityData): void;
10
10
  onUpdate(dt: number): void;
11
+ /**
12
+ * 在按 ID 升序排列的实体数组中二分定位,找不到返回 -1。
13
+ * fighters/projectiles 的 ID 来自同一个自增计数器且只做尾部追加,
14
+ * 与 Game.getEntityLogic 的二分查找依赖同一个有序前提。
15
+ */
16
+ private indexOfEntityById;
11
17
  removeEntity(obj: IWaitDestroyData): boolean;
12
18
  onDestroy(): void;
13
19
  }