# Room 31: Open Ocean

This room represents the vast open ocean surrounding the Isle of the Dead. Players swim through the waters encountering various marine life including dolphins (which can be mounted for transportation), schools of fish, whales, and dangerous sharks. The room features dynamic wildlife spawning, drowning mechanics when swimming too far from land, and special whale riding sequences that transport the player to other locations.

## Look Description

"You are swimming in a great ocean. Playful fish leap about you as you swim."

## Interactions

| Status | Behavior Type | Command | Response |
|--------|--------------|---------|----------|
| TODO | Look | `look[<around>][/room,ocean,ocean,water]` (at island) | "You can see an island in the distance." (Print 31 0) |
| TODO | Look | `look[<around>][/room,ocean,ocean,water]` (night mode) | "You are swimming in a great ocean." (Print 31 1) |
| TODO | Look | `look[<around>][/room,ocean,ocean,water]` (on dolphin) | "You are riding a dolphin in a great ocean." (Print 31 2) |
| TODO | Look | `look[<around>][/room,ocean,ocean,water]` (default) | "You are swimming in a great ocean. Playful fish leap about you as you swim." (Print 31 3) |
| TODO | Look | `look[<around>]` (shark present) | "There is a hungry shark approaching!!" (Print 31 4) |
| TODO | Look | `look/shark` | "Just get out of there...fast!!" (Print 31 7) |
| TODO | Look | `look/shark` (no shark present) | "You don't see one here." (Print 31 6) |
| TODO | Look | `look/island` (at island position) | "It's too far in the distance to see it clearly." (Print 31 8) |
| TODO | Look | `look/island` (default) | "What island?" (Print 31 9) |
| TODO | Look | `mount/dolphin` (already riding) | "You ARE riding the dolphin." (Print 31 5) |
| TODO | Look | `mount/dolphin` (not riding) | "You don't see one here." (Print 31 6) |
| TODO | Look | `look/dolphin` (while riding) | "You can feel the dolphin's strong muscles working, as it swims through the ocean with you on its back." (Print 31 10) |
| TODO | Action | `kiss/dolphin` | "There is no need for that." (Print 31 11) |
| TODO | Inventory | `deliver[*]/fish` (to dolphin) | "The fish don't want it." (Print 31 12) |
| TODO | Inventory | `deliver[*]/bird,gull` (to dolphin) | "The seagulls have no interest in it." (Print 31 13) |
| TODO | Inventory | `deliver[*]/dolphin` (item to dolphin) | "The dolphin doesn't want anything." (Print 31 14) |
| TODO | Talk | `converse[/dolphin]` | "You speak to the dolphin, and it chatters back." (Print 31 15) |
| TODO | Action | `pat/dolphin` | "The dolphin's skin feels smooth and slippery as you pet it." (Print 31 16) |

## Scripts

| Status | Behavior Type | Name | Trigger | Behavior |
|--------|--------------|------|---------|----------|
| TODO | Background | fish3Actions | Random 9% chance per frame when not in night mode and no room script running | Spawns a fish (view 300) at random position that swims across screen |
| TODO | Background | fishActions | Random 10% chance per frame when not in night mode and no room script running | Spawns a fish (view 301) at random position that swims across screen |
| TODO | Interaction | drown | Player exceeds edge hit threshold (local3 >= local12 = 4) and is not on dolphin or in whale | Player drowns - displays drowning animation, shows death message, sets game over flag |
| TODO | Interaction | whaleActions | Random 40% chance when not already in whale/dolphin sequence and entering from room 43 or randomly | Plays whale animation, allows player to ride whale to room 44 |
| TODO | Interaction | whaleActions | Entering from room 44 | Performs whale riding entrance sequence - shows whale, positions player, displays message about riding |
| TODO | Interaction | sharkActions | Various random conditions based on position and edge proximity | Spawns shark (view 887) that chases player - triggers death sequence if caught |

## Technical Notes

- **Room Number**: 31
- **Picture**: 31 (day), 131 (night - global100)
- **Region**: 519, 504
- **Exits**: North→1, North→13, Northeast→19, East→25, Northwest→32, North-northwest→41, Northwest→39, Southwest→35, West-southwest→34, West→33, South→43 (whale), Southeast→95
- **Music**: Sound 36 (whaleMusic), Sound 78 (sharkMusic loop)

### State Variables

| Variable | Values | Description |
|----------|--------|-------------|
| `global100` | 0, 1 | Night mode flag - when set, uses alternate picture 131 and prevents random fish spawning |
| `global101` | 0 | Reset to 0 in init |
| `global105` | Room number | Current room - checked for value 14 ( dolphin room) |
| `global109` | 0, 1 | Whale encounter enabled flag |
| `global183` | 0 | Whale state flag - 0 allows whale to appear |
| `global223` | 0, 1 | Dolphin available flag - when set, creates dolphin prop |
| `local1` | 0-5, 100 | Y-position tracking for exit determination |
| `local2` | 0-4, 99, 100 | X-position tracking for exit determination |
| `local3` | 0+ | Edge hit counter - increments on each edge hit |
| `local12` | 4 | Drowning threshold - player drowns when local3 reaches this value |
| `local13` | varies | Stores initial local2 value on room entry |

### Player View States

| View | Meaning |
|------|---------|
| 8 | Swimming (normal ocean swimming) |
| 10 | Drowning/shark attack death animation |
| 312 | Riding dolphin |
| 84 | Whale riding animation |

### Synonyms

- `ocean` = `water`
- `room` = `ocean` (in look commands)
