title: The Mysterious Mansion
author: AI Interactive Fiction
version: 1.0.0
introduction: |
  You find yourself standing outside an old, abandoned mansion on a hill.
  Rain patters gently on the gravel path leading to the front door.
  A strange letter in your pocket invited you here, but you can't remember who sent it.
  Perhaps the answers lie within...

# Room definitions
rooms:
  # Starting area
  front_yard:
    name: Front Yard
    description: |
      You stand on a gravel path leading to an imposing Victorian mansion.
      The rain has softened to a drizzle, and moonlight peeks through gaps in the clouds.
      Ancient oak trees frame the property, their branches swaying in the gentle breeze.
    exits:
      - direction: north
        targetRoomId: entrance_hall
        description: large wooden doors lead into the mansion
      - direction: south
        targetRoomId: street
        description: wrought iron gates lead back to the street
    objects:
      - strange_letter
      - garden_statue
    characters: []

  # Main entrance
  entrance_hall:
    name: Entrance Hall
    description: |
      Grand chandeliers hang from the high ceiling, their crystals covered in cobwebs.
      A wide staircase curves up to the second floor, and paintings of stern-faced
      individuals watch you from ornate frames on the walls.
      The floor is polished marble, though dusty from neglect.
    exits:
      - direction: south
        targetRoomId: front_yard
        description: the main entrance doors
      - direction: north
        targetRoomId: grand_staircase
        description: the grand staircase
      - direction: east
        targetRoomId: dining_room
        description: an archway leads to what appears to be a dining room
      - direction: west
        targetRoomId: library
        description: a door marked 'Library'
    objects:
      - dusty_key
      - umbrella_stand
    characters:
      - butler_ghost

  # Library
  library:
    name: Library
    description: |
      Bookshelves line every wall, reaching from floor to ceiling.
      A reading desk sits in the center of the room, a leather-bound book
      open upon it. A gentle fire crackles in the fireplace, casting
      dancing shadows across the room.
    exits:
      - direction: east
        targetRoomId: entrance_hall
        description: the door back to the entrance hall
      - direction: north
        targetRoomId: secret_study
        description: a hidden door in the bookshelf
        isLocked: true
        keyId: old_brass_key
    objects:
      - leather_book
      - reading_glasses
      - old_brass_key
    characters: []

  # Dining Room
  dining_room:
    name: Dining Room
    description: |
      A long table dominates this room, set for a dinner party that never happened.
      Fine china and silverware rest atop an elegant tablecloth, now gray with dust.
      A chandelier hangs above, and a sideboard against the wall holds various serving dishes.
    exits:
      - direction: west
        targetRoomId: entrance_hall
        description: the archway back to the entrance hall
      - direction: north
        targetRoomId: kitchen
        description: a swinging door to what must be the kitchen
    objects:
      - silver_candlestick
      - dusty_plate
    characters:
      - dining_ghost

  # Kitchen
  kitchen:
    name: Kitchen
    description: |
      This once-busy kitchen now stands silent. Copper pots and pans hang from hooks,
      and an old cast-iron stove sits cold against the wall. A large preparation table
      occupies the center of the room, and a pantry door stands ajar.
    exits:
      - direction: south
        targetRoomId: dining_room
        description: the swinging door back to the dining room
      - direction: east
        targetRoomId: pantry
        description: the pantry door
    objects:
      - rusty_knife
      - cookbook
    characters: []

  # Pantry
  pantry:
    name: Pantry
    description: |
      Shelves line the walls of this small room, holding preserves in dusty jars
      and sacks of long-expired ingredients. A small window provides minimal light,
      and a musty smell permeates the air.
    exits:
      - direction: west
        targetRoomId: kitchen
        description: the door back to the kitchen
    objects:
      - dusty_jar
      - strange_bottle
    characters: []

  # Grand Staircase
  grand_staircase:
    name: Grand Staircase
    description: |
      The staircase curves gracefully upward, its wooden railings polished to a soft glow
      despite the overall neglect of the mansion. Family portraits line the walls,
      following your movement with their painted eyes.
    exits:
      - direction: south
        targetRoomId: entrance_hall
        description: back down to the entrance hall
      - direction: north
        targetRoomId: upper_landing
        description: up to the second floor
    objects:
      - family_portrait
    characters: []

  # Upper Landing
  upper_landing:
    name: Upper Landing
    description: |
      The upper landing connects several rooms on the second floor. A faded
      carpet runs down the center of the hallway, and doors line both sides.
      A large window at the end of the hall shows the rainy night outside.
    exits:
      - direction: south
        targetRoomId: grand_staircase
        description: down the grand staircase
      - direction: east
        targetRoomId: master_bedroom
        description: a door marked 'Master Bedroom'
      - direction: west
        targetRoomId: study
        description: a door marked 'Study'
    objects: []
    characters: []

  # Master Bedroom
  master_bedroom:
    name: Master Bedroom
    description: |
      A large four-poster bed dominates this room, its once-luxurious hangings
      now faded and torn. A vanity sits in the corner, its mirror clouded with age,
      and a wardrobe stands against the far wall.
    exits:
      - direction: west
        targetRoomId: upper_landing
        description: the door back to the upper landing
    objects:
      - jewelry_box
      - old_diary
    characters:
      - lady_ghost

  # Study
  study:
    name: Study
    description: |
      This cozy room contains a large desk covered in papers, a comfortable
      armchair, and a globe that seems to rotate slowly on its own. Bookshelves
      line the walls, filled with volumes on various esoteric subjects.
    exits:
      - direction: east
        targetRoomId: upper_landing
        description: the door back to the upper landing
    objects:
      - strange_device
      - important_letter
    characters: []

  # Secret Study (hidden room)
  secret_study:
    name: Secret Study
    description: |
      Hidden behind the library bookshelf, this small room appears to be a
      private study. A desk with a locked drawer sits against one wall, and
      shelves hold unusual artifacts and rare books. A single candle provides
      dim illumination.
    exits:
      - direction: south
        targetRoomId: library
        description: the hidden door back to the library
    objects:
      - ancient_tome
      - crystal_key
    characters: []

  # Street (exit area)
  street:
    name: Street
    description: |
      The quiet street outside the mansion is shrouded in fog. Streetlamps cast
      pools of yellow light that barely penetrate the mist. The mansion's gates
      loom behind you, while the way back to town lies ahead.
    exits:
      - direction: north
        targetRoomId: front_yard
        description: the mansion gates
    objects: []
    characters: []

