|
| 1 | +## ADDED Requirements |
| 2 | + |
| 3 | +### Requirement: On-screen directional pad |
| 4 | +The system SHALL render a 3×3 D-pad overlay during the `playing`, `targeting`, and `awaitingItemKey` phases. The eight directional buttons SHALL dispatch the same `MOVE` actions as keyboard movement keys. The centre cell SHALL be empty. |
| 5 | + |
| 6 | +#### Scenario: D-pad tap moves player |
| 7 | +- **WHEN** user taps a directional button on the D-pad during `playing` phase |
| 8 | +- **THEN** player moves one tile in the corresponding direction, identical to pressing the matching keyboard key |
| 9 | + |
| 10 | +#### Scenario: D-pad not shown on menu screens |
| 11 | +- **WHEN** game phase is `mainMenu`, `charSelect`, `dead`, `victory`, `highScores`, or `changelog` |
| 12 | +- **THEN** D-pad overlay SHALL NOT be rendered |
| 13 | + |
| 14 | +#### Scenario: D-pad visible during targeting |
| 15 | +- **WHEN** game phase is `targeting` |
| 16 | +- **THEN** D-pad SHALL be rendered and tapping a direction moves the targeting cursor |
| 17 | + |
| 18 | +### Requirement: Action button strip |
| 19 | +The system SHALL render a row of labelled action buttons above the D-pad for the most common gameplay actions. The strip SHALL include: Wait, Pickup, Inventory, Stairs Down, Stairs Up, Mute, Help. |
| 20 | + |
| 21 | +#### Scenario: Wait button |
| 22 | +- **WHEN** user taps the Wait button |
| 23 | +- **THEN** system dispatches `WAIT` action, identical to pressing `.` |
| 24 | + |
| 25 | +#### Scenario: Pickup button |
| 26 | +- **WHEN** user taps the Pickup button |
| 27 | +- **THEN** system dispatches `PICKUP` action, identical to pressing `,` |
| 28 | + |
| 29 | +#### Scenario: Inventory button |
| 30 | +- **WHEN** user taps the Inventory button |
| 31 | +- **THEN** system dispatches `OPEN_INVENTORY`, identical to pressing `i` |
| 32 | + |
| 33 | +#### Scenario: Stairs Down button |
| 34 | +- **WHEN** user taps the Stairs Down button |
| 35 | +- **THEN** system dispatches `STAIRS` with direction `down`, identical to pressing `>` |
| 36 | + |
| 37 | +#### Scenario: Stairs Up button |
| 38 | +- **WHEN** user taps the Stairs Up button |
| 39 | +- **THEN** system dispatches `STAIRS` with direction `up`, identical to pressing `<` |
| 40 | + |
| 41 | +#### Scenario: Mute button |
| 42 | +- **WHEN** user taps the Mute button |
| 43 | +- **THEN** mute state toggles, identical to pressing `M` |
| 44 | + |
| 45 | +#### Scenario: Help button |
| 46 | +- **WHEN** user taps the Help button |
| 47 | +- **THEN** help overlay opens, identical to pressing `?` |
| 48 | + |
| 49 | +### Requirement: Swipe gesture movement |
| 50 | +The system SHALL detect swipe gestures on the game map area and translate them to directional movement in `playing` phase. Swipes SHALL support all 8 directions using 45° angle buckets. Minimum swipe distance SHALL be 30px. Maximum swipe duration SHALL be 400ms. |
| 51 | + |
| 52 | +#### Scenario: Cardinal swipe moves player |
| 53 | +- **WHEN** user swipes right on the map area with distance ≥30px within 400ms |
| 54 | +- **THEN** player moves east, identical to pressing `l` or arrow right |
| 55 | + |
| 56 | +#### Scenario: Diagonal swipe moves player |
| 57 | +- **WHEN** user swipes diagonally (e.g. up-right) on the map area |
| 58 | +- **THEN** player moves in the matching diagonal direction (NE) |
| 59 | + |
| 60 | +#### Scenario: Slow swipe ignored |
| 61 | +- **WHEN** user drags finger across map but takes longer than 400ms |
| 62 | +- **THEN** no movement is dispatched |
| 63 | + |
| 64 | +#### Scenario: Short touch ignored |
| 65 | +- **WHEN** user taps map without moving finger 30px |
| 66 | +- **THEN** no movement is dispatched (tap is not a swipe) |
| 67 | + |
| 68 | +### Requirement: Inventory tap-to-select |
| 69 | +The system SHALL make each inventory item row tappable. When no second-key action is pending, tapping an item SHALL present an action sheet with context-appropriate options (Equip/Unequip, Use, Drop). When a second-key action is pending (equip, use, drop, cast), tapping an item SHALL immediately dispatch that action for the tapped item. |
| 70 | + |
| 71 | +#### Scenario: Tap item with no pending action shows action sheet |
| 72 | +- **WHEN** user taps an inventory item and no `awaitingSecondKey` mode is active |
| 73 | +- **THEN** an action sheet appears with relevant options for that item type |
| 74 | + |
| 75 | +#### Scenario: Tap item during equip mode dispatches equip |
| 76 | +- **WHEN** `awaitingSecondKey` is `equip` and user taps an inventory item |
| 77 | +- **THEN** system dispatches `EQUIP` for that item and closes await mode |
| 78 | + |
| 79 | +#### Scenario: Tap item during drop mode dispatches drop |
| 80 | +- **WHEN** `awaitingSecondKey` is `drop` and user taps an inventory item |
| 81 | +- **THEN** system dispatches `DROP` for that item and closes await mode |
| 82 | + |
| 83 | +#### Scenario: Tap item during use mode dispatches use |
| 84 | +- **WHEN** `awaitingSecondKey` is `use` and user taps an inventory item |
| 85 | +- **THEN** system dispatches `USE` for that item and closes await mode |
| 86 | + |
| 87 | +### Requirement: Touch controls prevent default browser behaviour |
| 88 | +All touch event handlers on game controls SHALL call `preventDefault()` to suppress browser scroll, zoom, and double-tap zoom on the game UI. |
| 89 | + |
| 90 | +#### Scenario: No scroll on D-pad touch |
| 91 | +- **WHEN** user touches the D-pad or action buttons |
| 92 | +- **THEN** page SHALL NOT scroll and browser SHALL NOT zoom |
0 commit comments