Implement defensive chase behavior and increase rotation speed

- Add defensive AI: players now chase puck carriers on opposing team
- Update DefensiveBehavior to check opponent possession and target puck position
- Increase player rotation speed from 3 to 10 rad/s for more responsive turning
- Update Claude settings permissions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Pierre Wessman 2025-10-02 10:20:00 +02:00
parent ff97b227c2
commit 9e81619637
3 changed files with 16 additions and 11 deletions

View File

@ -3,7 +3,9 @@
"allow": [ "allow": [
"Bash(find:*)", "Bash(find:*)",
"Bash(cat:*)", "Bash(cat:*)",
"Bash(pnpm run:*)" "Bash(pnpm run:*)",
"Bash(mkdir:*)",
"Bash(git log:*)"
], ],
"deny": [], "deny": [],
"ask": [] "ask": []

View File

@ -30,7 +30,7 @@ export const DEBUG = false;
// Player constants // Player constants
export const PLAYER_RADIUS_GOALIE = 12; // pixels export const PLAYER_RADIUS_GOALIE = 12; // pixels
export const PLAYER_RADIUS_SKATER = 10; // pixels export const PLAYER_RADIUS_SKATER = 10; // pixels
export const PLAYER_ROTATION_SPEED = 3; // radians per second export const PLAYER_ROTATION_SPEED = 10; // radians per second
export const SPEED_SCALE_FACTOR = 10; // speed attribute (0-100) / 10 = m/s export const SPEED_SCALE_FACTOR = 10; // speed attribute (0-100) / 10 = m/s
export const GOAL_DECELERATION_RATE = 0.9; // Speed multiplier reduction after goal export const GOAL_DECELERATION_RATE = 0.9; // Speed multiplier reduction after goal

View File

@ -27,17 +27,20 @@ export class DefensiveBehavior extends BehaviorNode {
if (puck.state !== 'carried') return false; if (puck.state !== 'carried') return false;
if (puck.carrier === player.id) return false; if (puck.carrier === player.id) return false;
// TODO: Check if carrier is opponent (requires team roster access) // Check if carrier is opponent (different team)
// For now, just fail - will implement in Phase 6 return puck.carrierTeam !== player.team;
return false;
}), }),
// Defensive action (future implementation) // Chase the puck carrier
new Action((player) => ({ new Action((player, gameState) => {
type: 'idle', const { puck } = gameState;
targetX: player.gameX,
targetY: player.gameY return {
})) type: 'chase_puck',
targetX: puck.gameX,
targetY: puck.gameY
};
})
]); ]);
} }