rom24-quickmud-python 2.9.5__py3-none-any.whl → 2.9.7__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
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from mud.handler import affect_remove
3
4
  from mud.models.character import Character
4
5
  from mud.utils import rng_mm
5
6
 
@@ -43,8 +44,28 @@ def tick_spell_effects(character: Character) -> list[str]:
43
44
  or int(getattr(next_affect, "duration", 0) or 0) > 0
44
45
  )
45
46
 
47
+ # ROM src/handler.c:1317 affect_remove — affect_modify(FALSE)
48
+ # subtracts the stat mod and clears the bitvector; affect_check
49
+ # re-sets the bit only if another affect still provides it.
50
+ # INV-015 fix (2.9.7): was a bare `affected.remove(affect)`,
51
+ # which leaked stat mods and bitvectors for any AffectData
52
+ # whose `type` is an integer SN (the ROM-canonical form).
53
+ #
54
+ # Python has a parallel apply path: `Character.apply_spell_effect`
55
+ # already calls `_apply_stat_modifier(+mod)`, mirrors a shadow
56
+ # AffectData into `ch.affected`, and on expiry the
57
+ # `remove_spell_effect` branch below unwinds via
58
+ # `_apply_stat_modifier(-mod)`. For those entries the shadow
59
+ # AffectData's modifier was NEVER applied via `affect_modify(True)`,
60
+ # so calling `affect_modify(False)` on it would double-unwind.
61
+ # Split: spell_effects-managed entries get bare list removal;
62
+ # raw ROM-canonical AffectData routes through affect_remove.
63
+ spell_effects_managed = isinstance(spell_name, str) and spell_name in effects
46
64
  if affect in affected:
47
- affected.remove(affect)
65
+ if spell_effects_managed:
66
+ affected.remove(affect)
67
+ else:
68
+ affect_remove(character, affect)
48
69
 
49
70
  if isinstance(spell_name, str) and spell_name in effects:
50
71
  touched_names.add(spell_name)
mud/handler.py CHANGED
@@ -442,6 +442,36 @@ def affect_check(ch: Character, where: int, vector: int) -> None:
442
442
  return
443
443
 
444
444
 
445
+ def affect_remove(ch: Character, paf: Affect) -> None:
446
+ """Remove an affect from a character — ROM ``src/handler.c:1317``.
447
+
448
+ Mirrors ROM exactly: ``affect_modify(ch, paf, FALSE)`` (subtracts
449
+ the stat modifier and clears the bitvector in
450
+ ``affected_by``/``imm_flags``/``res_flags``/``vuln_flags``),
451
+ unlinks ``paf`` from ``ch.affected``, then calls
452
+ ``affect_check(ch, where, vector)`` which re-sets the bitvector
453
+ only if another affect on the char or equipped objects still
454
+ provides it. INV-015 enforcement point for the affect-tick
455
+ lifecycle contract.
456
+ """
457
+
458
+ affected = getattr(ch, "affected", None)
459
+ if not isinstance(affected, list) or not affected:
460
+ return
461
+
462
+ where = getattr(paf, "where", 0)
463
+ vector = getattr(paf, "bitvector", 0)
464
+
465
+ affect_modify(ch, paf, False)
466
+
467
+ try:
468
+ affected.remove(paf)
469
+ except ValueError:
470
+ pass
471
+
472
+ affect_check(ch, where, vector)
473
+
474
+
445
475
  def affect_to_obj(obj: Object, paf: Affect) -> None:
446
476
  """
447
477
  Add an affect to an object.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rom24-quickmud-python
3
- Version: 2.9.5
3
+ Version: 2.9.7
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>
@@ -5,7 +5,7 @@ mud/config.py,sha256=FmuhwTeR5798i_dHBJvZ_EQ4d_eNO8oMa8ni8fxiHhs,7057
5
5
  mud/entrypoint.py,sha256=WxBW3GfbKCOtSD5rx2ccSAC7lA3YRFi7DJ_EZvi1rmo,854
6
6
  mud/game_loop.py,sha256=nzGos1soW6oN3LCdl_XYlmB-k2QRI0mnpGn5JofbFXM,52109
7
7
  mud/game_tick_scheduler.py,sha256=7ybo2ekDQQPGN82u6fhcrrg7tZ-JMtGy4UUrZv9_Umo,1539
8
- mud/handler.py,sha256=UDX7lxaOUFvHBgIJrkxfgVjm0n7B_vD-9xCvvN2CdLM,51995
8
+ mud/handler.py,sha256=RGAa_ziAJmquIJb0QJhyjJS9-O6KC0U29O8iUaLxAZ0,52935
9
9
  mud/logging.py,sha256=DoKcplYwEePAmXKE2CI_wNk4pF-pc_aouoxa5C6tXlc,582
10
10
  mud/mob_cmds.py,sha256=Hv7tFhABraQLRbQihHOHTDE4qgE0GSuue1_RQkchQW4,46158
11
11
  mud/mobprog.py,sha256=TZiv4ZErFAlcO1TWaJryzZ5kwTZFe5DSqKVlo6qJcTc,59173
@@ -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=AuSMXR-Wyj3_my3-tu0zyUmWhWQfyojyralPTp6SNlk,3208
25
+ mud/affects/engine.py,sha256=Dkckt2zvKMaL6AU-gzFcbtMvqNVBYuRmywhHl1uk-LI,4563
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.5.dist-info/licenses/LICENSE,sha256=anQ2j9As6sIC8tZgQCXbo0-09JDH9vPiqhA9djnOvkY,1078
220
- rom24_quickmud_python-2.9.5.dist-info/METADATA,sha256=LQqN5baUzzl00XWgEpzsZPXOLiBSynP78kGmcnzFlOw,15670
221
- rom24_quickmud_python-2.9.5.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
222
- rom24_quickmud_python-2.9.5.dist-info/entry_points.txt,sha256=VFru08UQTXZA_CkK-NBjJmWHyEX5a3864fQHjhaojbw,41
223
- rom24_quickmud_python-2.9.5.dist-info/top_level.txt,sha256=Fk1WPmabIIjp7_iZXLYpbAVqiq7lG7TeAHt30AsOKtQ,4
224
- rom24_quickmud_python-2.9.5.dist-info/RECORD,,
219
+ rom24_quickmud_python-2.9.7.dist-info/licenses/LICENSE,sha256=anQ2j9As6sIC8tZgQCXbo0-09JDH9vPiqhA9djnOvkY,1078
220
+ rom24_quickmud_python-2.9.7.dist-info/METADATA,sha256=5bg12QFs0bDLO180wl18cwrAY-GRplCXV3lb4RlchCY,15670
221
+ rom24_quickmud_python-2.9.7.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
222
+ rom24_quickmud_python-2.9.7.dist-info/entry_points.txt,sha256=VFru08UQTXZA_CkK-NBjJmWHyEX5a3864fQHjhaojbw,41
223
+ rom24_quickmud_python-2.9.7.dist-info/top_level.txt,sha256=Fk1WPmabIIjp7_iZXLYpbAVqiq7lG7TeAHt30AsOKtQ,4
224
+ rom24_quickmud_python-2.9.7.dist-info/RECORD,,