Commit graph

452 commits

Author SHA1 Message Date
84cd75e3a3
Add mob templates, registry, and spawn/despawn/query
Phase 1 of fightable mobs: MobTemplate dataclass loaded from TOML,
global mobs list, spawn_mob/despawn_mob/get_nearby_mob with
wrapping-aware distance. Mob entity gets moves and next_action_at fields.
2026-02-09 11:54:29 -05:00
e0910151f4
Add research on IF possibilities 2026-02-09 11:54:22 -05:00
f36085c921
Add rest command for stamina recovery 2026-02-08 22:16:47 -05:00
0f7404cb12
Fix prefix matching for combat move variants
The variant handler now supports prefix matching for directional variants.
This allows 'pa hi' to match 'parry high', 'pa lo' to match 'parry low', etc.

Implementation:
- First tries exact match on variant key
- Falls back to prefix matching if no exact match
- Returns unique match if exactly one variant starts with the prefix
- Shows disambiguation message if multiple variants match
- Shows error with valid options if no variants match

Tests cover exact match, prefix match, ambiguous prefix, no match,
single-char prefix, case-insensitivity, and preservation of target args.
2026-02-08 14:41:40 -05:00
67781578a3
Add descriptions to all combat move TOMLs 2026-02-08 14:32:51 -05:00
9c1c6a9e22
Add description field to CombatMove dataclass 2026-02-08 14:32:51 -05:00
77c2e40e0e
Add reload command for hot-reloading TOML content 2026-02-08 14:32:51 -05:00
37766ad69f
Fix typecheck errors in prefix disambiguation 2026-02-08 13:50:26 -05:00
8c83130f67
Add test for alias exact match over prefix 2026-02-08 13:48:32 -05:00
68fa08d776
Extract shared prefix matching helper 2026-02-08 13:48:00 -05:00
7c21310dcd
Remove alias display from command and skill listings 2026-02-08 13:42:00 -05:00
6e9a89f21e
Update tests for clean command listings 2026-02-08 13:41:36 -05:00
7ae56106d6
Update tests for alias removal 2026-02-08 13:39:58 -05:00
841714d6ca
Update tests for alias removal 2026-02-08 13:37:40 -05:00
64b6308bc6
Remove hidden alias registration from combat commands 2026-02-08 13:36:45 -05:00
c385f559a3
Strip aliases from TOML content files 2026-02-08 13:36:20 -05:00
e00591b6bf
Fix test fixture to not interfere with other tests 2026-02-08 13:34:46 -05:00
20f33f45e1
Implement standalone help command 2026-02-08 13:33:46 -05:00
7c313ae307
Implement prefix matching in dispatch 2026-02-08 13:33:22 -05:00
7d3b02f6ff
Implement collision detection in register 2026-02-08 13:33:19 -05:00
5efdbaf4e6
Add help command tests 2026-02-08 13:32:50 -05:00
1a122b85e5
Add collision detection tests 2026-02-08 13:32:49 -05:00
f1e4cfa4dd
Add prefix matching tests 2026-02-08 13:32:32 -05:00
529320acb5
Split commands and skills into separate listings 2026-02-08 13:15:04 -05:00
a8917da59e
Fix typecheck warnings for nullable current_move 2026-02-08 13:05:16 -05:00
9e5003e52c
Hide variant aliases from commands listing 2026-02-08 13:04:54 -05:00
d0c33911f3
Wire edit command to open combat TOML files 2026-02-08 12:44:56 -05:00
1b63f87da7
Add detail view to commands command 2026-02-08 12:41:02 -05:00
6fb48e9ae1
Add commands command to list available commands 2026-02-08 12:35:50 -05:00
e9378bb6fa
Tweak the timing windows in combat 2026-02-08 12:28:17 -05:00
3c5c1490e6
Replace defense lock with sleep-based commitment blocking
Defense moves now asyncio.sleep for timing_window_ms instead of using
a cooldown field. Input queues naturally since the per-player loop is
sequential. Outside combat shows "parry the air!" flavor text.
2026-02-08 12:28:17 -05:00
2de1ebd59e
Fix variant defense mode and test cleanup
- Set variant defense registration to mode="*" (both attacks and defenses)
- Strengthen telegraph switch test to verify new move's telegraph text
- Remove unused punch parameter from four idle timeout tests
- Use single time.monotonic() call in attack() method
2026-02-08 12:28:17 -05:00
1b3684dc65
Add 30-second idle timeout for combat encounters
Encounters track last_action_at (updated on attack and defend). If 30
seconds pass with no actions, combat fizzles out with a message to both
players and combat mode is popped. start_encounter initializes the
timestamp so fresh encounters don't immediately timeout.
2026-02-08 12:28:17 -05:00
e368ed1843
Add defense commitment lock and defense-everywhere support
Defenses now work outside combat mode with stamina cost, recovery lock
(based on timing_window_ms), and broadcast to nearby players. Lock
prevents spamming defenses — you commit to the move. Stamina deduction
moved from encounter.defend() to do_defend command layer. Defense
commands registered with mode="*" instead of "combat".
2026-02-08 12:28:17 -05:00
cf423fb22b
Add attack switching (feints) during telegraph and window phases
Attacker can change their move mid-telegraph or mid-window without
resetting the timer. Old move's stamina is refunded, new move charged.
Defender gets a fresh telegraph on switch. Feedback says "switch to"
instead of "use" when swapping attacks.
2026-02-08 12:28:17 -05:00
9054962f5d
Add combat resolution messages with both-POV feedback
resolve() returns ResolveResult dataclass with attacker_msg, defender_msg,
damage, countered, and combat_ended fields. process_combat is now async
and sends messages to both participants on resolve. Counter, hit, and
slam messages give each player their own perspective on what happened.
2026-02-08 12:28:17 -05:00
588227bcd0
Add dbzfe notes 2026-02-08 10:45:25 -05:00
6344c09275
Restructure combat moves: single-word commands with variant args
The DREAMBOOK always described "punch right/left [target]" as one command
with a direction argument, but the implementation had separate TOML files
and multi-word command names that the dispatcher couldn't reach (it only
matches the first word). Aliases like "pr" also couldn't pass targets
because the shared handler tried to re-derive the move from args.

