# Room 18: Cemetery

## Look Description

"This is a scary old cemetery! Many of the tombstones are crumbling or falling over, and the entire place is overgrown with weeds. A mountain range looms to the east, and all around a forest encroaches."

## Interactions

| Status | Behavior Type | Command | Response |
|--------|--------------|---------|----------|
| TODO | Look | `/boulder` | "There are rocks here and there." |
| TODO | Look | `/grass` | "Tufts of grass and weeds sprout around the old tombstones." |
| TODO | Look | `/crypt` | "The stone crypt is built into the mountainside!" |
| TODO | Look | `/cliff` | "A stone crypt is built into the mountainside." |
| TODO | Look | `/gravestone` | "Each tombstone has an epitaph written on it." |
| TODO | Look | `/monument,lion` | "An interesting statue of a lion is mounted above the crypt door." |
| TODO | Look | `/door` (closed) | "The crypt door is closed." |
| TODO | Look | `/door` (open) | "The crypt door is open." |
| TODO | Look | `/hole` (has hole nearby) | "The hole is empty." |
| TODO | Look | `/hole` (no holes) | "You don't see it here." |
| TODO | Look | `[<around][/room]` | "This is a scary old cemetery! Many of the tombstones are crumbling or falling over, and the entire place is overgrown with weeds. A mountain range looms to the east, and all around a forest encroaches." + "How odd! You see a crypt door built right into the mountainside!" |
| TODO | Action | `climb/boulder` | "You're not interested in climbing rocks." |
| TODO | Action | `open,enter/crypt` (open) | "The door is open; just enter it." |
| TODO | Action | `open,enter/crypt` (closed) | "Try opening the crypt door." |
| TODO | Action | `/door break` | "You could never do that." |
| TODO | Action | `/door bang` | "You pound on the door and hear your knocks echo from within. There is no answer." |
| TODO | Action | `/door open` (locked) | "The door is locked." |
| TODO | Action | `/door open` (unlocked) | Opens the crypt door |
| TODO | Action | `/door open` (already open) | "The crypt door is already open." |
| TODO | Action | `/door close` (open) | "The door is closed." (and closes door) |
| TODO | Action | `/door close` (closed) | "The door is closed." (no action) |
| TODO | Action | `/door latch` (no key) | "You don't have the right key to lock this door." |
| TODO | Action | `/door latch` (closed & unlocked, has key) | Locks the door with skeleton key |
| TODO | Action | `/door latch` (already locked) | "The door is already locked." |
| TODO | Action | `/door latch` (open) | "First you need to close the door." |
| TODO | Action | `/door unlatch` (locked) | Unlocks the door |
| TODO | Action | `/door unlatch` (already unlocked) | "The door is already unlocked." |
| TODO | Action | `/door unlatch` (open) | "The door is already open." |
| TODO | Action | `/door unlatch` (no key) | "You don't have the key to unlock this door." |
| TODO | Action | `dig[/hole,grave]` (has shovel) | Digs a hole at the current location |
| TODO | Action | `dig[/hole,grave]` (no shovel) | "You have nothing to dig with." |
| TODO | Action | `dig[/hole,grave]` (no dig target) | "You don't know what to dig for...yet." |
| TODO | Action | `dig[/hole,grave]` (wrong location) | "Try somewhere else. The ground is too hard here." |
| TODO | Talk | `read,look/epitaph,gravestone,boulder` | Reads epitaph based on player position |

## Scripts

| Status | Behavior Type | Name | Trigger | Behavior |
|--------|--------------|------|---------|----------|
| TODO | Interaction | `z1Actions` | Timer (10 seconds) when `global100` is set | Spawns zombie #1 at position (25, 156). Zombie chases player if `global105 = 0`. If player has scarab (item 7), zombie retreats. Otherwise, player is captured (game over). |
| TODO | Interaction | `z4Actions` | Timer (4 seconds) when `global100` is set | Spawns zombie #2 at position (109, 131). Same behavior as z1Actions. |
| TODO | Interaction | `z5Actions` | Timer (8 seconds) when `global100` is set | Spawns zombie #3 at position (220, 165). Same behavior as z1Actions. |
| TODO | Interaction | `digging` | Player uses dig command with shovel | Animates digging. If player digs in correct location with proper quest state, reveals items (toy horse or locket). |
| TODO | Interaction | `getItems` | Triggered after finding an item while digging | Plays pickup animation and adds item to inventory |

## Technical Notes

- **Room Number**: 18
- **Picture**: 18
- **Region**: 510, 511 (cemetery regions)
- **Exits**: North→12, South→24, West→17, East→69 (crypt interior - via door)
- **Music**: Sound 20 (zombie theme)

### State Variables

| Variable | Values | Description |
|----------|--------|-------------|
| `global174` | 0, 1, 2 | Door state: 0=locked, 1=closed/unlocked, 2=open |
| `global105` | 0, 17 | Zombie chase state: 0=zombies chase player, 17=player escaped |
| `global186` | number | Count of active zombies |
| `global187` | 0, 1 | Score flag for unlocking door |
| `global113` | number | Number of holes dug in cemetery |
| `global134` | number | Quest state for digging (determines which item is found) |
| `global100` | boolean | Whether overlay 118 is active (nighttime/zombie event) |
| `global101` | 0 | Reset to 0 on room entry |

### Synonyms

- `kiss` = kiss, embrace
- `ghoul` = ghoul, man, ghoul

### Inventory Items Referenced

- Item 7: Obsidian scarab (protects against zombies)
- Item 15: Shovel (for digging)
- Item 20: Skeleton key (for locking/unlocking door)
- Item 28: Locket (found by digging)
- Item 30: Toy horse (found by digging)

### Special Mechanics

- The crypt door can be locked/unlocked with the skeleton key (item 20)
- Three zombies spawn at intervals when `global100` is set (nighttime event)
- Zombies chase the player unless they have the obsidian scarab (item 7)
- Digging with a shovel can reveal hidden items at specific grave locations
- Player can read epitaphs on tombstones based on their position in the room
- Entering room 69 (crypt) changes player movement parameters