# Object definitions
objects:
  strange_letter:
    name: Strange Letter
    description: |
      A weathered envelope containing an invitation to visit the mansion.
      The handwriting is elegant but unfamiliar, and the letter is signed
      simply with the initial "M".
    traits:
      - takeable
      - readable
    states: {}
    allowedActions:
      - take
      - read
      - examine

  garden_statue:
    name: Garden Statue
    description: |
      A weathered stone statue of a weeping angel. Its face is covered by its hands,
      and detailed wings spread out from its back. Something about it makes you uneasy.
    traits:
      - fixed
    states: {}
    allowedActions:
      - examine

  dusty_key:
    name: Dusty Key
    description: |
      An old iron key, covered in dust. It looks like it might fit an old door somewhere.
    traits:
      - takeable
      - key
    states: {}
    allowedActions:
      - take
      - examine
      - use

  umbrella_stand:
    name: Umbrella Stand
    description: |
      A brass stand holding several antique umbrellas, all in various states of decay.
    traits:
      - fixed
      - container
    states:
      open: true
    containedObjects: []
    allowedActions:
      - examine

  leather_book:
    name: Leather Book
    description: |
      A thick tome bound in dark leather. The pages are filled with strange symbols
      and diagrams that seem to shift slightly when you're not looking directly at them.
    traits:
      - takeable
      - readable
    states: {}
    allowedActions:
      - take
      - read
      - examine

  reading_glasses:
    name: Reading Glasses
    description: |
      A pair of wire-rimmed spectacles. The lenses have a slight blue tint to them.
    traits:
      - takeable
      - wearable
    states:
      worn: false
    allowedActions:
      - take
      - wear
      - examine

  old_brass_key:
    name: Brass Key
    description: |
      A small brass key with intricate engravings. It seems to be quite old but well-maintained.
    traits:
      - takeable
      - key
    states: {}
    allowedActions:
      - take
      - examine
      - use

  silver_candlestick:
    name: Silver Candlestick
    description: |
      A tarnished silver candlestick with an unlit candle. It feels heavy in your hand.
    traits:
      - takeable
      - light_source
    states:
      lit: false
    allowedActions:
      - take
      - light
      - examine

  dusty_plate:
    name: Dusty Plate
    description: |
      A fine china plate covered in a layer of dust. Despite its age, the painted pattern is still vivid.
    traits:
      - takeable
    states: {}
    allowedActions:
      - take
      - examine

  rusty_knife:
    name: Rusty Knife
    description: |
      An old kitchen knife with a rusted blade. It's dull, but still might be useful.
    traits:
      - takeable
      - sharp
    states: {}
    allowedActions:
      - take
      - examine
      - use

  cookbook:
    name: Cookbook
    description: |
      A yellowed cookbook filled with strange recipes. Some ingredients are unusual, and
      the instructions sometimes reference phases of the moon or specific star alignments.
    traits:
      - takeable
      - readable
    states: {}
    allowedActions:
      - take
      - read
      - examine

  dusty_jar:
    name: Dusty Jar
    description: |
      A glass jar containing what might once have been fruit preserves, now unidentifiable.
      Best not to open it.
    traits:
      - takeable
      - container
    states:
      open: false
    allowedActions:
      - take
      - examine

  strange_bottle:
    name: Strange Bottle
    description: |
      A small bottle containing a glowing blue liquid. The label is written in a language you don't recognize.
    traits:
      - takeable
      - drinkable
    states: {}
    allowedActions:
      - take
      - drink
      - examine

  family_portrait:
    name: Family Portrait
    description: |
      A large painting of a stern-looking family - a husband, wife, and three children.
      The father's eyes seem to follow you, and there's something oddly familiar about his face.
    traits:
      - fixed
    states: {}
    allowedActions:
      - examine

  jewelry_box:
    name: Jewelry Box
    description: |
      An ornate wooden box inlaid with mother-of-pearl. Inside are several pieces of
      antique jewelry, including a ruby necklace that catches the light strangely.
    traits:
      - takeable
      - container
    states:
      open: true
    containedObjects:
      - ruby_necklace
    allowedActions:
      - take
      - open
      - close
      - examine

  ruby_necklace:
    name: Ruby Necklace
    description: |
      A delicate gold chain with a large ruby pendant. The gem seems to glow with an inner light,
      and it feels warm to the touch.
    traits:
      - takeable
      - wearable
    states:
      worn: false
    allowedActions:
      - take
      - wear
      - examine

  old_diary:
    name: Old Diary
    description: |
      A leather-bound diary with yellowed pages. The entries detail the daily life of
      the mansion's former mistress, and hint at a growing fear of something in the house.
    traits:
      - takeable
      - readable
    states: {}
    allowedActions:
      - take
      - read
      - examine

  strange_device:
    name: Strange Device
    description: |
      A brass contraption with gears, dials, and a glass dome. It's purpose isn't clear,
      but it occasionally ticks and whirs on its own.
    traits:
      - takeable
    states:
      active: false
    allowedActions:
      - take
      - use
      - examine

  important_letter:
    name: Important Letter
    description: |
      A sealed envelope addressed to "The Heir." The wax seal bears the same crest
      that you've seen throughout the mansion.
    traits:
      - takeable
      - readable
    states: {}
    allowedActions:
      - take
      - read
      - examine

  ancient_tome:
    name: Ancient Tome
    description: |
      A massive book bound in what appears to be human skin. The title, "Liber Umbrarum,"
      is embossed in gold on the spine. The pages contain rituals and incantations.
    traits:
      - takeable
      - readable
    states: {}
    allowedActions:
      - take
      - read
      - examine

  crystal_key:
    name: Crystal Key
    description: |
      A key made of clear crystal that catches the light in mesmerizing ways. Despite
      its appearance, it feels as solid as metal and cool to the touch.
    traits:
      - takeable
      - key
    states: {}
    allowedActions:
      - take
      - use
      - examine

