@playcraft/skills 0.0.2

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 (479) hide show
  1. package/README.md +333 -0
  2. package/dist/src/index.d.ts +3 -0
  3. package/dist/src/index.d.ts.map +1 -0
  4. package/dist/src/index.js +2 -0
  5. package/dist/src/index.js.map +1 -0
  6. package/dist/src/skills.loader.d.ts +31 -0
  7. package/dist/src/skills.loader.d.ts.map +1 -0
  8. package/dist/src/skills.loader.js +200 -0
  9. package/dist/src/skills.loader.js.map +1 -0
  10. package/dist/src/skills.types.d.ts +44 -0
  11. package/dist/src/skills.types.d.ts.map +1 -0
  12. package/dist/src/skills.types.js +9 -0
  13. package/dist/src/skills.types.js.map +1 -0
  14. package/package.json +35 -0
  15. package/skills/2048_core.aigameplay/SKILL.md +123 -0
  16. package/skills/2048_core.aigameplay/manifest.json +159 -0
  17. package/skills/2048_core.aigameplay/ref/pgs-schema.json +194 -0
  18. package/skills/2048_core.aigameplay/ref/reducer.template.ts +189 -0
  19. package/skills/SKILL.md +46 -0
  20. package/skills/ad_compliance_rules.aiconfig/SKILL.md +85 -0
  21. package/skills/ad_compliance_rules.aiconfig/manifest.json +60 -0
  22. package/skills/agent_remix_orchestrator.aicomponent/SKILL.md +257 -0
  23. package/skills/agent_remix_orchestrator.aicomponent/manifest.json +12 -0
  24. package/skills/app_metadata.aiconfig/SKILL.md +53 -0
  25. package/skills/app_metadata.aiconfig/manifest.json +32 -0
  26. package/skills/appear_sfx.aiaudio/SKILL.md +59 -0
  27. package/skills/appear_sfx.aiaudio/manifest.json +45 -0
  28. package/skills/appear_sfx.aiaudio/ref/appear.mp3 +0 -0
  29. package/skills/arrow_move_error_sfx.aiaudio/SKILL.md +59 -0
  30. package/skills/arrow_move_error_sfx.aiaudio/manifest.json +45 -0
  31. package/skills/arrow_move_error_sfx.aiaudio/ref/arrow_move_error.mp3 +0 -0
  32. package/skills/arrow_path_data_format.aicomponent/SKILL.md +152 -0
  33. package/skills/arrow_path_data_format.aicomponent/manifest.json +57 -0
  34. package/skills/arrow_path_data_format.aicomponent/ref/LevelParser.ts +188 -0
  35. package/skills/arrow_path_data_format.aicomponent/ref/LevelTypes.ts +131 -0
  36. package/skills/arrow_pick_match_rules.aigameplay/SKILL.md +117 -0
  37. package/skills/arrow_pick_match_rules.aigameplay/manifest.json +105 -0
  38. package/skills/arrow_pick_match_rules.aigameplay/ref/pgs-schema.json +180 -0
  39. package/skills/asset_pipeline_scripts.aicomponent/SKILL.md +117 -0
  40. package/skills/asset_pipeline_scripts.aicomponent/manifest.json +17 -0
  41. package/skills/asset_pipeline_scripts.aicomponent/ref/gen-sprite.sh +105 -0
  42. package/skills/ball_sort.aigameplay/SKILL.md +109 -0
  43. package/skills/ball_sort.aigameplay/manifest.json +155 -0
  44. package/skills/ball_sort.aigameplay/ref/pgs-schema.json +192 -0
  45. package/skills/ball_sort.aigameplay/ref/reducer.template.ts +156 -0
  46. package/skills/basketball_shot.aigameplay/SKILL.md +94 -0
  47. package/skills/basketball_shot.aigameplay/manifest.json +150 -0
  48. package/skills/basketball_shot.aigameplay/ref/pgs-schema.json +229 -0
  49. package/skills/basketball_shot.aigameplay/ref/reducer.template.ts +189 -0
  50. package/skills/bg_music.aiaudio/SKILL.md +61 -0
  51. package/skills/bg_music.aiaudio/manifest.json +48 -0
  52. package/skills/bg_music.aiaudio/ref/bg.mp3 +0 -0
  53. package/skills/big_watermelon.aigameplay/SKILL.md +94 -0
  54. package/skills/big_watermelon.aigameplay/manifest.json +155 -0
  55. package/skills/big_watermelon.aigameplay/ref/pgs-schema.json +191 -0
  56. package/skills/big_watermelon.aigameplay/ref/reducer.template.ts +202 -0
  57. package/skills/block_puzzle.aigameplay/SKILL.md +121 -0
  58. package/skills/block_puzzle.aigameplay/manifest.json +154 -0
  59. package/skills/block_puzzle.aigameplay/ref/pgs-schema.json +170 -0
  60. package/skills/block_puzzle.aigameplay/ref/reducer.template.ts +182 -0
  61. package/skills/board_entity_sprite.aiimage/SKILL.md +255 -0
  62. package/skills/board_entity_sprite.aiimage/manifest.json +153 -0
  63. package/skills/board_entity_sprite.aiimage/ref/ProceduralCar.ts +357 -0
  64. package/skills/board_entity_sprite.aiimage/ref/car.png +0 -0
  65. package/skills/board_entity_sprite.aiimage/ref/car.webp +0 -0
  66. package/skills/bottom_ui_bar.aicomponent/SKILL.md +50 -0
  67. package/skills/bottom_ui_bar.aicomponent/manifest.json +31 -0
  68. package/skills/bottom_ui_bar.aicomponent/ref/GameBottomUI.ts +27 -0
  69. package/skills/bubble_shooter.aigameplay/SKILL.md +129 -0
  70. package/skills/bubble_shooter.aigameplay/manifest.json +181 -0
  71. package/skills/bubble_shooter.aigameplay/ref/pgs-schema.json +226 -0
  72. package/skills/bubble_shooter.aigameplay/ref/reducer.template.ts +228 -0
  73. package/skills/button_click_sfx.aiaudio/SKILL.md +59 -0
  74. package/skills/button_click_sfx.aiaudio/manifest.json +45 -0
  75. package/skills/button_click_sfx.aiaudio/ref/button_click.mp3 +0 -0
  76. package/skills/calm_piano.aiaudio/SKILL.md +68 -0
  77. package/skills/calm_piano.aiaudio/manifest.json +50 -0
  78. package/skills/camera_controller_3d.aicomponent/SKILL.md +100 -0
  79. package/skills/camera_controller_3d.aicomponent/manifest.json +52 -0
  80. package/skills/camera_controller_3d.aicomponent/ref/CameraController.ts +199 -0
  81. package/skills/camera_controller_3d.aicomponent/ref/OrbitControlsAdapter.ts +152 -0
  82. package/skills/candy_tile.aiimage/SKILL.md +62 -0
  83. package/skills/candy_tile.aiimage/manifest.json +49 -0
  84. package/skills/car_parking.aigameplay/SKILL.md +105 -0
  85. package/skills/car_parking.aigameplay/manifest.json +164 -0
  86. package/skills/car_parking.aigameplay/ref/pgs-schema.json +163 -0
  87. package/skills/car_parking.aigameplay/ref/reducer.template.ts +166 -0
  88. package/skills/castle.aiimage/SKILL.md +64 -0
  89. package/skills/castle.aiimage/manifest.json +48 -0
  90. package/skills/cheerful_ukulele.aiaudio/SKILL.md +72 -0
  91. package/skills/cheerful_ukulele.aiaudio/manifest.json +50 -0
  92. package/skills/click_sfx.aiaudio/SKILL.md +59 -0
  93. package/skills/click_sfx.aiaudio/manifest.json +45 -0
  94. package/skills/click_sfx.aiaudio/ref/click.mp3 +0 -0
  95. package/skills/combo_display.aicomponent/SKILL.md +45 -0
  96. package/skills/combo_display.aicomponent/manifest.json +31 -0
  97. package/skills/combo_display.aicomponent/ref/ComboManager.ts +362 -0
  98. package/skills/combo_display.aicomponent/ref/ComboSmallUI.ts +232 -0
  99. package/skills/combo_praise_text.aicomponent/SKILL.md +56 -0
  100. package/skills/combo_praise_text.aicomponent/manifest.json +34 -0
  101. package/skills/combo_praise_text.aicomponent/ref/ComboManager.ts +362 -0
  102. package/skills/countdown_timer.aicomponent/SKILL.md +44 -0
  103. package/skills/countdown_timer.aicomponent/manifest.json +35 -0
  104. package/skills/countdown_timer.aicomponent/ref/CountdownDisplay.ts +213 -0
  105. package/skills/cta_platform_config.aiconfig/SKILL.md +72 -0
  106. package/skills/cta_platform_config.aiconfig/manifest.json +56 -0
  107. package/skills/debug_overlay.aicomponent/SKILL.md +75 -0
  108. package/skills/debug_overlay.aicomponent/manifest.json +17 -0
  109. package/skills/debug_overlay.aicomponent/ref/DebugOverlay.ts +144 -0
  110. package/skills/desert.aiimage/SKILL.md +63 -0
  111. package/skills/desert.aiimage/manifest.json +49 -0
  112. package/skills/difficulty_curve_designer.aiconfig/SKILL.md +68 -0
  113. package/skills/difficulty_curve_designer.aiconfig/manifest.json +36 -0
  114. package/skills/digit_renderer.aicomponent/SKILL.md +43 -0
  115. package/skills/digit_renderer.aicomponent/manifest.json +25 -0
  116. package/skills/digit_renderer.aicomponent/ref/DigitRenderer.ts +237 -0
  117. package/skills/download_button.aicomponent/SKILL.md +44 -0
  118. package/skills/download_button.aicomponent/manifest.json +25 -0
  119. package/skills/download_button.aicomponent/ref/DownloadButton.ts +137 -0
  120. package/skills/draw_line_puzzle.aigameplay/SKILL.md +84 -0
  121. package/skills/draw_line_puzzle.aigameplay/manifest.json +152 -0
  122. package/skills/draw_line_puzzle.aigameplay/ref/pgs-schema.json +189 -0
  123. package/skills/draw_line_puzzle.aigameplay/ref/reducer.template.ts +194 -0
  124. package/skills/easy_to_hard.aiconfig/SKILL.md +52 -0
  125. package/skills/easy_to_hard.aiconfig/manifest.json +33 -0
  126. package/skills/eight_ball_pool.aigameplay/SKILL.md +104 -0
  127. package/skills/eight_ball_pool.aigameplay/manifest.json +152 -0
  128. package/skills/eight_ball_pool.aigameplay/ref/pgs-schema.json +205 -0
  129. package/skills/eight_ball_pool.aigameplay/ref/reducer.template.ts +198 -0
  130. package/skills/energetic_electronic.aiaudio/SKILL.md +69 -0
  131. package/skills/energetic_electronic.aiaudio/manifest.json +51 -0
  132. package/skills/fail_sfx.aiaudio/SKILL.md +59 -0
  133. package/skills/fail_sfx.aiaudio/manifest.json +44 -0
  134. package/skills/fail_sfx.aiaudio/ref/fail.mp3 +0 -0
  135. package/skills/figer_icon.aiimage/SKILL.md +58 -0
  136. package/skills/figer_icon.aiimage/manifest.json +48 -0
  137. package/skills/figer_icon.aiimage/ref/figer.png +0 -0
  138. package/skills/figer_icon.aiimage/ref/figer.webp +0 -0
  139. package/skills/forest.aiimage/SKILL.md +74 -0
  140. package/skills/forest.aiimage/manifest.json +48 -0
  141. package/skills/fruit_tile.aiimage/SKILL.md +68 -0
  142. package/skills/fruit_tile.aiimage/manifest.json +48 -0
  143. package/skills/game_over_panel.aicomponent/SKILL.md +47 -0
  144. package/skills/game_over_panel.aicomponent/manifest.json +61 -0
  145. package/skills/game_over_panel.aicomponent/ref/GameOverPanel.ts +74 -0
  146. package/skills/game_scene.aicomponent/SKILL.md +57 -0
  147. package/skills/game_scene.aicomponent/manifest.json +36 -0
  148. package/skills/game_scene.aicomponent/ref/Game.ts +748 -0
  149. package/skills/gameplay_balance_check.aivalidator/SKILL.md +69 -0
  150. package/skills/gameplay_balance_check.aivalidator/manifest.json +21 -0
  151. package/skills/gameplay_unit_test.aivalidator/SKILL.md +89 -0
  152. package/skills/gameplay_unit_test.aivalidator/manifest.json +17 -0
  153. package/skills/gameplay_unit_test.aivalidator/ref/gameplay.test.ts +202 -0
  154. package/skills/gameplay_unit_test.aivalidator/ref/vitest.config.ts +13 -0
  155. package/skills/grid_board_layout.aicomponent/SKILL.md +85 -0
  156. package/skills/grid_board_layout.aicomponent/manifest.json +69 -0
  157. package/skills/grid_board_layout.aicomponent/ref/BoardLayout.ts +416 -0
  158. package/skills/grid_board_layout.aicomponent/ref/BoardLayout3D.ts +125 -0
  159. package/skills/grid_board_layout.aicomponent/ref/BoardLayoutMath.ts +85 -0
  160. package/skills/grid_board_layout.aicomponent/ref/BoardRenderer3D.ts +298 -0
  161. package/skills/heart_lives.aicomponent/SKILL.md +42 -0
  162. package/skills/heart_lives.aicomponent/manifest.json +25 -0
  163. package/skills/heart_lives.aicomponent/ref/HeartDisplay.ts +96 -0
  164. package/skills/idle-breathe.aicomponent/SKILL.md +27 -0
  165. package/skills/idle-breathe.aicomponent/manifest.json +20 -0
  166. package/skills/idle-breathe.aicomponent/ref/phaser.js +25 -0
  167. package/skills/idle-breathe.aicomponent/ref/playcanvas.js +29 -0
  168. package/skills/jewel_tile.aiimage/SKILL.md +63 -0
  169. package/skills/jewel_tile.aiimage/manifest.json +49 -0
  170. package/skills/knife_hit.aigameplay/SKILL.md +103 -0
  171. package/skills/knife_hit.aigameplay/manifest.json +151 -0
  172. package/skills/knife_hit.aigameplay/ref/pgs-schema.json +202 -0
  173. package/skills/knife_hit.aigameplay/ref/reducer.template.ts +196 -0
  174. package/skills/left_right_parkour.aigameplay/SKILL.md +120 -0
  175. package/skills/left_right_parkour.aigameplay/manifest.json +165 -0
  176. package/skills/left_right_parkour.aigameplay/ref/pgs-schema.json +200 -0
  177. package/skills/left_right_parkour.aigameplay/ref/reducer.template.ts +194 -0
  178. package/skills/level_data_pack.aiconfig/SKILL.md +64 -0
  179. package/skills/level_data_pack.aiconfig/manifest.json +37 -0
  180. package/skills/level_data_validator.aivalidator/SKILL.md +85 -0
  181. package/skills/level_data_validator.aivalidator/manifest.json +17 -0
  182. package/skills/level_data_validator.aivalidator/ref/LevelValidator.ts +113 -0
  183. package/skills/level_lifecycle.aicomponent/SKILL.md +81 -0
  184. package/skills/level_lifecycle.aicomponent/manifest.json +87 -0
  185. package/skills/level_lifecycle.aicomponent/ref/LevelLifecycle.ts +235 -0
  186. package/skills/level_solvability_validator.aivalidator/SKILL.md +74 -0
  187. package/skills/level_solvability_validator.aivalidator/manifest.json +23 -0
  188. package/skills/level_solvability_validator.aivalidator/ref/LevelValidator.ts +186 -0
  189. package/skills/level_state.aicomponent/SKILL.md +55 -0
  190. package/skills/level_state.aicomponent/manifest.json +34 -0
  191. package/skills/level_state.aicomponent/ref/LevelDataManager.ts +26 -0
  192. package/skills/level_state.aicomponent/ref/LevelManager.ts +26 -0
  193. package/skills/loading_screen.aicomponent/SKILL.md +57 -0
  194. package/skills/loading_screen.aicomponent/manifest.json +43 -0
  195. package/skills/loading_screen.aicomponent/ref/LoadingUI.ts +339 -0
  196. package/skills/lose_result_panel.aiimage/SKILL.md +58 -0
  197. package/skills/lose_result_panel.aiimage/manifest.json +47 -0
  198. package/skills/lose_result_panel.aiimage/ref/lose.png +0 -0
  199. package/skills/lose_result_panel.aiimage/ref/lose.webp +0 -0
  200. package/skills/lose_sfx.aiaudio/SKILL.md +59 -0
  201. package/skills/lose_sfx.aiaudio/manifest.json +45 -0
  202. package/skills/lose_sfx.aiaudio/ref/lose.mp3 +0 -0
  203. package/skills/match-pop.aicomponent/SKILL.md +29 -0
  204. package/skills/match-pop.aicomponent/manifest.json +19 -0
  205. package/skills/match-pop.aicomponent/ref/phaser.js +30 -0
  206. package/skills/match-pop.aicomponent/ref/playcanvas.js +22 -0
  207. package/skills/match3_core.aigameplay/SKILL.md +125 -0
  208. package/skills/match3_core.aigameplay/manifest.json +107 -0
  209. package/skills/match3_core.aigameplay/ref/pgs-schema.json +154 -0
  210. package/skills/match3_core.aigameplay/ref/reducer.template.ts +191 -0
  211. package/skills/match_engine.aicomponent/SKILL.md +84 -0
  212. package/skills/match_engine.aicomponent/manifest.json +23 -0
  213. package/skills/match_engine.aicomponent/ref/MatchEngine.ts +75 -0
  214. package/skills/memory_match.aigameplay/SKILL.md +111 -0
  215. package/skills/memory_match.aigameplay/manifest.json +164 -0
  216. package/skills/memory_match.aigameplay/ref/pgs-schema.json +190 -0
  217. package/skills/memory_match.aigameplay/ref/reducer.template.ts +162 -0
  218. package/skills/merge_core.aigameplay/SKILL.md +112 -0
  219. package/skills/merge_core.aigameplay/manifest.json +154 -0
  220. package/skills/merge_core.aigameplay/ref/pgs-schema.json +202 -0
  221. package/skills/merge_core.aigameplay/ref/reducer.template.ts +179 -0
  222. package/skills/mistake_sfx.aiaudio/SKILL.md +59 -0
  223. package/skills/mistake_sfx.aiaudio/manifest.json +45 -0
  224. package/skills/mistake_sfx.aiaudio/ref/mistake.mp3 +0 -0
  225. package/skills/nomove_hint_overlay.aiimage/SKILL.md +58 -0
  226. package/skills/nomove_hint_overlay.aiimage/manifest.json +48 -0
  227. package/skills/nomove_hint_overlay.aiimage/ref/nomove_hint.png +0 -0
  228. package/skills/nomove_hint_overlay.aiimage/ref/nomove_hint.webp +0 -0
  229. package/skills/normal_dot.aiimage/SKILL.md +58 -0
  230. package/skills/normal_dot.aiimage/manifest.json +46 -0
  231. package/skills/normal_dot.aiimage/ref/normal_dot.png +0 -0
  232. package/skills/normal_dot.aiimage/ref/normal_dot.webp +0 -0
  233. package/skills/ocean.aiimage/SKILL.md +71 -0
  234. package/skills/ocean.aiimage/manifest.json +49 -0
  235. package/skills/particle-confetti.aicomponent/SKILL.md +32 -0
  236. package/skills/particle-confetti.aicomponent/manifest.json +21 -0
  237. package/skills/particle-confetti.aicomponent/ref/html5-spritesheet.js +17 -0
  238. package/skills/particle-confetti.aicomponent/ref/phaser.js +38 -0
  239. package/skills/particle-explosion.aicomponent/SKILL.md +37 -0
  240. package/skills/particle-explosion.aicomponent/manifest.json +24 -0
  241. package/skills/particle-explosion.aicomponent/ref/html5-spritesheet.js +40 -0
  242. package/skills/particle-explosion.aicomponent/ref/phaser.js +46 -0
  243. package/skills/particle-explosion.aicomponent/ref/playcanvas.js +33 -0
  244. package/skills/particle-trail.aicomponent/SKILL.md +25 -0
  245. package/skills/particle-trail.aicomponent/manifest.json +22 -0
  246. package/skills/particle-trail.aicomponent/ref/phaser.js +31 -0
  247. package/skills/path_animation.aicomponent/SKILL.md +82 -0
  248. package/skills/path_animation.aicomponent/manifest.json +77 -0
  249. package/skills/path_animation.aicomponent/ref/AnimationManager.ts +694 -0
  250. package/skills/path_animation.aicomponent/ref/AnimationManager3D.ts +317 -0
  251. package/skills/path_elimination_rules.aigameplay/SKILL.md +88 -0
  252. package/skills/path_elimination_rules.aigameplay/manifest.json +119 -0
  253. package/skills/path_elimination_rules.aigameplay/ref/pgs-schema.json +227 -0
  254. package/skills/path_input_handler.aicomponent/SKILL.md +87 -0
  255. package/skills/path_input_handler.aicomponent/manifest.json +97 -0
  256. package/skills/path_input_handler.aicomponent/ref/InputHandler.ts +714 -0
  257. package/skills/path_input_handler.aicomponent/ref/InputHandler3D.ts +204 -0
  258. package/skills/path_renderer.aicomponent/SKILL.md +101 -0
  259. package/skills/path_renderer.aicomponent/manifest.json +69 -0
  260. package/skills/path_renderer.aicomponent/ref/PathRenderer.ts +509 -0
  261. package/skills/path_renderer.aicomponent/ref/PathRenderer3D.ts +176 -0
  262. package/skills/path_renderer.aicomponent/ref/PathRenderers.ts +640 -0
  263. package/skills/phaser.aicomponent/SKILL.md +315 -0
  264. package/skills/phaser.aicomponent/manifest.json +156 -0
  265. package/skills/phaser.aicomponent/ref/BootScene.ts +29 -0
  266. package/skills/phaser.aicomponent/ref/GameConfig.ts +29 -0
  267. package/skills/phaser.aicomponent/ref/GameScene.ts +88 -0
  268. package/skills/phaser.aicomponent/ref/PreloaderScene.ts +78 -0
  269. package/skills/phaser.aicomponent/ref/SceneKeys.ts +7 -0
  270. package/skills/phaser.aicomponent/ref/SoundUtils.ts +21 -0
  271. package/skills/phaser.aicomponent/ref/UiLayout.ts +74 -0
  272. package/skills/phaser.aicomponent/ref/globals.d.ts +52 -0
  273. package/skills/phaser.aicomponent/ref/index.css +40 -0
  274. package/skills/phaser.aicomponent/ref/index.html +14 -0
  275. package/skills/phaser.aicomponent/ref/index.ts +48 -0
  276. package/skills/phaser.aicomponent/ref/main.ts +16 -0
  277. package/skills/phaser.aicomponent/ref/package.json +22 -0
  278. package/skills/phaser.aicomponent/ref/tsconfig.json +25 -0
  279. package/skills/phaser.aicomponent/ref/webpack.config.js +57 -0
  280. package/skills/phaser_scene_lifecycle.aicomponent/SKILL.md +63 -0
  281. package/skills/phaser_scene_lifecycle.aicomponent/manifest.json +33 -0
  282. package/skills/pick_and_match_rules.aigameplay/SKILL.md +113 -0
  283. package/skills/pick_and_match_rules.aigameplay/manifest.json +121 -0
  284. package/skills/pick_and_match_rules.aigameplay/ref/pgs-schema.json +354 -0
  285. package/skills/pin_pull.aigameplay/SKILL.md +110 -0
  286. package/skills/pin_pull.aigameplay/manifest.json +164 -0
  287. package/skills/pin_pull.aigameplay/ref/pgs-schema.json +201 -0
  288. package/skills/pin_pull.aigameplay/ref/reducer.template.ts +216 -0
  289. package/skills/playable_app_logo.aiimage/SKILL.md +58 -0
  290. package/skills/playable_app_logo.aiimage/manifest.json +47 -0
  291. package/skills/playable_app_logo.aiimage/ref/logo.png +0 -0
  292. package/skills/playable_app_logo.aiimage/ref/logo.webp +0 -0
  293. package/skills/playable_end_screen_layout.aicomponent/SKILL.md +75 -0
  294. package/skills/playable_end_screen_layout.aicomponent/manifest.json +24 -0
  295. package/skills/playable_guidance_layer.aicomponent/SKILL.md +89 -0
  296. package/skills/playable_guidance_layer.aicomponent/manifest.json +24 -0
  297. package/skills/playable_hud_layout.aicomponent/SKILL.md +96 -0
  298. package/skills/playable_hud_layout.aicomponent/manifest.json +24 -0
  299. package/skills/playable_scripts_build.aicomponent/SKILL.md +69 -0
  300. package/skills/playable_scripts_build.aicomponent/manifest.json +53 -0
  301. package/skills/playable_scripts_build.aicomponent/ref/builds.config.js +257 -0
  302. package/skills/playcraft-3d-flip-sprite/SKILL.md +336 -0
  303. package/skills/playcraft-3d-flip-sprite/renderer/flatten_glb.mjs +62 -0
  304. package/skills/playcraft-3d-flip-sprite/renderer/render.mjs +325 -0
  305. package/skills/playcraft-3d-flip-sprite/renderer/render_single.mjs +138 -0
  306. package/skills/playcraft-asset-management/SKILL.md +73 -0
  307. package/skills/playcraft-audio-generation/SKILL.md +126 -0
  308. package/skills/playcraft-build/SKILL.md +44 -0
  309. package/skills/playcraft-code-editor/SKILL.md +71 -0
  310. package/skills/playcraft-create-remix/SKILL.md +62 -0
  311. package/skills/playcraft-deploy/SKILL.md +59 -0
  312. package/skills/playcraft-image-generation/SKILL.md +148 -0
  313. package/skills/playcraft-image-processing/SKILL.md +216 -0
  314. package/skills/playcraft-platform-intro/SKILL.md +41 -0
  315. package/skills/playcraft-prefab/SKILL.md +98 -0
  316. package/skills/playcraft-project-management/SKILL.md +57 -0
  317. package/skills/playcraft-remix-workflow/SKILL.md +119 -0
  318. package/skills/playcraft-remix-workflow/references/xplatform.schema.json5 +31 -0
  319. package/skills/playcraft-save/SKILL.md +46 -0
  320. package/skills/playcraft-skill-recommender/SKILL.md +152 -0
  321. package/skills/playcraft-sprite-generation/SKILL.md +534 -0
  322. package/skills/playcraft-sprite-remix/SKILL.md +155 -0
  323. package/skills/playcraft-sprite-sheet/SKILL.md +97 -0
  324. package/skills/playtest_report.aivalidator/SKILL.md +103 -0
  325. package/skills/playtest_report.aivalidator/manifest.json +21 -0
  326. package/skills/preloader_scene.aicomponent/SKILL.md +58 -0
  327. package/skills/preloader_scene.aicomponent/manifest.json +43 -0
  328. package/skills/preloader_scene.aicomponent/ref/Preloader.ts +339 -0
  329. package/skills/progress_bar.aicomponent/SKILL.md +38 -0
  330. package/skills/progress_bar.aicomponent/manifest.json +25 -0
  331. package/skills/progress_bar.aicomponent/ref/ProgressDisplay.ts +140 -0
  332. package/skills/references/xplatform.schema.json5 +31 -0
  333. package/skills/responsive_2d_layout.aicomponent/SKILL.md +161 -0
  334. package/skills/responsive_2d_layout.aicomponent/manifest.json +43 -0
  335. package/skills/responsive_2d_layout.aicomponent/ref/UiLayout.ts +56 -0
  336. package/skills/run_context_state.aicomponent/SKILL.md +54 -0
  337. package/skills/run_context_state.aicomponent/manifest.json +40 -0
  338. package/skills/run_context_state.aicomponent/ref/RunContextRuntime.ts +30 -0
  339. package/skills/score-fly.aicomponent/SKILL.md +31 -0
  340. package/skills/score-fly.aicomponent/manifest.json +21 -0
  341. package/skills/score-fly.aicomponent/ref/phaser.js +26 -0
  342. package/skills/score-fly.aicomponent/ref/playcanvas.js +28 -0
  343. package/skills/score_goal.aiconfig/SKILL.md +46 -0
  344. package/skills/score_goal.aiconfig/manifest.json +33 -0
  345. package/skills/screen-flash.aicomponent/SKILL.md +30 -0
  346. package/skills/screen-flash.aicomponent/manifest.json +20 -0
  347. package/skills/screen-flash.aicomponent/ref/phaser.js +48 -0
  348. package/skills/screen-shake.aicomponent/SKILL.md +30 -0
  349. package/skills/screen-shake.aicomponent/manifest.json +19 -0
  350. package/skills/screen-shake.aicomponent/ref/phaser.js +23 -0
  351. package/skills/screen-shake.aicomponent/ref/playcanvas.js +44 -0
  352. package/skills/screw_puzzle.aigameplay/SKILL.md +116 -0
  353. package/skills/screw_puzzle.aigameplay/manifest.json +164 -0
  354. package/skills/screw_puzzle.aigameplay/ref/pgs-schema.json +235 -0
  355. package/skills/screw_puzzle.aigameplay/ref/reducer.template.ts +213 -0
  356. package/skills/settings_state.aicomponent/SKILL.md +61 -0
  357. package/skills/settings_state.aicomponent/manifest.json +33 -0
  358. package/skills/settings_state.aicomponent/ref/SettingsManager.ts +130 -0
  359. package/skills/slide_out_to_tray_animation.aicomponent/SKILL.md +64 -0
  360. package/skills/slide_out_to_tray_animation.aicomponent/manifest.json +58 -0
  361. package/skills/slide_out_to_tray_animation.aicomponent/ref/AnimationManager.ts +164 -0
  362. package/skills/slide_out_to_tray_animation.aicomponent/ref/AnimationManager3D.ts +198 -0
  363. package/skills/slide_out_to_tray_animation.aicomponent/ref/BezierUtils.ts +59 -0
  364. package/skills/slot_machine.aigameplay/SKILL.md +119 -0
  365. package/skills/slot_machine.aigameplay/manifest.json +166 -0
  366. package/skills/slot_machine.aigameplay/ref/pgs-schema.json +212 -0
  367. package/skills/slot_machine.aigameplay/ref/reducer.template.ts +212 -0
  368. package/skills/sniper_shot.aigameplay/SKILL.md +84 -0
  369. package/skills/sniper_shot.aigameplay/manifest.json +153 -0
  370. package/skills/sniper_shot.aigameplay/ref/pgs-schema.json +211 -0
  371. package/skills/sniper_shot.aigameplay/ref/reducer.template.ts +211 -0
  372. package/skills/solitaire.aigameplay/SKILL.md +101 -0
  373. package/skills/solitaire.aigameplay/manifest.json +151 -0
  374. package/skills/solitaire.aigameplay/ref/pgs-schema.json +200 -0
  375. package/skills/solitaire.aigameplay/ref/reducer.template.ts +176 -0
  376. package/skills/sound-effects/SKILL.md +46 -0
  377. package/skills/sound_utils.aicomponent/SKILL.md +52 -0
  378. package/skills/sound_utils.aicomponent/manifest.json +30 -0
  379. package/skills/sound_utils.aicomponent/ref/SoundUtils.ts +29 -0
  380. package/skills/sprite-animation-2d.aicomponent/SKILL.md +45 -0
  381. package/skills/sprite-animation-2d.aicomponent/manifest.json +28 -0
  382. package/skills/sprite-animation-2d.aicomponent/ref/html5.js +83 -0
  383. package/skills/sprite-animation-2d.aicomponent/ref/phaser.js +38 -0
  384. package/skills/sprite-animation-2d.aicomponent/ref/playcanvas.js +67 -0
  385. package/skills/sprite_entity_renderer.aicomponent/SKILL.md +148 -0
  386. package/skills/sprite_entity_renderer.aicomponent/manifest.json +17 -0
  387. package/skills/sprite_entity_renderer.aicomponent/ref/SpriteEntityRenderer.ts +126 -0
  388. package/skills/success_sfx.aiaudio/SKILL.md +59 -0
  389. package/skills/success_sfx.aiaudio/manifest.json +45 -0
  390. package/skills/success_sfx.aiaudio/ref/success.mp3 +0 -0
  391. package/skills/tap_blast.aigameplay/SKILL.md +116 -0
  392. package/skills/tap_blast.aigameplay/manifest.json +153 -0
  393. package/skills/tap_blast.aigameplay/ref/pgs-schema.json +208 -0
  394. package/skills/tap_blast.aigameplay/ref/reducer.template.ts +202 -0
  395. package/skills/theme_state.aicomponent/SKILL.md +53 -0
  396. package/skills/theme_state.aicomponent/manifest.json +33 -0
  397. package/skills/theme_state.aicomponent/ref/ThemeManager.ts +174 -0
  398. package/skills/theme_switcher_build.aicomponent/SKILL.md +62 -0
  399. package/skills/theme_switcher_build.aicomponent/manifest.json +38 -0
  400. package/skills/theme_switcher_build.aicomponent/ref/theme-index.ts +8 -0
  401. package/skills/theme_variant.aiconfig/SKILL.md +78 -0
  402. package/skills/theme_variant.aiconfig/manifest.json +39 -0
  403. package/skills/theme_variant.aiconfig/ref/ExampleTheme/index.ts +16 -0
  404. package/skills/theme_variant.aiconfig/ref/ExampleTheme/levelEasy.json +141 -0
  405. package/skills/threejs.aicomponent/SKILL.md +422 -0
  406. package/skills/threejs.aicomponent/manifest.json +166 -0
  407. package/skills/threejs.aicomponent/ref/AssetLoader.ts +158 -0
  408. package/skills/threejs.aicomponent/ref/BaseScene.ts +88 -0
  409. package/skills/threejs.aicomponent/ref/GameConfig.ts +47 -0
  410. package/skills/threejs.aicomponent/ref/MainScene.ts +170 -0
  411. package/skills/threejs.aicomponent/ref/PreloaderScene.ts +93 -0
  412. package/skills/threejs.aicomponent/ref/SceneKeys.ts +6 -0
  413. package/skills/threejs.aicomponent/ref/SceneManager.ts +69 -0
  414. package/skills/threejs.aicomponent/ref/ViewportManager.ts +62 -0
  415. package/skills/threejs.aicomponent/ref/globals.d.ts +74 -0
  416. package/skills/threejs.aicomponent/ref/index.css +80 -0
  417. package/skills/threejs.aicomponent/ref/index.html +20 -0
  418. package/skills/threejs.aicomponent/ref/index.ts +117 -0
  419. package/skills/threejs.aicomponent/ref/main.ts +10 -0
  420. package/skills/threejs.aicomponent/ref/package.json +23 -0
  421. package/skills/threejs.aicomponent/ref/tsconfig.json +24 -0
  422. package/skills/threejs.aicomponent/ref/webpack.config.js +61 -0
  423. package/skills/time_clear_goal.aiconfig/SKILL.md +46 -0
  424. package/skills/time_clear_goal.aiconfig/manifest.json +32 -0
  425. package/skills/time_icon.aiimage/SKILL.md +58 -0
  426. package/skills/time_icon.aiimage/manifest.json +47 -0
  427. package/skills/time_icon.aiimage/ref/time.png +0 -0
  428. package/skills/time_icon.aiimage/ref/time.webp +0 -0
  429. package/skills/top_ui_bar.aicomponent/SKILL.md +45 -0
  430. package/skills/top_ui_bar.aicomponent/manifest.json +27 -0
  431. package/skills/top_ui_bar.aicomponent/ref/GameTopUI.ts +229 -0
  432. package/skills/tower_defence.aigameplay/SKILL.md +117 -0
  433. package/skills/tower_defence.aigameplay/manifest.json +175 -0
  434. package/skills/tower_defence.aigameplay/ref/pgs-schema.json +247 -0
  435. package/skills/tower_defence.aigameplay/ref/reducer.template.ts +239 -0
  436. package/skills/tray_container.aicomponent/SKILL.md +143 -0
  437. package/skills/tray_container.aicomponent/manifest.json +58 -0
  438. package/skills/tray_container.aicomponent/ref/TrayRenderer.ts +155 -0
  439. package/skills/tray_container.aicomponent/ref/TrayRenderer3D.ts +281 -0
  440. package/skills/tray_container.aicomponent/ref/TrayRendererHtmlOverlay.ts +228 -0
  441. package/skills/tutorial_overlay.aicomponent/SKILL.md +46 -0
  442. package/skills/tutorial_overlay.aicomponent/manifest.json +34 -0
  443. package/skills/tutorial_overlay.aicomponent/ref/TutorialManager.ts +367 -0
  444. package/skills/tween-animation-2d.aicomponent/SKILL.md +35 -0
  445. package/skills/tween-animation-2d.aicomponent/manifest.json +28 -0
  446. package/skills/tween-animation-2d.aicomponent/ref/phaser.js +49 -0
  447. package/skills/tween-animation-2d.aicomponent/ref/playcanvas.js +36 -0
  448. package/skills/typescript_module_patterns.aicomponent/SKILL.md +209 -0
  449. package/skills/typescript_module_patterns.aicomponent/manifest.json +28 -0
  450. package/skills/typescript_module_patterns.aicomponent/ref/globals.d.ts +31 -0
  451. package/skills/ui-transition.aicomponent/SKILL.md +33 -0
  452. package/skills/ui-transition.aicomponent/manifest.json +19 -0
  453. package/skills/ui-transition.aicomponent/ref/phaser.js +45 -0
  454. package/skills/ux_flow_spec.aiconfig/SKILL.md +82 -0
  455. package/skills/ux_flow_spec.aiconfig/manifest.json +39 -0
  456. package/skills/wave_difficulty.aiconfig/SKILL.md +46 -0
  457. package/skills/wave_difficulty.aiconfig/manifest.json +33 -0
  458. package/skills/webpack_build.aicomponent/SKILL.md +204 -0
  459. package/skills/webpack_build.aicomponent/manifest.json +29 -0
  460. package/skills/webpack_build.aicomponent/ref/package.json +16 -0
  461. package/skills/webpack_build.aicomponent/ref/webpack.config.js +53 -0
  462. package/skills/win_anim_sfx.aiaudio/SKILL.md +59 -0
  463. package/skills/win_anim_sfx.aiaudio/manifest.json +46 -0
  464. package/skills/win_anim_sfx.aiaudio/ref/win_anim.mp3 +0 -0
  465. package/skills/win_dot.aiimage/SKILL.md +58 -0
  466. package/skills/win_dot.aiimage/manifest.json +47 -0
  467. package/skills/win_dot.aiimage/ref/win_dot.png +0 -0
  468. package/skills/win_dot.aiimage/ref/win_dot.webp +0 -0
  469. package/skills/win_result_panel.aiimage/SKILL.md +58 -0
  470. package/skills/win_result_panel.aiimage/manifest.json +47 -0
  471. package/skills/win_result_panel.aiimage/ref/win.png +0 -0
  472. package/skills/win_result_panel.aiimage/ref/win.webp +0 -0
  473. package/skills/word_connect.aigameplay/SKILL.md +86 -0
  474. package/skills/word_connect.aigameplay/manifest.json +154 -0
  475. package/skills/word_connect.aigameplay/ref/pgs-schema.json +212 -0
  476. package/skills/word_connect.aigameplay/ref/reducer.template.ts +186 -0
  477. package/src/index.ts +10 -0
  478. package/src/skills.loader.ts +225 -0
  479. package/src/skills.types.ts +42 -0
