semesterprojekt: implement full text adventure (phases 1-7)
Walking skeleton through Swing GUI: YAML-driven world (4 rooms, 4 items, 1 NPC), HashMap command dispatch with parser, three-tier item hierarchy (readable / switchable / plain), and end-to-end NPC give/receive flow. 67 tests green.
This commit is contained in:
12
Semesterprojekt/src/main/resources/logback.xml
Normal file
12
Semesterprojekt/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<configuration>
|
||||
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<target>System.err</target>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} %-5level %logger{0} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDERR"/>
|
||||
</root>
|
||||
</configuration>
|
||||
7
Semesterprojekt/src/main/resources/world/game.yaml
Normal file
7
Semesterprojekt/src/main/resources/world/game.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
title: Haunted Manor
|
||||
version: "1.0"
|
||||
startRoom: kitchen
|
||||
startGold: 0
|
||||
welcomeMessage: |
|
||||
Welcome to the Haunted Manor.
|
||||
Type 'help' to see available commands.
|
||||
24
Semesterprojekt/src/main/resources/world/items.yaml
Normal file
24
Semesterprojekt/src/main/resources/world/items.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
- type: readable
|
||||
id: letter
|
||||
name: Letter
|
||||
description: A crumpled piece of paper.
|
||||
readText: |
|
||||
"Meet me at midnight in the cellar. - A."
|
||||
|
||||
- type: switchable
|
||||
id: lamp
|
||||
name: Oil Lamp
|
||||
description: An old oil lamp, heavy with fuel.
|
||||
initialState: false
|
||||
onText: The lamp flares to life, casting a warm glow.
|
||||
offText: You snuff out the lamp.
|
||||
|
||||
- type: plain
|
||||
id: shovel
|
||||
name: Shovel
|
||||
description: A rusty shovel. Sturdy enough to dig.
|
||||
|
||||
- type: plain
|
||||
id: key
|
||||
name: Brass Key
|
||||
description: A small brass key, polished from use.
|
||||
12
Semesterprojekt/src/main/resources/world/npcs.yaml
Normal file
12
Semesterprojekt/src/main/resources/world/npcs.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
- id: old_man
|
||||
name: Old Man
|
||||
description: A stooped old man with a grey beard.
|
||||
greeting: |
|
||||
"Hello, traveller. If you bring me the oil lamp,
|
||||
I will give you the key to the cellar."
|
||||
reactions:
|
||||
- onReceive: lamp
|
||||
response: |
|
||||
"Thank you! Here, take this key."
|
||||
gives: key
|
||||
consumes: lamp
|
||||
41
Semesterprojekt/src/main/resources/world/rooms.yaml
Normal file
41
Semesterprojekt/src/main/resources/world/rooms.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
- id: kitchen
|
||||
name: Old Kitchen
|
||||
description: |
|
||||
A dusty kitchen. Cobwebs hang from the rafters
|
||||
and a letter lies on the table.
|
||||
exits:
|
||||
north: hallway
|
||||
east: cellar
|
||||
items: [letter, lamp]
|
||||
npcs: [old_man]
|
||||
|
||||
- id: hallway
|
||||
name: Dark Hallway
|
||||
description: |
|
||||
A long, dimly lit hallway. It smells musty.
|
||||
Faint footsteps echo somewhere far away.
|
||||
exits:
|
||||
south: kitchen
|
||||
west: library
|
||||
items: []
|
||||
npcs: []
|
||||
|
||||
- id: library
|
||||
name: Library
|
||||
description: |
|
||||
Tall shelves crammed with mouldering books.
|
||||
An old chest stands in the corner.
|
||||
exits:
|
||||
east: hallway
|
||||
items: [shovel]
|
||||
npcs: []
|
||||
|
||||
- id: cellar
|
||||
name: Damp Cellar
|
||||
description: |
|
||||
Cold, damp, and very dark. You can barely
|
||||
make out shapes against the far wall.
|
||||
exits:
|
||||
west: kitchen
|
||||
items: []
|
||||
npcs: []
|
||||
Reference in New Issue
Block a user