|
| 1 | +# Implementation Plan |
| 2 | + |
| 3 | +- [x] 1. Add AppleSapling collection to MyGdxGame |
| 4 | + - Add `Map<String, AppleSapling> appleSaplings` field declaration with other item collections |
| 5 | + - Initialize `appleSaplings = new HashMap<>()` in create() method |
| 6 | + - Wire appleSaplings collection to player with `player.setAppleSaplings(appleSaplings)` in create() |
| 7 | + - _Requirements: 2.5_ |
| 8 | + |
| 9 | +- [x] 2. Implement AppleSapling rendering in MyGdxGame |
| 10 | + - Create `drawAppleSaplings()` method with viewport culling logic |
| 11 | + - Render AppleSapling items at 32x32 pixels using batch.draw() |
| 12 | + - Call `drawAppleSaplings()` in render() method after `drawApples()` |
| 13 | + - _Requirements: 2.2_ |
| 14 | + |
| 15 | +- [x] 3. Add AppleSapling support to Player class |
| 16 | + - Add AppleSapling import statement at top of Player.java |
| 17 | + - Add `Map<String, AppleSapling> appleSaplings` field declaration |
| 18 | + - Implement `setAppleSaplings()` setter method |
| 19 | + - _Requirements: 1.3_ |
| 20 | + |
| 21 | +- [x] 4. Implement dual-item drop logic for AppleTree destruction |
| 22 | + - Modify the AppleTree destruction block in Player's attack handling (around line 932) |
| 23 | + - Keep existing Apple spawn at tree's base position with key `targetKey` |
| 24 | + - Add AppleSapling spawn at position offset by 8 pixels horizontally using key `targetKey + "-applesapling"` |
| 25 | + - Add AppleSapling to appleSaplings collection |
| 26 | + - Add console logging for AppleSapling drop |
| 27 | + - _Requirements: 1.1, 1.2, 1.5_ |
| 28 | + |
| 29 | +- [x] 5. Implement AppleSapling pickup detection and handling |
| 30 | + - Create `checkAppleSaplingPickups()` method in Player class that iterates appleSaplings and checks collision |
| 31 | + - Create `pickupAppleSapling()` method that handles single-player pickup (dispose, remove, add to inventory) and multiplayer pickup (send message) |
| 32 | + - Add call to `checkAppleSaplingPickups()` in Player's `update()` method after `checkApplePickups()` |
| 33 | + - _Requirements: 3.2, 3.3, 3.4, 3.5, 4.1_ |
| 34 | + |
| 35 | +- [x] 6. Add APPLE_SAPLING to inventory ItemType enum |
| 36 | + - Open src/main/java/wagemaker/uk/inventory/ItemType.java |
| 37 | + - Add APPLE_SAPLING entry after APPLE with parameters (false, 0, false) |
| 38 | + - _Requirements: 4.2_ |
| 39 | + |
| 40 | +- [x] 7. Add APPLE_SAPLING to network ItemType enum |
| 41 | + - Open src/main/java/wagemaker/uk/network/ItemType.java |
| 42 | + - Add APPLE_SAPLING entry after APPLE |
| 43 | + - _Requirements: 5.1_ |
| 44 | + |
| 45 | +- [x] 8. Add AppleSapling inventory support to Inventory class |
| 46 | + - Open src/main/java/wagemaker/uk/inventory/Inventory.java |
| 47 | + - Add `appleSaplingCount` field |
| 48 | + - Implement getAppleSaplingCount(), setAppleSaplingCount(), addAppleSapling(), and removeAppleSapling() methods |
| 49 | + - _Requirements: 4.1_ |
| 50 | + |
| 51 | +- [x] 9. Update InventoryManager for AppleSapling |
| 52 | + - Open src/main/java/wagemaker/uk/inventory/InventoryManager.java |
| 53 | + - Add APPLE_SAPLING case to addItemToInventory() method |
| 54 | + - Update syncFromServer() method signature to include appleSaplingCount parameter |
| 55 | + - Add appleSaplingCount sync logic in syncFromServer() |
| 56 | + - Update getSelectedItemType() to return APPLE_SAPLING for slot 8 |
| 57 | + - Update checkAndAutoDeselect() to check appleSaplingCount for slot 8 |
| 58 | + - _Requirements: 4.1, 5.2, 5.3_ |
| 59 | + |
| 60 | +- [x] 10. Update InventorySyncMessage for AppleSapling |
| 61 | + - Open src/main/java/wagemaker/uk/network/InventorySyncMessage.java |
| 62 | + - Add appleSaplingCount field to message |
| 63 | + - Update constructor and getters |
| 64 | + - _Requirements: 5.2_ |
| 65 | + |
| 66 | +- [x] 11. Update InventoryUpdateMessage for AppleSapling |
| 67 | + - Open src/main/java/wagemaker/uk/network/InventoryUpdateMessage.java |
| 68 | + - Add appleSaplingCount field to message |
| 69 | + - Update constructor and getters |
| 70 | + - _Requirements: 5.2_ |
| 71 | + |
| 72 | +- [x] 11.5. Update PlayerState for AppleSapling |
| 73 | + - Open src/main/java/wagemaker/uk/network/PlayerState.java |
| 74 | + - Add `appleSaplingCount` field to player state |
| 75 | + - Implement getAppleSaplingCount() and setAppleSaplingCount() methods |
| 76 | + - Update ClientConnection to use appleSaplingCount in InventoryUpdateMessage and InventorySyncMessage constructors |
| 77 | + - Update GameMessageHandler to pass appleSaplingCount to syncFromServer() method |
| 78 | + - _Requirements: 5.2, 5.3_ |
| 79 | + |
| 80 | +- [x] 12. Update multiplayer item spawn handling for AppleSapling |
| 81 | + - Locate server-side tree destruction handler |
| 82 | + - Add AppleTree destruction case with dual-item spawn logic |
| 83 | + - Broadcast ItemSpawnMessage for Apple with type APPLE |
| 84 | + - Broadcast ItemSpawnMessage for AppleSapling with type APPLE_SAPLING |
| 85 | + - Locate client-side ItemSpawnMessage handler |
| 86 | + - Add APPLE_SAPLING case to create AppleSapling instances from spawn messages |
| 87 | + - Add AppleSapling to appleSaplings collection |
| 88 | + - _Requirements: 5.2, 5.4_ |
| 89 | + |
| 90 | +- [x] 13. Update multiplayer item pickup handling for AppleSapling |
| 91 | + - Locate server-side ItemPickupMessage handler |
| 92 | + - Verify it handles APPLE_SAPLING pickup messages generically |
| 93 | + - Locate client-side pickup message handler |
| 94 | + - Add APPLE_SAPLING case to remove AppleSapling from collection and add to inventory |
| 95 | + - Verify inventory synchronization for APPLE_SAPLING items |
| 96 | + - _Requirements: 5.3, 5.5, 4.1_ |
| 97 | + |
| 98 | +- [x] 14. Update world save/load support for AppleSapling inventory |
| 99 | + - Open src/main/java/wagemaker/uk/world/WorldSaveData.java |
| 100 | + - Add appleSaplingCount field to save data |
| 101 | + - Update save logic to include appleSaplingCount |
| 102 | + - Update load logic to restore appleSaplingCount |
| 103 | + - _Requirements: 4.5, 4.6_ |
| 104 | + |
| 105 | +- [x] 15. Update InventoryRenderer for AppleSapling display |
| 106 | + - Open src/main/java/wagemaker/uk/ui/InventoryRenderer.java |
| 107 | + - Add AppleSapling rendering at slot 8 |
| 108 | + - Extract AppleSapling texture from sprite sheet at (192, 254) |
| 109 | + - Display appleSaplingCount next to AppleSapling icon |
| 110 | + - _Requirements: 4.3_ |
| 111 | + |
| 112 | +- [x] 16. Test single-player dual-drop functionality |
| 113 | + - Start single-player game |
| 114 | + - Attack and destroy AppleTree |
| 115 | + - Verify both Apple and AppleSapling spawn 8 pixels apart |
| 116 | + - Verify items render at 32x32 pixels |
| 117 | + - Verify console logs show correct drop positions |
| 118 | + - Walk over Apple and verify pickup |
| 119 | + - Walk over AppleSapling and verify pickup + inventory increase |
| 120 | + - Check inventory UI shows AppleSapling count |
| 121 | + - Save game and verify AppleSapling count persists |
| 122 | + - Load game and verify AppleSapling count restored |
| 123 | + - _Requirements: 1.1, 1.2, 2.1, 2.2, 3.1, 3.2, 4.1, 4.3, 4.5, 4.6_ |
| 124 | + |
| 125 | +- [x] 17. Test multiplayer dual-drop synchronization |
| 126 | + - Start server and connect 2+ clients |
| 127 | + - Client attacks AppleTree until destroyed |
| 128 | + - Verify both items spawn on all clients |
| 129 | + - Verify items render correctly on all clients |
| 130 | + - Verify items are positioned correctly on all clients |
| 131 | + - Client picks up Apple |
| 132 | + - Verify removal on all clients |
| 133 | + - Client picks up AppleSapling |
| 134 | + - Verify removal on all clients |
| 135 | + - Verify inventory synchronization across clients |
| 136 | + - Test with multiple players attacking different AppleTrees simultaneously |
| 137 | + - _Requirements: 1.4, 5.2, 5.3, 5.4, 5.5_ |
0 commit comments