一键导入
create-game-action
This skill should be used when adding a new game action or event to the Bamboozle codebase.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
This skill should be used when adding a new game action or event to the Bamboozle codebase.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
This skill should be used when managing, building, and troubleshooting the Capacitor-based Android application for Bamboozle.
This skill should be used when generating, managing, and exporting branding assets for Bamboozle.
This skill should be used when writing or updating documentation, coding standards, and best practices for the Bamboozle codebase.
This skill should be used when adding or modifying a game phase (e.g., adding a 'Wager' phase) in Bamboozle.
This skill should be used when managing the Bamboozle narrator system, including premium voices and Safari compatibility.
| name | create-game-action |
| description | This skill should be used when adding a new game action or event to the Bamboozle codebase. |
| version | 1.0.0 |
| author | Gabriel Athanasiou |
| created | "2024-05-01T00:00:00.000Z" |
| updated | "2026-03-07T00:00:00.000Z" |
| platforms | ["copilot","claude","codex"] |
| category | development |
| tags | ["game-logic","events","bamboozle"] |
| risk | safe |
This skill guides developers through adding a new action/event to the Bamboozle game loop. Since the game is event-driven via Socket.IO, adding a new feature usually requires updates across the shared types, the game logic service, and the UI components.
types.tsTo ensure end-to-end type safety, first define the new action in the GameEvent union type.
Steps:
src/types.ts.GameEvent type definition (around line 100).{ type: 'YOUR_ACTION_NAME'; payload: { ... } }.Example:
// types.ts
export type GameEvent =
// ... existing events
| { type: 'USE_POWERUP'; payload: { playerId: string; powerupId: string } };
services/gameService.tsThe gameService.ts file contains the central state reducer in the processHostEvent function. This is where the game state is updated in response to actions.
Steps:
src/services/gameService.ts.processHostEvent function (around line 740).case block inside the switch (event.type) statement.next state based on prev state and event.payload.changed = true to trigger a state broadcast.Example:
// services/gameService.ts
case 'USE_POWERUP': {
const { playerId, powerupId } = event.payload;
// Validation: Check if player can use powerup
if (!next.players[playerId].hasPowerup) break;
// Logic: Apply powerup effect
next.players[playerId].isBoosted = true;
// SFX: Play sound effect (Host only)
sfx.play('POWERUP');
changed = true;
break;
}
views/PlayerView.tsx (or HostView/OnlinePlayerView)Dispatch the action from a component in the user interface.
Steps:
actions prop or the processHostEvent function (if available).socket.emit.Example (Player side):
// views/PlayerView.tsx
const handlePowerup = () => {
// Option A: If using a socket directly
socket.emit('playerEvent', {
type: 'USE_POWERUP',
payload: { playerId: myPlayerId, powerupId: 'double-points' }
});
};
Note: Ensure gameService.ts on the Host side is listening for this event. Most player events are automatically routed to processHostEvent via the playerEvent listener.
When adding a new action that affects the UI, remember:
@capacitor/haptics.App.tsx.env(safe-area-inset-bottom).GameEvent in types.ts.processHostEvent in gameService.ts.processHostEvent.