# Character definitions
characters:
  butler_ghost:
    name: Ghostly Butler
    description: |
      The translucent figure of an elderly butler, dressed in formal attire from a bygone era.
      He stands with perfect posture, hands clasped behind his back.
    dialogue:
      greeting: "Welcome to the mansion, sir/madam. We've been expecting you."
      mansion: "This estate has belonged to the Montgomery family for generations. Such a shame what happened to them."
      family: "The Montgomerys? All gone now, I'm afraid. The master, his wife, and their children. A tragedy."
      tragedy: "I'm not at liberty to discuss the details, but the answers you seek may be found in the study."
      yourself: "Me? I've served this house for longer than I care to remember. Even death couldn't release me from my duties."
    defaultResponse: "I'm afraid I cannot help you with that particular inquiry."
    inventory: []
    mood: formal

  dining_ghost:
    name: Dining Guest
    description: |
      A spectral figure in elegant dinner attire, seated at the table. She appears to be
      a young woman, and she plays absently with a spectral fork.
    dialogue:
      greeting: "Oh, a new guest! How delightful. Will you join us for dinner? It's been so long since we had fresh company."
      dinner: "We've been waiting for the main course for... goodness, how long has it been now? Years, I suppose."
      herself: "My name? It's... it's strange, I can't quite recall. I remember coming here for a dinner party, but then..."
      party: "It was supposed to be a celebration. The master of the house had made some sort of discovery. Something important."
      discovery: "In the secret study, I believe. Behind the library. The master was very excited about it."
    defaultResponse: "I'm sorry, my mind isn't what it used to be. The years blur together when you're like this."
    inventory: []
    mood: wistful

  lady_ghost:
    name: Ghostly Lady
    description: |
      The elegant apparition of a woman in Victorian dress, her face partly obscured by a veil.
      She sits at the vanity, brushing her long hair with a ghostly brush.
    dialogue:
      greeting: "A visitor? How unusual. Are you lost, or are you here for a purpose?"
      purpose: "Everyone who comes to this house has a purpose, whether they know it or not."
      herself: "I was the lady of this house once. Now I am bound to it, as are we all."
      family: "My husband was obsessed with his research. My children... I tried to protect them. I failed."
      research: "The barriers between worlds, the nature of reality itself. He found something, in the end. Something that should have remained hidden."
      hidden: "In his secret study. The key is... well, I suppose you'll have to find that yourself. Some secrets reveal themselves only to those who seek them."
    defaultResponse: "There are some things I cannot speak of. The house has its rules, even for the dead."
    inventory: []
    mood: melancholy

