rom24-quickmud-python 2.9.13__py3-none-any.whl → 2.9.14__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mud/affects/engine.py CHANGED
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from mud.handler import affect_remove
4
4
  from mud.models.character import Character
5
+ from mud.skills.registry import skill_registry
5
6
  from mud.utils import rng_mm
6
7
 
7
8
  ROM_NEWLINE = "\n\r"
@@ -9,6 +10,35 @@ ROM_NEWLINE = "\n\r"
9
10
  __all__ = ["tick_spell_effects"]
10
11
 
11
12
 
13
+ def _lookup_raw_affect_wear_off(affect) -> str | None:
14
+ """Mirror ROM ``src/update.c:777-781`` — emit ``skill_table[paf->type].msg_off``
15
+ on raw AffectData expiry.
16
+
17
+ Prefer an explicit ``wear_off_message`` attribute on the affect itself
18
+ (matches the precedent at ``mud/game_loop.py:1121-1131`` for object
19
+ affects), then fall back to ``skill_registry`` keyed by ``affect.type``
20
+ (the spell SN / name). Returns ``None`` if no message can be resolved —
21
+ a silent expiry is then identical to ROM's behavior when the skill has
22
+ no ``msg_off`` defined.
23
+ """
24
+ explicit = getattr(affect, "wear_off_message", None)
25
+ if isinstance(explicit, str) and explicit:
26
+ return explicit
27
+
28
+ spell_name = getattr(affect, "type", None)
29
+ if not isinstance(spell_name, str) or not spell_name:
30
+ return None
31
+ try:
32
+ skill = skill_registry.get(spell_name)
33
+ except KeyError:
34
+ return None
35
+ messages = getattr(skill, "messages", None) or {}
36
+ candidate = messages.get("wear_off")
37
+ if isinstance(candidate, str) and candidate:
38
+ return candidate
39
+ return None
40
+
41
+
12
42
  def tick_spell_effects(character: Character) -> list[str]:
13
43
  """Reduce active spell durations and collect wear-off messages."""
14
44
 
@@ -67,11 +97,20 @@ def tick_spell_effects(character: Character) -> list[str]:
67
97
  else:
68
98
  affect_remove(character, affect)
69
99
 
70
- if isinstance(spell_name, str) and spell_name in effects:
100
+ if spell_effects_managed:
71
101
  touched_names.add(spell_name)
72
102
  wear_off = getattr(effects[spell_name], "wear_off_message", None)
73
103
  if should_emit and wear_off:
74
104
  messages.append(f"{wear_off}{ROM_NEWLINE}")
105
+ else:
106
+ # ROM src/update.c:777-781 — emit skill_table[paf->type].msg_off
107
+ # for any raw AffectData expiry (e.g. plague-by-spread from
108
+ # mud/game_loop.py:614-624, food-borne poison transfers).
109
+ # INV-018 enforcement point.
110
+ if should_emit:
111
+ raw_wear_off = _lookup_raw_affect_wear_off(affect)
112
+ if raw_wear_off:
113
+ messages.append(f"{raw_wear_off}{ROM_NEWLINE}")
75
114
 
76
115
  for spell_name in touched_names:
77
116
  remaining = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rom24-quickmud-python
3
- Version: 2.9.13
3
+ Version: 2.9.14
4
4
  Summary: A modern Python port of the ROM 2.4b6 MUD engine with full telnet server and JSON world loading
5
5
  Author-email: Mark Jedrzejczyk <mark.jedrzejczyk@gmail.com>
6
6
  Maintainer-email: Mark Jedrzejczyk <mark.jedrzejczyk@gmail.com>
@@ -22,7 +22,7 @@ mud/account/account_service.py,sha256=ERKI4Mx6IvZgKreuqZID8uF45II9RP3byimlEHHYOD
22
22
  mud/admin_logging/__init__.py,sha256=3W8Z1S7Dg-AtDTKPQIzuqL4_OojeyuAOryGH6BKozcg,40
23
23
  mud/admin_logging/admin.py,sha256=WWSNcY6nP-vqMcJ-rUyVAfoYV95xyu2S_iZugfR0dPE,5261
24
24
  mud/admin_logging/agent_trace.py,sha256=j1rtrINBp2RIB9BRGXK0awHTH8_nvSu4Co18zmdOU2w,359
25
- mud/affects/engine.py,sha256=Dkckt2zvKMaL6AU-gzFcbtMvqNVBYuRmywhHl1uk-LI,4563
25
+ mud/affects/engine.py,sha256=JtIebvJbSQf2KhwvQ5C6hRYkNk-jjVLg4PggpjmpieA,6209
26
26
  mud/affects/saves.py,sha256=afpQt_fEy6O5rphttSveYgjUcCuXzkCG9EI8ZEpD0Hs,5247
27
27
  mud/agent/__init__.py,sha256=n7gOkjYxsp38xaokvYaEGEEyfZQz1M7AwpM59o1i3_g,32
28
28
  mud/agent/agent_protocol.py,sha256=itC7kgLJiGxJRatZJ9YGg3KhHTMWeedJocsC1f7TmzY,573
@@ -216,9 +216,9 @@ mud/world/obj_find.py,sha256=tgnUkbFjnCl586Lzl6yRzCmllZSNEfQpQlrxCMVcUGU,5295
216
216
  mud/world/time_persistence.py,sha256=K4uhRpu08IDHY5uReBYTvw4BHuqsSxWvbv-h1VsPvf8,1663
217
217
  mud/world/vision.py,sha256=NRk3cvrGyyldU4W98qAVlYZp9wL-IUE1dTgk6DpM-NA,11609
218
218
  mud/world/world_state.py,sha256=3KpiDP6v24sZDn9-g44UypXpegzgRShHo1XvektJzdU,8810
219
- rom24_quickmud_python-2.9.13.dist-info/licenses/LICENSE,sha256=anQ2j9As6sIC8tZgQCXbo0-09JDH9vPiqhA9djnOvkY,1078
220
- rom24_quickmud_python-2.9.13.dist-info/METADATA,sha256=wGAXc-cpYH7rU-xvEOIy6gR2wd4LfSwGe-gIup6lA-s,15671
221
- rom24_quickmud_python-2.9.13.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
222
- rom24_quickmud_python-2.9.13.dist-info/entry_points.txt,sha256=VFru08UQTXZA_CkK-NBjJmWHyEX5a3864fQHjhaojbw,41
223
- rom24_quickmud_python-2.9.13.dist-info/top_level.txt,sha256=Fk1WPmabIIjp7_iZXLYpbAVqiq7lG7TeAHt30AsOKtQ,4
224
- rom24_quickmud_python-2.9.13.dist-info/RECORD,,
219
+ rom24_quickmud_python-2.9.14.dist-info/licenses/LICENSE,sha256=anQ2j9As6sIC8tZgQCXbo0-09JDH9vPiqhA9djnOvkY,1078
220
+ rom24_quickmud_python-2.9.14.dist-info/METADATA,sha256=aOVicwG_PsPGXBl9D-xKNmWfVdV4bhYs29iUhctqsdE,15671
221
+ rom24_quickmud_python-2.9.14.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
222
+ rom24_quickmud_python-2.9.14.dist-info/entry_points.txt,sha256=VFru08UQTXZA_CkK-NBjJmWHyEX5a3864fQHjhaojbw,41
223
+ rom24_quickmud_python-2.9.14.dist-info/top_level.txt,sha256=Fk1WPmabIIjp7_iZXLYpbAVqiq7lG7TeAHt30AsOKtQ,4
224
+ rom24_quickmud_python-2.9.14.dist-info/RECORD,,