Changes:
- Merge punch_left/right, dodge_left/right, parry_high/low into single
  TOML files with [variants] sections
- Add command/variant fields to CombatMove for tracking move families
- load_move() now returns list[CombatMove], expanding variants
- Handlers bound to moves via closures at registration time:
  variant handler for base commands (punch → parses direction from args),
  direct handler for aliases and simple moves (pr → move already known)
- Core logic in do_attack/do_defend takes a resolved move
- Combat doc rewritten as rst with architecture details
- Simplify mud.tin aliases (pr/pl/etc are built-in MUD commands now)
2026-02-08 00:20:52 -05:00
91c57d89e1
Update CLAUDE.md to reflect current state
Fix typecheck reference (ty not pyright), add content/ directory to layout, expand
Architecture section with combat, persistence, editor, content loading, and entity model.
2026-02-07 23:51:37 -05:00
83455c525f
Update commands doc with combat, content, and editor sections
Documents how combat moves are registered from TOML, how content-defined commands
work, and how editor mode captures input.
2026-02-07 23:50:55 -05:00
ef658fd987
Update architecture plan opening to reflect current progress
Items 1-8 from the plan are complete. Only in-world programming (item 9) remains.
2026-02-07 23:50:32 -05:00
8f3455ce0a
Convert things-and-building doc to rst 2026-02-07 23:39:45 -05:00
0395aaadad
Add things and building design doc 2026-02-07 23:36:47 -05:00
d3df09f4de
Fix editor search/replace parsing, dirty flag, and cursor tracking 2026-02-07 23:06:47 -05:00
0574457404
Add syntax highlighting to editor buffer display 2026-02-07 23:01:55 -05:00
a799b6716c
Add editor mode shell integration and edit command
Integrates the Editor class into the MUD server's shell loop, allowing
players to enter and use the text editor from the game.

Changes:
- Add editor field to Player dataclass
- Modify shell input loop to check player mode and route to editor
- Add edit command to enter editor mode from normal mode
- Use inp (not command.strip()) for editor to preserve indentation
- Show line-numbered prompt in editor mode
- Pop mode and clear editor when done=True
- Add comprehensive integration tests
- Fix test isolation issue in test_movement_updates_position
2026-02-07 22:59:37 -05:00
23507d0e70
Add editor class with buffer, commands, and undo 2026-02-07 22:55:53 -05:00
5e255f192c
Simplify test recipe 2026-02-07 22:49:01 -05:00
b0fcb080d3
Wire client capabilities into Player & terrain
Parse MTTS from telnetlib3 writer during connection and store capabilities
on Player.caps field. Add convenience property Player.color_depth that
delegates to caps.color_depth for easy access by rendering code.

Changes:
- Add caps field to Player with default 16-color ANSI capabilities
- Parse MTTS in server shell after Player creation using parse_mtts()
- Add Player.color_depth property for quick capability checks
- Add tests verifying Player caps integration and color_depth property
2026-02-07 22:44:45 -05:00
6549d09683
Add 256-color and truecolor SGR helpers
Extended ansi.py with fg_256, bg_256, fg_rgb, and bg_rgb functions
for generating 256-color and truecolor escape sequences. All functions
include value clamping to valid ranges (0-255).
2026-02-07 22:44:23 -05:00