任务
This commit is contained in:
11
tasks/task_013.txt
Normal file
11
tasks/task_013.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
# Task ID: 13
|
||||
# Title: Core Game Engine Logic (Server-side Combat)
|
||||
# Status: pending
|
||||
# Dependencies: 2, 7, 9, 11
|
||||
# Priority: high
|
||||
# Description: Implement the server-side game engine responsible for managing game state, handling player attacks, determining hit/miss/destroy outcomes, and enforcing game rules (turn-based, win conditions).
|
||||
# Details:
|
||||
Create a `GameEngine` module. Store game state (player boards, plane positions, attack history, current turn) in Redis. Implement `processAttack(roomId, userId, targetCoordinate)` function. This function should: 1. Validate turn. 2. Check target on opponent's board. 3. Determine MISS, HIT, or DESTROY (if head is hit). 4. Update game state. 5. Check win condition (all 3 planes destroyed). 6. Switch turn. Use the `Plane` data structure and collision logic from Task 7. Store game sessions in MongoDB for history.
|
||||
|
||||
# Test Strategy:
|
||||
Unit test `processAttack` with various scenarios: miss, hit (body), hit (head/destroy), hitting same spot twice. Test turn switching and win condition detection. Simulate a full game flow via API calls to verify engine logic. Test concurrent attacks (should be prevented by turn validation).
|
||||
Reference in New Issue
Block a user