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:
121
api/app/data/quests/medium/bandit_threat.yaml
Normal file
121
api/app/data/quests/medium/bandit_threat.yaml
Normal file
@@ -0,0 +1,121 @@
|
||||
# Bandit Threat - Combat-focused medium quest
|
||||
quest_id: quest_bandit_threat
|
||||
name: "The Bandit Threat"
|
||||
description: |
|
||||
A gang of bandits has been terrorizing travelers on the roads
|
||||
near Crossville. Mayor Aldric is offering a substantial reward
|
||||
for anyone who can deal with the threat permanently.
|
||||
difficulty: medium
|
||||
|
||||
# NPC Quest Givers
|
||||
quest_giver_npc_ids:
|
||||
- npc_mayor_aldric
|
||||
quest_giver_name: "Mayor Aldric Thornwood"
|
||||
|
||||
# Location context
|
||||
location_id: crossville_village
|
||||
region_id: crossville
|
||||
|
||||
# Offering conditions
|
||||
offering_triggers:
|
||||
location_types: ["town", "official"]
|
||||
specific_locations: ["crossville_village", "crossville_town_hall"]
|
||||
min_character_level: 3
|
||||
max_character_level: 8
|
||||
required_quests_completed: []
|
||||
probability_weights:
|
||||
town: 0.20
|
||||
official: 0.40
|
||||
|
||||
# NPC-specific offer dialogue
|
||||
npc_offer_dialogues:
|
||||
npc_mayor_aldric:
|
||||
dialogue: |
|
||||
*straightens his chain of office* Crossville faces a grave threat.
|
||||
Bandits have been attacking merchants on the eastern road. Trade
|
||||
is suffering, and I fear for our people's safety. The village
|
||||
will pay handsomely for someone who can... resolve this situation.
|
||||
conditions:
|
||||
min_relationship: 35
|
||||
required_flags: []
|
||||
forbidden_flags: ["failed_bandit_quest"]
|
||||
|
||||
# What NPCs know
|
||||
npc_quest_knowledge:
|
||||
npc_mayor_aldric:
|
||||
- "The bandits have a camp somewhere in the eastern forest"
|
||||
- "They're led by a man called 'Blackhand' - a former soldier"
|
||||
- "At least a dozen bandits, well-armed and organized"
|
||||
- "Three merchant caravans have been hit in the past month"
|
||||
- "The militia is too small to mount an assault"
|
||||
|
||||
# Embedded lore
|
||||
lore_context:
|
||||
backstory: |
|
||||
The bandit leader Blackhand was once a soldier in the King's
|
||||
army. After the war ended, he turned to brigandry rather than
|
||||
return to a life of farming. His military training makes his
|
||||
gang far more dangerous than common thieves.
|
||||
world_connections:
|
||||
- "Many veterans turned to banditry after the war - a kingdom-wide problem"
|
||||
- "The mayor may know more about Blackhand than he lets on"
|
||||
regional_hints:
|
||||
- "The eastern forest road is the main trade route to the capital"
|
||||
- "Without trade, Crossville's economy will suffer greatly"
|
||||
|
||||
# Narrative hooks
|
||||
dialogue_templates:
|
||||
narrative_hooks:
|
||||
- "speaks of the economic impact on the village"
|
||||
- "mentions concerned merchants refusing to travel"
|
||||
- "hints at political pressure from higher authorities"
|
||||
- "shows genuine worry for the common folk"
|
||||
ambient_hints:
|
||||
- "You notice fewer merchants in the market than expected"
|
||||
- "Guards at the village gate look nervous and understaffed"
|
||||
- "Wanted posters for 'Blackhand' are posted on walls"
|
||||
|
||||
# Objectives
|
||||
objectives:
|
||||
- objective_id: find_camp
|
||||
description: "Locate the bandit camp in the eastern forest"
|
||||
objective_type: discover
|
||||
required_progress: 1
|
||||
target_location_id: bandit_camp
|
||||
|
||||
- objective_id: defeat_bandits
|
||||
description: "Defeat the bandits"
|
||||
objective_type: kill
|
||||
required_progress: 8
|
||||
target_enemy_type: bandit
|
||||
|
||||
- objective_id: defeat_blackhand
|
||||
description: "Defeat or capture Blackhand"
|
||||
objective_type: kill
|
||||
required_progress: 1
|
||||
target_enemy_type: blackhand_leader
|
||||
|
||||
# Rewards
|
||||
rewards:
|
||||
gold: 200
|
||||
experience: 350
|
||||
items:
|
||||
- blackhand_sword
|
||||
relationship_bonuses:
|
||||
npc_mayor_aldric: 20
|
||||
unlocks_quests: ["quest_mayors_secret"]
|
||||
reveals_locations: ["bandit_camp"]
|
||||
|
||||
# Completion dialogue
|
||||
completion_dialogue:
|
||||
npc_mayor_aldric: |
|
||||
*visible relief* The bandits are dealt with? This is excellent
|
||||
news. You've done Crossville a great service. *hands over a
|
||||
heavy coin purse* Your reward, as promised. And... I may have
|
||||
other matters that require someone of your capabilities. We
|
||||
should speak again soon.
|
||||
|
||||
tags:
|
||||
- combat
|
||||
- exploration
|
||||
- story
|
||||
Reference in New Issue
Block a user