# Room 16: Graveyard

This is a dark, run-down cemetery located in the forest. The room features multiple gravestones with epitaphs, an old rotting tree, a cross marking one grave, and a mysterious hole in the forest. At night (when global100 is set), three zombies emerge from the ground and chase the player if they don't have the obsidian scarab (item 7). Players can use the shovel (item 15) to dig at graves and potentially find treasure (gold coins at the miser's grave, silver baby rattle at the baby's grave, or Medal of Honor at the lord's grave).

## Look Description

"This run-down, gloomy cemetery gives you the creeps! Many of the old tombstones have fallen over, and the entire place is overgrown with grass and weeds."

## Interactions

| Status | Behavior Type | Command | Response |
|--------|--------------|---------|----------|
| TODO | Look | `look gravestone` | "Each tombstone has an epitaph written on it." |
| TODO | Look | `look/read epitaph` / `look/read gravestone` / `look/read boulder` | Displays epitaph text based on control area (various humorous epitaphs for different graves) |
| TODO | Look | `look in/forest` / `look forest<hole` | "There is nothing of importance in the old tree." (when in forest rectangle) |
| TODO | Look | `look cross` | "One of the graves is marked by a cross." |
| TODO | Look | `look forest` | "An old, rotting tree adds appropriate charm to the decrepit cemetery." |
| TODO | Look | `look hole` | "The hole is empty." (if hole exists) or "There is nothing of importance in the old tree." (if near hole in forest area) |
| TODO | Look | `look around` / `look room` | "This run-down, gloomy cemetery gives you the creeps! Many of the old tombstones have fallen over, and the entire place is overgrown with grass and weeds." |
| TODO | Action | `dig/grave` / `dig/hole` | Digs a grave with shovel (if has shovel and shovel is not already used), finds treasure based on grave location |

## Scripts

| Status | Behavior Type | Name | Trigger | Behavior |
|--------|--------------|------|---------|----------|
| TODO | Interaction | z1Actions | At night (global100=1), after 4 seconds | First zombie emerges from ground, chases player if global105=0 (normal), otherwise wanders. If player has scarab (item 7), zombie retreats. If player doesn't have scarab, triggers death sequence (sets global105=17, plays death animation, game over). |
| TODO | Interaction | z2Actions | At night (global100=1), after 10 seconds | Second zombie emerges from ground, same behavior as z1Actions |
| TODO | Interaction | z3Actions | At night (global100=1), after 15 seconds | Third zombie emerges from ground, same behavior as z1Actions |
| TODO | Interaction | digging | Player uses `dig` command with shovel | Player enters digging animation, creates hole, checks control area for treasure. Finds bag of gold coins (miser's grave), silver baby rattle (baby's grave), or Medal of Honor (lord's grave). Awarded 3 points for each find. |
| TODO | Interaction | getItems | After finding treasure during dig | Plays pickup animation, displays found item message |
| TODO | Background | holeActions | Continuous | Animates the hole in the ground (cycles through cel values) |

## Technical Notes

- **Room Number**: 16
- **Picture**: 16
- **Region**: 510 (Cemetery region)
- **Exits**: North→10, South→22, East→17, West→15
- **Music**: Zombie theme (sound #20, looping)

### State Variables

| Variable | Values | Description |
|----------|--------|-------------|
| `is_night` | `true` (global100=1), `false` (global100=0) | Whether it's nighttime (zombies appear when true) |
| `player_state` | `0` (normal), `17` (dead/captured) | Tracks player state - set to 17 when caught by zombie |
| `holes_dug` | `0-5+` (global113) | Number of holes dug in cemetery |
| `grave_type` | `1`, `2`, `4`, `5` (global134) | Which grave contains treasure (1=baby, 2=miser, 4=lord, 5=ghost) |
| `zombie_active_count` | `0-3` (global186) | Number of zombies currently active |
| `zombie_engaged` | `0`, `1` (global189) | Whether player has engaged with zombies |
| `shovel_broken` | `true`, `false` | Whether shovel has been used (loop? = 1) |

### Additional Technical Details

- Synonyms defined: `kiss` = `kiss` = `embrace`, `ghoul` = `ghoul` = `ghoul` = `man` = `ghoul` = `ghoul`
- Three zombies (newAct, newAct_2, newAct_3) spawn at positions 250,116, 70,123, and 103,172 respectively
- Zombies use views 260/261, 262/263, 264/265 for hidden/visible states
- Player needs obsidian scarab (item 7) to repel zombies
- Can dig up to 5 holes before shovel breaks
- Found items: item 12 (silver baby rattle), item 13 (bag of gold coins), item 29 (Medal of Honor)
- Score +3 awarded for each treasure found
- Holes are stored in gNewPropX array with room number and coordinates
- Control areas ($0008, $0020, $0100, $0200, $0004, $0002, $0080, $0040, $0010, $0400, $1000) determine which epitaph displays and which treasure is at each grave location
