Add SQLite persistence, per-player NPC attitude system, character creation, and combat

- Add trait-based DB layer (db.rs) with SQLite backend for easy future swapping
- Player state persisted to SQLite: stats, inventory, equipment, room position
- Returning players skip chargen and resume where they left off
- Replace boolean hostile flag with 5-tier attitude system (friendly/neutral/wary/aggressive/hostile)
- Per-player NPC attitudes stored in DB, shift on kills with faction propagation
- Add character creation flow (chargen.rs) with data-driven races and classes from TOML
- Add turn-based combat system (combat.rs) with XP, leveling, and NPC respawn
- Add commands: take, drop, inventory, equip, use, examine, talk, attack, flee, stats
- Add world data: 5 races, 4 classes, hostile NPCs (rat, thief), new items

Made-with: Cursor
This commit is contained in:
AI Agent
2026-03-14 13:58:22 -06:00
parent c82f57a720
commit 680f48477e
28 changed files with 1797 additions and 673 deletions

View File

@@ -1,4 +1,7 @@
name = "Grizzled Barkeep"
description = "A weathered man with thick forearms and a permanent scowl. He polishes the same mug endlessly."
room = "town:tavern"
dialogue = "Welcome to The Rusty Tankard. We've got ale, and we've got stronger ale. Pick one."
base_attitude = "friendly"
[dialogue]
greeting = "Welcome to The Rusty Tankard. We've got ale, and we've got stronger ale."

View File

@@ -1,4 +1,7 @@
name = "Town Guard"
description = "A bored-looking guard in dented chainmail. He leans on his spear and watches passersby."
room = "town:gate"
dialogue = "Move along. Nothing to see here."
base_attitude = "neutral"
[dialogue]
greeting = "Move along. Nothing to see here."

11
world/town/npcs/rat.toml Normal file
View File

@@ -0,0 +1,11 @@
name = "Giant Rat"
description = "A mangy rat the size of a small dog. Its eyes gleam with feral hunger."
room = "town:cellar"
base_attitude = "hostile"
respawn_secs = 60
[combat]
max_hp = 25
attack = 6
defense = 2
xp_reward = 15

View File

@@ -0,0 +1,12 @@
name = "Shadowy Thief"
description = "A cloaked figure lurking in the darkness, fingers twitching near a concealed blade."
room = "town:dark_alley"
base_attitude = "aggressive"
faction = "underworld"
respawn_secs = 90
[combat]
max_hp = 45
attack = 12
defense = 6
xp_reward = 35