# Action definitions
actions:
  look:
    patterns:
      - "look around"
      - "look at [object]"
      - "examine [object]"
      - "check [object]"
      - "inspect [object]"
      - "observe [object]"
      - "view [object]"
    handler: "look"

  go:
    patterns:
      - "go [direction]"
      - "move [direction]"
      - "walk [direction]"
      - "head [direction]"
      - "travel [direction]"
      - "enter [direction]"
    requiresObject: true
    handler: "go"

  take:
    patterns:
      - "take [object]"
      - "get [object]"
      - "pick up [object]"
      - "grab [object]"
      - "collect [object]"
    requiresObject: true
    handler: "take"

  drop:
    patterns:
      - "drop [object]"
      - "put down [object]"
      - "discard [object]"
      - "leave [object]"
    requiresObject: true
    handler: "drop"

  inventory:
    patterns:
      - "inventory"
      - "check inventory"
      - "show inventory"
      - "what am I carrying"
      - "what do I have"
    handler: "inventory"

  use:
    patterns:
      - "use [object]"
      - "use [object] on [target]"
      - "use [object] with [target]"
      - "apply [object] to [target]"
    requiresObject: true
    requiresTarget: false
    handler: "use"

  talk:
    patterns:
      - "talk to [object]"
      - "speak to [object]"
      - "ask [object] about [topic]"
      - "tell [object] about [topic]"
      - "converse with [object]"
    requiresObject: true
    handler: "talk"

  read:
    patterns:
      - "read [object]"
      - "read from [object]"
      - "examine [object]"
      - "look at [object]"
    requiresObject: true
    handler: "look"

  help:
    patterns:
      - "help"
      - "commands"
      - "what can I do"
      - "show help"
    handler: "help"

  wear:
    patterns:
      - "wear [object]"
      - "put on [object]"
      - "don [object]"
    requiresObject: true
    handler: "use"

# Initial game state
initialState:
  currentRoomId: front_yard
  inventory:
    - strange_letter
  visitedRooms: []
  flags:
    hasMetButler: false
    hasFoundSecret: false
  counters:
    moveCount: 0