feat: Implement Phase 5 Quest System (100% complete)

Add YAML-driven quest system with context-aware offering:

Core Implementation:
- Quest data models (Quest, QuestObjective, QuestReward, QuestTriggers)
- QuestService for YAML loading and caching
- QuestEligibilityService with level, location, and probability filtering
- LoreService stub (MockLoreService) ready for Phase 6 Weaviate integration

Quest Content:
- 5 example quests across difficulty tiers (2 easy, 2 medium, 1 hard)
- Quest-centric design: quests define their NPC givers
- Location-based probability weights for natural quest offering

AI Integration:
- Quest offering section in npc_dialogue.j2 template
- Response parser extracts [QUEST_OFFER:quest_id] markers
- AI naturally weaves quest offers into NPC conversations

API Endpoints:
- POST /api/v1/quests/accept - Accept quest offer
- POST /api/v1/quests/decline - Decline quest offer
- POST /api/v1/quests/progress - Update objective progress
- POST /api/v1/quests/complete - Complete quest, claim rewards
- POST /api/v1/quests/abandon - Abandon active quest
- GET /api/v1/characters/{id}/quests - List character quests
- GET /api/v1/quests/{quest_id} - Get quest details

Frontend:
- Quest tracker sidebar with HTMX integration
- Quest offer modal for accept/decline flow
- Quest detail modal for viewing progress
- Combat service integration for kill objective tracking

Testing:
- Unit tests for Quest models and serialization
- Integration tests for full quest lifecycle
- Comprehensive test coverage for eligibility service

Documentation:
- Reorganized docs into /docs/phases/ structure
- Added Phase 5-12 planning documents
- Updated ROADMAP.md with new structure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 15:42:55 -06:00
parent e7e329e6ed
commit df26abd207
42 changed files with 8421 additions and 2227 deletions

View File

@@ -0,0 +1,109 @@
# Missing Tools - Simple fetch quest for new players
quest_id: quest_missing_tools
name: "The Blacksmith's Missing Tools"
description: |
Hilda the blacksmith's best hammers and tongs have gone missing.
She suspects they were stolen by mischievous goblins who've been
spotted near the forest edge.
difficulty: easy
# NPC Quest Givers
quest_giver_npc_ids:
- npc_blacksmith_hilda
quest_giver_name: "Hilda Stoneforge"
# Location context
location_id: crossville_forge
region_id: crossville
# Offering conditions
offering_triggers:
location_types: ["town", "shop"]
specific_locations: ["crossville_forge", "crossville_village"]
min_character_level: 1
max_character_level: 4
required_quests_completed: []
probability_weights:
town: 0.25
shop: 0.30
# NPC-specific offer dialogue
npc_offer_dialogues:
npc_blacksmith_hilda:
dialogue: |
*sighs heavily* Some thieving little beasts made off with me
best tools last night. Saw goblin tracks leading toward the
forest. Can't do proper work without 'em. Help me out?
conditions:
min_relationship: 20
required_flags: []
forbidden_flags: []
# What NPCs know about this quest
npc_quest_knowledge:
npc_blacksmith_hilda:
- "The tools were passed down from her father"
- "Goblins have been more active lately near the forest"
- "She heard strange noises two nights ago but thought it was just animals"
- "The tools are distinctive - marked with the Stoneforge family crest"
# Embedded lore
lore_context:
backstory: |
The Stoneforge family has been the village's blacksmiths for
four generations. Hilda's tools are not just valuable - they're
family heirlooms with sentimental worth.
world_connections:
- "Goblins typically avoid settlements unless driven by something"
- "Recent disturbances in the region have made all creatures more bold"
regional_hints:
- "Goblin warrens exist in the rocky hills east of the forest"
- "The Stoneforge family once forged weapons for the village militia"
# Narrative hooks
dialogue_templates:
narrative_hooks:
- "mentions being unable to fill orders without proper tools"
- "looks frustrated at a half-finished project"
- "grumbles about creatures getting bolder"
- "offers a discount on future work as additional thanks"
ambient_hints:
- "You notice the forge is quieter than usual"
- "Several half-finished weapons sit abandoned on workbenches"
# Objectives
objectives:
- objective_id: track_goblins
description: "Follow the goblin tracks into the forest"
objective_type: travel
required_progress: 1
target_location_id: forest_goblin_camp
- objective_id: recover_tools
description: "Recover Hilda's stolen tools"
objective_type: collect
required_progress: 1
target_item_id: stoneforge_tools
# Rewards
rewards:
gold: 35
experience: 75
items: []
relationship_bonuses:
npc_blacksmith_hilda: 15
unlocks_quests: []
reveals_locations: ["forest_goblin_camp"]
# Completion dialogue
completion_dialogue:
npc_blacksmith_hilda: |
*eyes light up* My tools! You found them! By the ancestors,
I thought they were gone forever. Here's your coin, and know
that you've got a friend at the Stoneforge. Come by anytime
you need gear - I'll give you the family discount.
tags:
- starter
- fetch
- exploration