@@ -0,0 +1,19 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "atomId": "match-pop.aicomponent",
4
+ "bundleType": "aicomponent",
5
+ "category": "animation",
6
+ "mode": "fixed",
7
+ "label": { "zh": "三消元素消除动画", "en": "Match-3 Element Pop Animation" },
8
+ "tags": ["animation", "match3", "pop", "disappear", "particle", "playcanvas", "phaser"],
9
+ "generation": {
10
+ "animationType": "tween",
11
+ "engineSupport": ["playcanvas", "phaser"],
12
+ "parameters": {
13
+ "punchScale": "number — scale overshoot at peak (default: 1.3)",
14
+ "duration": "number — total animation duration in ms (default: 300)",
15
+ "particles": "boolean — emit a burst of particles on pop (default: true)"
16
+ }
17
+ },
18
+ "files": { "skill": "SKILL.md", "playcanvas": "ref/playcanvas.js", "phaser": "ref/phaser.js" }
19
+ }
@@ -0,0 +1,30 @@
1
+ // match-pop — Phaser 3 implementation
2
+
3
+ function playMatchPop(scene, sprite, { punchScale = 1.3, duration = 300, destroyOnComplete = true } = {}) {
4
+ const chain = scene.tweens.chain({
5
+ targets: sprite,
6
+ tweens: [
7
+ {
8
+ scaleX: punchScale,
9
+ scaleY: punchScale,
10
+ duration: duration * 0.33,
11
+ ease: 'Cubic.Out',
12
+ },
13
+ {
14
+ scaleX: 0,
15
+ scaleY: 0,
16
+ alpha: 0,
17
+ duration: duration * 0.67,
18
+ ease: 'Cubic.In',
19
+ onComplete: () => {
20
+ if (destroyOnComplete) sprite.destroy();
21
+ else sprite.setVisible(false);
22
+ },
23
+ },
24
+ ],
25
+ });
26
+ return chain;
27
+ }
28
+
29
+ // Usage:
30
+ // playMatchPop(this, tileSprite);
@@ -0,0 +1,22 @@
1
+ // match-pop — PlayCanvas implementation
2
+ var MatchPop = pc.createScript('matchPop');
3
+ MatchPop.attributes.add('punchScale', { type: 'number', default: 1.3 });
4
+ MatchPop.attributes.add('duration', { type: 'number', default: 0.3 });
5
+
6
+ MatchPop.prototype.play = function (onComplete) {
7
+ var entity = this.entity;
8
+ var base = entity.getLocalScale().clone();
9
+ var punch = new pc.Vec3(base.x * this.punchScale, base.y * this.punchScale, base.z);
10
+ var zero = new pc.Vec3(0, 0, 0);
11
+ var punchTime = this.duration * 0.33;
12
+ var fadeTime = this.duration * 0.67;
13
+
14
+ entity.tween(base)
15
+ .to(punch, punchTime, pc.QuadOut)
16
+ .then(entity.tween(punch).to(zero, fadeTime, pc.QuadIn))
17
+ .call(function () {
18
+ if (onComplete) onComplete();
19
+ entity.destroy();
20
+ })
21
+ .start();
22
+ };
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: match3_core.aigameplay
3
+ description: 三消核心玩法封包 - 标准三消消除规则的 PGS 实现,可替换消除元素和视觉主题
4
+ triggers: 三消,match3,消除,match,配对,pair,棋盘,board,玩法,gameplay,核心,core,grid
5
+ ---
6
+
7
+ # match3_core.aigameplay
8
+
9
+ 三消核心玩法封包。实现标准三消规则的 PGS (PlayCraft Gameplay Schema, 玩法定义规范) JSON 和 reducer,玩家通过交换相邻元素消除 3 个或更多同类元素。
10
+
11
+ ## Recipe
12
+
13
+ - **玩法类型**:match-3(三消消除)
14
+ - **参考文件**:
15
+ - `ref/pgs-schema.json`:PGS (PlayCraft Gameplay Schema, 玩法定义规范) 规则骨架(entities、rules、algorithm、testCases)
16
+ - `ref/reducer.template.ts`:reducer 接口约束模板(`init` / `dispatch` / `getState` + 分步函数)
17
+ - **核心规则**:
18
+ - `minMatchCount`: 3(最少匹配数)
19
+ - `swapDirection`: orthogonal(只能水平/垂直交换)
20
+ - `gravityDirection`: down(消除后元素向下坠落)
21
+ - `refillFromTop`: true(从顶部补充新元素)
22
+ - **PGS Agent 操作流程**:
23
+ 1. 读取 `ref/pgs-schema.json` 作为规则骨架起点
24
+ 2. 读取 `ref/reducer.template.ts` 了解接口约束
25
+ 3. 实现 `reducer.ts`,导出 `init(config)`、`dispatch(state, action)`、`getState(state)` 以及**全部分步函数**
26
+ 4. 运行 `ref/pgs-schema.json` 中的所有 `testCases`,全部通过后才算完成
27
+ 5. 更新 manifest 的 `generation.pgsVersion` 和 `result.outputFile`
28
+ - **可 fork 变体**:
29
+ - 连线消除:修改 `swapDirection` 为 `any`,允许连线
30
+ - 爆炸道具:在 rules 中添加 bomb_trigger 特殊消除规则
31
+ - 彩虹元素:添加 wildcard 类型元素
32
+
33
+ ## Result
34
+
35
+ - **产物文件**:`reducer.ts`
36
+ - **格式**:TypeScript,导出 `init(config)`、`dispatch(action)`、`getState()` + 分步函数接口
37
+ - **验证**:所有 testCases 必须通过
38
+
39
+ ## 渲染集成(⚠️ 场景层必读)
40
+
41
+ ### 设计原则:逻辑与动画分离
42
+
43
+ reducer 提供两套接口:
44
+
45
+ | 接口 | 适用场景 | 特点 |
46
+ |------|---------|------|
47
+ | `dispatch()` | 无头测试、AI 模拟、跳过动画 | 一步到位,只返回最终状态 |
48
+ | 分步函数 | **渲染层/GameScene** | 逐步执行,返回中间过程数据 |
49
+
50
+ ### ⚠️ 禁止在渲染层使用 dispatch() 然后全量重建棋盘
51
+
52
+ 常见错误:
53
+ ```ts
54
+ // ❌ 错误做法:调用 dispatch 拿到最终 board,然后全部销毁精灵重建
55
+ const newState = dispatch(state, { type: 'swap', from, to });
56
+ destroyAllSprites(); // 视觉上 = 整页刷新
57
+ createAllSprites(newState.board);
58
+ ```
59
+
60
+ 正确做法是**分步驱动动画链**:
61
+
62
+ ```ts
63
+ // ✅ 正确做法:逐步调用分步函数,每步之间插入动画
64
+ // Step 1: 验证交换
65
+ const { valid, board, matches } = trySwap(state, from, to);
66
+ if (!valid) { playRevertAnimation(); return; }
67
+
68
+ // Step 2: 消除动画(只销毁匹配的格子)
69
+ state.board = board;
70
+ removeMatches(state.board, matches);
71
+ await playEliminationAnimation(matches); // 只对 matches 中的格子做缩小消失动画
72
+
73
+ // Step 3: 下落动画(只移动受影响的格子)
74
+ const fallMoves = applyGravity(state.board, cols, rows);
75
+ await playFallAnimation(fallMoves); // 只对有 FallMove 的精灵做 tween
76
+
77
+ // Step 4: 补充动画(只创建新格子)
78
+ const refills = refillBoard(state.board, cols, rows, colorCount);
79
+ await playRefillAnimation(refills); // 只为新格子创建精灵并从顶部滑入
80
+
81
+ // Step 5: 检查连消
82
+ const newMatches = findAllMatches(state.board, cols, rows);
83
+ if (newMatches.length > 0) { goto Step 2; } // cascade 循环
84
+ ```
85
+
86
+ ### 分步函数返回值与动画映射
87
+
88
+ | 分步函数 | 返回值 | 场景层动画 |
89
+ |---------|--------|-----------|
90
+ | `trySwap()` | `{ valid, board, matches }` | swap tween → 有效则继续,无效则 revert tween |
91
+ | `removeMatches()` | `Set<"col,row">` | 对命中的精灵播放 scale→0 + fade 动画 |
92
+ | `applyGravity()` | `FallMove[]` | 对每个 move 的精灵播放 y-tween 到新行位置 |
93
+ | `refillBoard()` | `RefillTile[]` | 在目标位置创建新精灵,从 y=-cellSize 处 tween 滑入 |
94
+ | `findAllMatches()` | `MatchResult[]` | 如非空则继续 cascade 循环 |
95
+ | `calculateMatchScore()` | `number` | 更新 score UI |
96
+
97
+ ### 动画期间的输入锁定
98
+
99
+ 场景层在整个 cascade 动画链执行期间必须锁定输入(`isAnimating = true`),
100
+ 防止玩家在下落/补充过程中触发新的 swap 导致状态不一致。
101
+ 动画链全部完成后才解锁(`isAnimating = false`)。
102
+
103
+ ## Binding
104
+
105
+ - **Binding Role**:`gameplayRule`
106
+ - **挂载目标**:`game/gameplay/match3/reducer.ts`
107
+ - **引用类型**:`gameplay-module-reference`
108
+ - **接口契约**:`init(config)` / `dispatch(action)` / `getState()` / `trySwap()` / `findAllMatches()` / `removeMatches()` / `applyGravity()` / `refillBoard()` / `calculateMatchScore()` / `hasValidMoves()`
109
+
110
+ ## Skill Definition
111
+
112
+ tools:
113
+ - bash
114
+ - write
115
+ - read
116
+ prompt_extension: |
117
+ You are implementing a match-3 core gameplay module following the PGS specification.
118
+ Write the PGS JSON with entities, rules, algorithm, and testCases.
119
+ Implement the reducer.ts with:
120
+ - init/dispatch/getState (一体化接口,用于测试)
121
+ - trySwap/findAllMatches/removeMatches/applyGravity/refillBoard/calculateMatchScore/hasValidMoves (分步函数,用于渲染层动画驱动)
122
+ The step-by-step functions are CRITICAL — the rendering layer (GameScene) must use them to drive animations.
123
+ Do NOT expect the rendering layer to call dispatch() — that would force a full board rebuild and break visual continuity.
124
+ Run the testCases to verify the logic before finalizing.
125
+ Apply the Binding to wire the reducer into the game's gameplay module path.
@@ -0,0 +1,107 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "atomId": "match3_core.aigameplay",
4
+ "bundleType": "aigameplay",
5
+ "category": "gameplay",
6
+ "mode": "fixed",
7
+ "label": { "zh": "三消核心玩法", "en": "Match-3 core gameplay" },
8
+ "tags": ["gameplay", "match3", "casual", "grid", "eliminate", "core"],
9
+ "bindingRoles": ["gameplayRule"],
10
+ "imports": [
11
+ { "slot": "engine", "pinAtomId": "phaser.aicomponent", "edgeKind": "requires", "bindAs": "engine" },
12
+ { "slot": "boardLayout", "pinAtomId": "grid_board_layout.aicomponent","edgeKind": "requires", "bindAs": "boardLayout" },
13
+ {
14
+ "slot": "bgMusic",
15
+ "description": "背景循环音乐",
16
+ "bindAs": "bgm",
17
+ "required": false,
18
+ "edgeKind": "compatibleWith",
19
+ "matchBindingRoles": ["bgMusic"],
20
+ "allowedBundleTypes": ["aiaudio"],
21
+ "constraints": { "loop": true }
22
+ },
23
+ {
24
+ "slot": "tileSet",
25
+ "description": "牌面贴图组(三消块的视觉贴图集)",
26
+ "bindAs": "tiles",
27
+ "required": false,
28
+ "edgeKind": "compatibleWith",
29
+ "matchBindingRoles": ["tileTextureSet"],
30
+ "allowedBundleTypes": ["aiimage"]
31
+ },
32
+ {
33
+ "slot": "background",
34
+ "description": "游戏背景图",
35
+ "bindAs": "bg",
36
+ "required": false,
37
+ "edgeKind": "compatibleWith",
38
+ "matchBindingRoles": ["backgroundTexture"],
39
+ "allowedBundleTypes": ["aiimage"]
40
+ },
41
+ {
42
+ "slot": "levelDataPack",
43
+ "description": "关卡数据包",
44
+ "bindAs": "levels",
45
+ "required": false,
46
+ "edgeKind": "compatibleWith",
47
+ "matchBindingRoles": ["levelDataPack"],
48
+ "allowedBundleTypes": ["aiconfig"]
49
+ },
50
+ {
51
+ "slot": "winPanel",
52
+ "description": "通关反馈面板视觉",
53
+ "bindAs": "winPanel",
54
+ "required": false,
55
+ "edgeKind": "compatibleWith",
56
+ "matchBindingRoles": ["successFeedbackPanel"],
57
+ "allowedBundleTypes": ["aiimage"]
58
+ },
59
+ {
60
+ "slot": "losePanel",
61
+ "description": "失败反馈面板视觉",
62
+ "bindAs": "losePanel",
63
+ "required": false,
64
+ "edgeKind": "compatibleWith",
65
+ "matchBindingRoles": ["failFeedbackPanel"],
66
+ "allowedBundleTypes": ["aiimage"]
67
+ }
68
+ ],
69
+ "generation": {
70
+ "kind": "pgs",
71
+ "pgsVersion": "1.0",
72
+ "gameplayType": "match3",
73
+ "rules": {
74
+ "minMatchCount": 3,
75
+ "swapDirection": "orthogonal",
76
+ "gravityDirection": "down",
77
+ "refillFromTop": true
78
+ }
79
+ },
80
+ "result": {
81
+ "outputFile": "reducer.ts",
82
+ "format": "typescript",
83
+ "constraints": { "testCasesMustPass": true }
84
+ },
85
+ "binding": {
86
+ "role": "gameplayRule",
87
+ "target": "game/gameplay/match3/reducer.ts",
88
+ "type": "gameplay-module-reference",
89
+ "constraints": {
90
+ "interface": [
91
+ "init(config)", "dispatch(action)", "getState()",
92
+ "trySwap(state, from, to)",
93
+ "findAllMatches(board, cols, rows)",
94
+ "removeMatches(board, matches)",
95
+ "applyGravity(board, cols, rows)",
96
+ "refillBoard(board, cols, rows, colorCount)",
97
+ "calculateMatchScore(matches, config)",
98
+ "hasValidMoves(state)"
99
+ ]
100
+ }
101
+ },
102
+ "files": {
103
+ "skill": "SKILL.md",
104
+ "pgsSchema": "ref/pgs-schema.json",
105
+ "reducerTemplate": "ref/reducer.template.ts"
106
+ }
107
+ }
@@ -0,0 +1,154 @@
1
+ {
2
+ "_comment": "PGS (PlayCraft Gameplay Schema) 参考骨架 - 三消核心玩法。Agent 以此为起点编写或 fork 玩法规则。",
3
+ "version": "1.0",
4
+ "gameplayType": "match3",
5
+ "entities": {
6
+ "board": {
7
+ "type": "grid",
8
+ "cols": 8,
9
+ "rows": 8,
10
+ "description": "游戏棋盘,8×8 格子"
11
+ },
12
+ "tile": {
13
+ "type": "cell-item",
14
+ "colorCount": 6,
15
+ "description": "棋盘格子上的消除元素,共 6 种颜色/类型"
16
+ },
17
+ "score": {
18
+ "type": "counter",
19
+ "initial": 0,
20
+ "description": "当前得分"
21
+ },
22
+ "moves": {
23
+ "type": "counter",
24
+ "initial": 30,
25
+ "description": "剩余步数(由 config 覆盖)"
26
+ }
27
+ },
28
+ "rules": {
29
+ "swap": {
30
+ "description": "玩家交换相邻两个格子(上下左右),若交换后产生 ≥3 连,则有效;否则回退",
31
+ "swapDirection": "orthogonal",
32
+ "revertIfNoMatch": true
33
+ },
34
+ "match": {
35
+ "description": "消除连续 ≥3 个同类型格子(水平或垂直)",
36
+ "minCount": 3,
37
+ "directions": ["horizontal", "vertical"],
38
+ "scorePerTile": 50,
39
+ "bonusThresholds": [
40
+ { "count": 4, "bonus": 100, "description": "消除 4 个获得额外 100 分" },
41
+ { "count": 5, "bonus": 300, "specialTile": "bomb", "description": "消除 5 个生成炸弹特殊块" }
42
+ ]
43
+ },
44
+ "gravity": {
45
+ "description": "消除后,上方格子向下坠落填充空位",
46
+ "direction": "down"
47
+ },
48
+ "refill": {
49
+ "description": "坠落后,顶部补充新的随机格子",
50
+ "from": "top",
51
+ "distribution": "uniform"
52
+ },
53
+ "cascade": {
54
+ "description": "每次补充后重新检查是否有新的匹配,连续消除(连消)",
55
+ "enabled": true
56
+ }
57
+ },
58
+ "algorithm": {
59
+ "description": "主循环:swap → match → cascade → win/lose 检测",
60
+ "steps": [
61
+ "1. 玩家选择两个相邻格子 swap",
62
+ "2. 检测 swap 后是否产生 match(≥3 连)",
63
+ "3. 若无 match,回退 swap;steps 不消耗",
64
+ "4. 若有 match,消除匹配格子,计分,steps - 1",
65
+ "5. 触发 gravity(上方格子下坠)",
66
+ "6. 顶部 refill 新格子",
67
+ "7. 检测新格子是否产生 cascade match,若有则回到步骤 4",
68
+ "8. cascade 结束后检测胜败条件"
69
+ ]
70
+ },
71
+ "winCondition": {
72
+ "type": "score_goal",
73
+ "description": "在 moves 耗尽前达到目标分数(由 config 中 level.goalScore 定义)"
74
+ },
75
+ "loseCondition": {
76
+ "type": "moves_exhausted",
77
+ "description": "moves 归零且未达到胜利条件"
78
+ },
79
+ "testCases": [
80
+ {
81
+ "id": "tc_basic_match",
82
+ "description": "基础三消:水平三连消除",
83
+ "initialState": {
84
+ "board": "3×1 横排三个相同颜色的格子(例如 Red Red Red)",
85
+ "moves": 5
86
+ },
87
+ "action": { "type": "swap", "from": [3, 0], "to": [4, 0] },
88
+ "expectedState": {
89
+ "matchedCount": 3,
90
+ "scoreGained": 150,
91
+ "movesLeft": 4,
92
+ "boardRefilled": true
93
+ }
94
+ },
95
+ {
96
+ "id": "tc_invalid_swap",
97
+ "description": "无效交换:交换后无三连,步数不扣",
98
+ "initialState": {
99
+ "board": "交换后不形成三连的两个格子",
100
+ "moves": 5
101
+ },
102
+ "action": { "type": "swap", "from": [0, 0], "to": [1, 0] },
103
+ "expectedState": {
104
+ "matchedCount": 0,
105
+ "scoreGained": 0,
106
+ "movesLeft": 5,
107
+ "swapReverted": true
108
+ }
109
+ },
110
+ {
111
+ "id": "tc_cascade",
112
+ "description": "连消:消除后新格子产生新匹配",
113
+ "initialState": {
114
+ "board": "消除一组后,下落的格子正好形成新的三连",
115
+ "moves": 3
116
+ },
117
+ "action": { "type": "swap", "from": [2, 7], "to": [3, 7] },
118
+ "expectedState": {
119
+ "cascadeCount": { "min": 2 },
120
+ "scoreGained": { "min": 300 },
121
+ "movesLeft": 2
122
+ }
123
+ },
124
+ {
125
+ "id": "tc_win",
126
+ "description": "胜利:达到目标分数",
127
+ "initialState": {
128
+ "score": 950,
129
+ "goalScore": 1000,
130
+ "moves": 2
131
+ },
132
+ "action": { "type": "swap", "from": [0, 0], "to": [1, 0] },
133
+ "expectedState": {
134
+ "win": true,
135
+ "score": { "min": 1000 }
136
+ }
137
+ },
138
+ {
139
+ "id": "tc_lose",
140
+ "description": "失败:步数耗尽未达目标",
141
+ "initialState": {
142
+ "score": 500,
143
+ "goalScore": 1000,
144
+ "moves": 1
145
+ },
146
+ "action": { "type": "swap", "from": [0, 0], "to": [1, 0] },
147
+ "expectedState": {
148
+ "movesLeft": 0,
149
+ "win": false,
150
+ "gameOver": true
151
+ }
152
+ }
153
+ ]
154
+ }
@@ -0,0 +1,191 @@
1
+ /**
2
+ * match3_core.aigameplay — reducer 接口模板
3
+ *
4
+ * Agent 生成实际 reducer 时,必须导出以下函数。
5
+ * 此文件是接口约束模板,不是可执行代码。
6
+ *
7
+ * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
8
+ * ⚠️ 重要:渲染层(GameScene)不应直接调用 dispatch()
9
+ *
10
+ * dispatch() 是一体化接口,内部跑完整个 cascade 循环后只返回最终状态,
11
+ * 中间过程(哪些格子被消除、哪些格子下落、新补充了什么)全部丢失。
12
+ *
13
+ * 渲染层需要分步动画(消除动画 → 下落动画 → 补充动画 → 检查连消),
14
+ * 因此必须使用下方的「分步函数」逐步驱动,每步之间插入 Tween 动画。
15
+ *
16
+ * dispatch() 的用途:无头测试、AI 模拟、快速跳过动画等场景。
17
+ * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
18
+ */
19
+
20
+ // ─── 配置类型 ─────────────────────────────────────────────────────────────────
21
+
22
+ export type Match3Config = {
23
+ /** 棋盘列数,默认 8 */
24
+ cols: number;
25
+ /** 棋盘行数,默认 8 */
26
+ rows: number;
27
+ /** 元素颜色/类型数量,默认 6 */
28
+ colorCount: number;
29
+ /** 初始步数 */
30
+ initialMoves: number;
31
+ /** 目标分数(score_goal 模式) */
32
+ goalScore?: number;
33
+ /** 倒计时秒数(time_clear 模式) */
34
+ timeLimitSeconds?: number;
35
+ /** 每格消除基础得分 */
36
+ scorePerTile: number;
37
+ };
38
+
39
+ // ─── 动作类型 ─────────────────────────────────────────────────────────────────
40
+
41
+ export type Match3Action =
42
+ | { type: 'swap'; from: [col: number, row: number]; to: [col: number, row: number] }
43
+ | { type: 'tick'; deltaMs: number } // 倒计时模式下每帧调用
44
+ | { type: 'reset' };
45
+
46
+ // ─── 状态类型 ─────────────────────────────────────────────────────────────────
47
+
48
+ export type TileColor = number; // 0 ~ colorCount-1,null 表示空格
49
+
50
+ export type Match3State = {
51
+ /** 棋盘格子,board[col][row] */
52
+ board: (TileColor | null)[][];
53
+ /** 当前得分 */
54
+ score: number;
55
+ /** 剩余步数 */
56
+ movesLeft: number;
57
+ /** 剩余时间(毫秒,倒计时模式) */
58
+ timeLeftMs?: number;
59
+ /** 游戏是否结束 */
60
+ gameOver: boolean;
61
+ /** 是否胜利 */
62
+ win: boolean;
63
+ /** 上一次 swap 是否因无效而回退 */
64
+ lastSwapReverted: boolean;
65
+ /** 上一次操作触发的连消次数 */
66
+ lastCascadeCount: number;
67
+ };
68
+
69
+ // ─── 分步操作返回类型 ─────────────────────────────────────────────────────────
70
+
71
+ /** 匹配结果 */
72
+ export type MatchResult = {
73
+ /** 被匹配到的格子坐标列表 */
74
+ cells: Array<{ col: number; row: number }>;
75
+ /** 连续匹配的数量(3/4/5+) */
76
+ count: number;
77
+ };
78
+
79
+ /** 重力下落:某格子从 fromRow 下落到 toRow */
80
+ export type FallMove = {
81
+ col: number;
82
+ fromRow: number;
83
+ toRow: number;
84
+ };
85
+
86
+ /** 新补充的棋子 */
87
+ export type RefillTile = {
88
+ col: number;
89
+ row: number;
90
+ color: TileColor;
91
+ };
92
+
93
+ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
94
+ // 必须导出的函数
95
+ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
96
+
97
+ // ─── 初始化 ──────────────────────────────────────────────────────────────────
98
+
99
+ /**
100
+ * init:根据配置初始化游戏状态,随机填满棋盘(确保初始无三连)
101
+ */
102
+ export declare function init(config: Match3Config): Match3State;
103
+
104
+ // ─── 一体化接口(测试/AI 模拟用) ───────────────────────────────────────────
105
+
106
+ /**
107
+ * dispatch:接收动作,返回新状态(纯函数,不得修改原 state)
108
+ * - swap:交换两格,检测消除、计分、下落、补充、连消(一步到位)
109
+ * - tick:更新倒计时(time_clear 模式)
110
+ * - reset:重置到初始状态
111
+ *
112
+ * ⚠️ 仅用于无头测试和 AI 模拟。渲染层请使用下方分步函数。
113
+ */
114
+ export declare function dispatch(state: Match3State, action: Match3Action): Match3State;
115
+
116
+ /**
117
+ * getState:返回当前状态快照(通常直接返回 state,供外部读取)
118
+ */
119
+ export declare function getState(state: Match3State): Match3State;
120
+
121
+ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
122
+ // 分步函数(渲染层/场景层必须使用这些函数驱动动画)
123
+ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
124
+
125
+ /**
126
+ * trySwap:仅验证交换是否有效,不执行后续 cascade。
127
+ * 返回交换后的棋盘副本和第一轮匹配结果。
128
+ *
129
+ * 场景层在 swap 动画播放完毕后调用此函数:
130
+ * - valid=false → 播放回退动画
131
+ * - valid=true → 继续调用 removeMatches → animateElimination → applyGravity → ...
132
+ */
133
+ export declare function trySwap(
134
+ state: Match3State,
135
+ from: [col: number, row: number],
136
+ to: [col: number, row: number],
137
+ ): { valid: boolean; board: (TileColor | null)[][]; matches: MatchResult[] };
138
+
139
+ /**
140
+ * findAllMatches:检测棋盘上所有 ≥3 连匹配
141
+ * 场景层在 refill 动画结束后调用,检查是否有连消
142
+ */
143
+ export declare function findAllMatches(
144
+ board: (TileColor | null)[][],
145
+ cols: number,
146
+ rows: number,
147
+ ): MatchResult[];
148
+
149
+ /**
150
+ * removeMatches:从棋盘移除匹配的格子(置为 null)
151
+ * 场景层在消除动画播放期间/之后调用,同步逻辑状态
152
+ */
153
+ export declare function removeMatches(
154
+ board: (TileColor | null)[][],
155
+ matches: MatchResult[],
156
+ ): Set<string>; // 返回被移除的格子 key "col,row"
157
+
158
+ /**
159
+ * applyGravity:执行重力下落,返回每个移动的格子信息
160
+ * 场景层根据 FallMove[] 播放下落 Tween 动画
161
+ */
162
+ export declare function applyGravity(
163
+ board: (TileColor | null)[][],
164
+ cols: number,
165
+ rows: number,
166
+ ): FallMove[];
167
+
168
+ /**
169
+ * refillBoard:从顶部补充空位,返回新格子信息
170
+ * 场景层根据 RefillTile[] 创建新精灵并播放滑入动画
171
+ */
172
+ export declare function refillBoard(
173
+ board: (TileColor | null)[][],
174
+ cols: number,
175
+ rows: number,
176
+ colorCount: number,
177
+ ): RefillTile[];
178
+
179
+ /**
180
+ * calculateMatchScore:计算一轮匹配的得分
181
+ */
182
+ export declare function calculateMatchScore(
183
+ matches: MatchResult[],
184
+ config: Match3Config,
185
+ ): number;
186
+
187
+ /**
188
+ * hasValidMoves:检查棋盘是否还有可用的合法交换
189
+ * 若无可用移动则需要洗牌
190
+ */
191
+ export declare function hasValidMoves(state: Match3State): boolean;