# Room 57: Witch Cave (filename: `57-witch-cave.md`)

This room is a dismal cave inhabited by three one-eyed old witches. The room features a central cauldron bubbling over a fire, various jars and bottles on shelves, and a human skull. The witches are a significant puzzle in the game - they possess a glass eye (item 6) that enables them to see, and players can interact with them in multiple ways including stealing or returning the eye, collecting a scarab beetle (item 7), and avoiding being transformed.

## Look Description

"This is a dismal and dreary cave. In the center of the cave, over a hot fire, boils a foul-smelling brew inside a large black cauldron."

When `global109 >= 3`: "Within it, reside three one-eyed old witches."

If scarab is on floor: "You see a black scarab on the cave floor."

## Interactions

| Status | Behavior Type | Command | Response |
|--------|--------------|---------|----------|
| TODO | Look | `/bottle` | "You don't want them." (Print 57 16) |
| TODO | Look | `/caldron` | "A greenish, foul brew boils ominously within the cauldron." (Print 57 18) |
| TODO | Look | `/brew` | "The green brew looks disgusting...and smells that way, too!" (Print 57 19) |
| TODO | Look | `/fire` | "A hot fire burns under a large cauldron filled with bubbling brew." (Print 57 20) |
| TODO | Look | `<out/cave` | "Outside the cave, you see the terrible grabbing trees." (Print 57 21) |
| TODO | Look | `/dirt` or `<down` | If `global207` (scarab present): "You see a black scarab on the cave floor." (Print 57 22) / Else: "There is nothing of interest on the cave floor." (Print 57 23) |
| TODO | Look | `/wall` | "There is nothing of interest on the rough cave walls." (Print 57 24) |
| TODO | Look | `/shelf` | "You see bottles and jars of disgusting-looking stuff. None of it interests you, though." (Print 57 25) |
| TODO | Look | `/skull` | "You shiver at the sight of a human skull on the shelf." (Print 57 26) |
| TODO | Look | `[<around,in][/room,cave]` or `[/!*]` | Dynamic description combining cave appearance and witch/scarab presence (Print 57 17) |
| TODO | Look | `/eye` | "The blind, one-eyed hags peer at you through a glass eye." (Print 57 3) - Only if eye owned by room 57 |
| TODO | Look | `/hag` | Varies based on whether player has eye, local10 state, or if eye is owned by -1 (Print 57 4/5/6) |
| TODO | Get | `/bottle` | "You don't want any of them." (Print 57 27) |
| TODO | Get | `/skull` | "You don't need it." (Print 57 28) |
| TODO | Get | `/brew` | "You wouldn't want it!" (Print 57 29) |
| TODO | Get | `/caldron` | "It's too heavy to carry." (Print 57 31) |
| TODO | Action | `chew,drink/brew` | "You gag at the thought!" (Print 57 30) |
| TODO | Talk | `converse` | Different responses based on eye ownership: (answer1/answer2/answer3 scripts) |
| TODO | Inventory | `rob,get/charm` | If has scarab: "You already have the scarab." (Print 800 0) / If no scarab and !global207: "What scarab?" (Print 57 7) / If far from scarab: "You can't get that." (Print 800 1) / Else: triggers pickUp script |
| TODO | Inventory | `get,rob/eye` | If doesn't have eye and eye owned by room 57: Must be in rect 119-129 x 122-136 to pick up (+3 score, sets global182) (Print 57 8/9) |
| TODO | Inventory | `deliver,return,fling/eye` | If has eye: various responses based on local10 state, triggers witchMoan script (Print 57 10/11) |
| TODO | Action | `/hag kill` | "You couldn't do it." (Print 57 12) |
| TODO | Action | `/hag get` | "You wouldn't want them." (Print 57 13) |
| TODO | Action | `/hag kiss` | "YUCK!!" (Print 57 14) |
| TODO | Action | `/hag deliver` | "The witches don't want it." (Print 57 15) |

## Scripts

| Status | Behavior Type | Name | Trigger | Behavior |
|--------|--------------|------|---------|----------|
| TODO | Interaction | rm57Script | Entry (when `global109 >= 3` and has eye but not scarab) | Throws scarab to player, then pleads for eye return |
| TODO | Interaction | pickUp | Player uses `get charm` with scarab present | Animates picking up scarab (+2 score, sets global207) |
| TODO | Interaction | answer1 | Player talks to witches with eye owned by room | Prints dialogue sequence about witches (Print 57 34-36) |
| TODO | Interaction | answer2 | Player talks to witches with eye in inventory | Random dialogue about witches begging for eye (Print 57 37-40) |
| TODO | Interaction | answer3 | Player talks to witches without eye | Dialogue enticing player closer (Print 57 41-43) |
| TODO | Background | witchEye | Continuous when witches active | Animates witch eyes looking around, switches between witches |
| TODO | Background | witchChase | Player gets close to witches without eye (distance < 30) | Witches chase and transform player into newt/creature |
| TODO | Background | witchMoan | Triggered when eye delivered or after transformation | Witches react to receiving eye, eventually release player |
| TODO | Background | scarabToss | Scarab present in room | Animates scarab moving/jumping |
| TODO | Background | ouchness | Player touches control area $0004 (hot zone) | Prints "Ouch!" (Print 57 0) |

## Technical Notes

- **Room Number**: 57
- **Picture**: 57
- **Style**: $0010 (DISPATCH style)
- **Exits**: South → Room 6
- **Music**: Sound 12 (witchMusic) - plays during witch encounter

### State Variables

| Variable | Values | Description |
|----------|--------|-------------|
| `global109` | 0-3+ | Game progress - witches appear when >= 3 |
| `global182` | 0, 1 | Glass eye collected flag (score awarded) |
| `global207` | 0, 1 | Scarab present in room (collected or not) |
| `global189` | 0, 1 | Room initialization flag |
| `global101` | 1 | Set to 1 in init |
| `global228` | string | Format buffer for room description |
| `local10` | 0, 1 | Eye delivered state (0 = not delivered, 1 = delivered) |
| `local12` | 0, 1 | Transformation/cutscene active flag |
| `local13` | 0, 1 | Ouch sound cooldown flag |
| `newAct` | instance | Scarab actor instance |
| `newAct_2` | instance | Witch actor instance |
| `newProp_4` | instance | Witch eye prop (visible when witch looking) |
| `newProp_5` | instance | Left witch prop |
| `newProp_6` | instance | Right witch prop |
| `newProp_7` | instance | Left witch full prop |
| `newProp_8` | instance | Right witch full prop |

### Inventory Items Referenced

| Item Index | Item Name |
|------------|-----------|
| 6 | Glass Eye (charm) |
| 7 | Black Scarab |

### Synonyms

- `dirt` = `dirt`
- `hag` = `fishwife`

### Key Mechanics

1. **Witch Transformation**: When approaching the witches without the glass eye, they chase and transform the player into a creature (view 184 or 186 depending on position). This is triggered when `distanceTo(newAct_2) < 30` and player doesn't have item 6.

2. **Glass Eye Puzzle**: The eye can be stolen from the witches (requires standing in specific rect), returned to them, or flung. Returning the eye unlocks the scarab throw and allows further interaction.

3. **Scarab Collection**: After returning the eye, witches throw a scarab to the player. The scarab can then be picked up for +2 score.

4. **Hot Zone**: The area over the fire (control area $0004) causes "Ouch!" message when touched.
