# Room 78: Swamp Island (Cobra/Fruit)

This is the swamp island where a HUGE cobra guards a magical fruit tree. The player must use the flute to hypnotize the cobra in order to retrieve the fruit needed to save their father. The room features a dangerous jump across grass tufts to reach the island, and a snake that blocks access to the fruit until mesmerized.

## Look Description

"You see a small island in the middle of the huge swamp. Upon this island grows a scrawny little tree. %s Unfortunately, a huge cobra protects it."

(Note: %s is replaced with fruit description when present: "A large, glistening fruit hangs from a small branch.")

## Interactions

| Status | Behavior Type | Command | Response |
|--------|--------------|---------|----------|
| TODO | Look | `look cobra` / `look snake` | "A HUGE cobra protects the small tree that bears the wondrous fruit; the fruit that your father's life depends upon." (if fruit in room) / "A HUGE cobra protects the small island." (if fruit taken) |
| TODO | Look | `look forest` / `look tree` | "The tree is small and scrawny. It looks like it's taken almost every ounce of its strength to produce this one, wondrous fruit." (if fruit in room) / "The small tree looks bare and lonely without its marvelous fruit. Oh, well; in a mere hundred years it'll have another one." (if fruit taken) |
| TODO | Look | `look fruit` | "You see a single glistening fruit upon the scrawny tree." (if fruit in room and not owned) / "You don't see one here." (if not in room) / Shows fruit if already in inventory |
| TODO | Look | `look island` | "A tiny tree grows on this little swamp island. Hanging from a small branch is a large, glistening fruit." (if fruit in room) / "A tiny tree grows on this little swamp island." (if fruit taken) |
| TODO | Look | `look grass tuft` / `look grass` | "The grass tufts lead to the small island." |
| TODO | Look | `look around` / `look [room/marsh]` | "You see a small island the huge swamp. in the middle of Upon this island grows a scrawny little tree. %s Unfortunately, a huge cobra protects it." (with conditional fruit text) |
| TODO | Look | `look * [cobra]` | Various cobra-specific responses |
| TODO | Talk | `talk cobra` / `talk` | "Cobras don't usually talk." |
| TODO | Action | `kill cobra` / `kill snake` | "You have NO way of killing a big cobra." |
| TODO | Action | `get cobra` / `capture cobra` | "You wouldn't want the cobra!" |
| TODO | Action | `kiss cobra` / `kiss` | "That is NOT a good idea!" |
| TODO | Action | `hit cobra` / `hit snake` | "You couldn't get close enough. Besides, the cobra's too big!" |
| TODO | Action | `hop` | Triggers jump script if player is on left side of screen (x < 109) |
| TODO | Get | `get fruit` | Retrieves fruit if player is in correct position, has nothing, and snake is hypnotized or not in room. Awards 10 points. |
| TODO | Get | `get board` | Picks up board if in room and player is in correct position near board location |
| TODO | Action | `lay board` / `place board` | Places board as bridge if player has board and is in correct position |
| TODO | Inventory | `play flute` | Mesmerizes the cobra if player has flute (item 0) and snake is not already hypnotized. Awards 4 points. |
| TODO | Inventory | `deliver [item] to cobra` | "The snake does not require anything from you." |
| TODO | Inventory | `fling [item] to cobra` | "The snake would not be affected by that." |

### Swamp Region (513) Interactions

| Status | Behavior Type | Command | Response |
|--------|--------------|---------|----------|
| TODO | Look | `look water` | "The mucky swamp spreads in all directions." |
| TODO | Look | `look forest` | "Large, moss-draped trees grow abundantly here." |
| TODO | Look | `look grass` / `look tuft` | "The ground is mostly covered with a swampy quagmire. You notice tufts of swamp grass poking up from the murky water." / "You notice some grass tufts leading eastward." |
| TODO | Look | `look dirt` | "The ground is mostly covered with a swampy quagmire." |
| TODO | Action | `drink` | "You kneel down and drink the mucky swamp water. Yech!! It tastes AWFUL!" (if in normal form) / "Yech!! It tastes AWFUL!" (if in frog form) |
| TODO | Action | `dennis crown` / `place crown` | Transforms player into frog if in the swamp area and has crown (item 10). Sets `global105 = 13` (frog form state). |
| TODO | Action | `detach crown` / `get off crown` | Reverts player from frog form if `global105 = 13`. Sets `global105 = 12` (normal state). |
| TODO | Action | `get water` | "You have no reason to carry water." |
| TODO | Action | `get blossom` | "You don't see many flowers in a swamp." |
| TODO | Action | `climb cliff` | "The mountain is too difficult to climb." |
| TODO | Action | `enter fish` / `cast pole` | "You don't see any fish here." |
| TODO | Action | `bathe` / `dive` / `wade` | "Just enter the swamp if you wish to try that." |

## Scripts

| Status | Behavior Type | Name | Trigger | Behavior |
|--------|--------------|------|---------|----------|
| TODO | Interaction | jump | Player types 'hop' command | Handles jumping across the swamp. Checks player position and state, plays jump animation using view 69, moves player to target coordinates defined in local2 array. Awards 2 points on first jump. |
| TODO | Background | snakeActions | Continuous | Controls the cobra behavior. States: idle (1-2), hypnotized (20-21), attacking (10-13), and death sequence. Uses view 330 for snake animation. |
| TODO | Interaction | boardActions | Placing or picking up board | Handles board placement and pickup. State 1: laying board animation. State 2: board appears. State 3: board in place (tracks proximity with global132). State 10: picking up board animation. Awards 2 points for first board placement. |
| TODO | Background | fruitActions | Continuous (if fruit in room) | Animates the magical fruit with a blinking/cycling effect. Cycles between cel states. |
| TODO | Background | swamp | Continuous (region script) | Monitors player position in swamp. Handles terrain-based view changes (normal vs frog form). Controls player movement restrictions based on `global105` state (12 = normal, 13 = frog). Handles death in quicksand areas. |
| TODO | Interaction | drinking | Player attempts to drink swamp water | Animation of player drinking swamp water. Plays drinking sound, shows message. |

## Technical Notes

- **Room Number**: 78
- **Picture**: 78 (178 if `global100` is set - alternate picture variant)
- **Region**: 513 (Swamp Region)
- **Exits**: West→77 (mainland), East→78 (self/loopback)
- **Music**: Sound 50 (theme), Sound 39 (snake theme), Sound 40 (snake attack), Sound 55 (charm/magic)

### State Variables

| Variable | Values | Description |
|----------|--------|-------------|
| `global105` | `0`, `12`, `13` | Player form state: 12 = normal, 13 = frog transformation (crown used), 0 = in water/transformation |
| `global127` | `0`, `1` | Death flag - set to 1 when player dies (snake bite or quicksand) |
| `global132` | `0`, `1` | Board proximity flag - set to 1 when player is near placed board |
| `global155` | `0`, `1` | Flute score awarded flag - prevents re-awarding points for mesmerizing snake |
| `global201` | `0`, `1` | Board score awarded flag - prevents re-awarding points for placing board |
| `local0` | `-1` to `6` | Jump counter - tracks jump sequence progress |
| `local1` | number | Jump Y position tracker |
| `local22` | `0`, `1`, `2`, `3` | Snake state: 0 = initial, 1 = approached (player jumped to island), 2 = hypnotized, 3 = triggered (player too close after hypnotized) |
| `global100` | `0`, `1` | Alternate picture flag - if set, uses picture 178 |
| `global101` | `0` | Room initialization flag |

### Additional Technical Details

- Synonyms defined: `kiss` = `embrace`, `cobra` = `cobra`
- Region synonyms (513): `water` = `water` = `marsh`
- Player starts with view 2 (normal) on entering
- Jump requires player to be on left side (x < 109) of screen
- Board can only be placed when player x < 109 and on correct terrain (control area 1024 or local0 = 5)
- Fruit can only be picked up from position (171-195, 157-167)
- Snake hypnotization requires flute (item 0) and triggers state change in snakeActions script
- The board (item 22) must be placed to safely cross to island
- Region 513 handles frog transformation mechanics with crown (item 10)
- First jump awards 2 points (`global201`), first board placement awards 2 points (`global201`), first flute use awards 4 points (`global155`), fruit pickup awards 10 points

### Inventory Item Reference

- Item 0: Flute (required to hypnotize snake)
- Item 10: Crown (required for frog transformation)
- Item 22: Board (used to create bridge to island)
- Item 25: Magical Fruit (quest item to save father)
