Repository navigation
Commit e57ea79
committed
Fix: pet kills of unique monsters were missing from the livelog.
Unique-monster death livelogs are written in mondead(), gated on the
player_killed/pet_killer statics. Two systemic problems: many pet-kill
paths (breath and wand rays, thrown projectiles, beheading, passive
counterattacks, petrification, explosions, gas clouds, psychic waves)
never called set_pet_killer(), silently dropping the livelog entry,
and monkilled() never cleared player_killed afterward, so a later
death that reached mondead()/mondied() directly (drowning, traps)
could inherit the stale flag and write a spurious "killed <unique>"
entry. Rework the flow so mondead() snapshots and clears both statics
on entry: attribution is set immediately before a death call and can
never leak past it.
* src/mon.c:
- mondead() consumes player_killed/pet_killer into locals as its
first statements; the livelog block reads only the snapshot and
its gate becomes (hero kill || pet kill).
- monkilled() no longer converts or resets the flags; xkilled()
sets player_killed immediately before its death dispatch (it
previously set it before an early return that could leak TRUE)
and drops its now-redundant tail resets.
- monstone() clears attribution at its two early returns that
skip mondead() (vampshifter revert, lifesaved).
- corpse_chance() credits a swallowed pet gas spore that rips
its engulfer open.
- m_detach() clears the new exploder global like buzzer/thrower.
* src/zap.c:
- credit the beam originator (buzzer) at the dobuzz() beam kill,
disintegrate_mon(), the resist() m_using kill, and the clay
golem death in cancel_monst() - tame dragon breath and pet
wand zaps now livelog.
- zap_over_floor() poison gas clouds pass an explicit creator;
the hero predicate matches the old set_heros_fault() logic so
hero credit for spell-explosion and trap-beam clouds is
unchanged.
* src/muse.c: set buzzer around every mbhit()-based wand zap (not
just the buzz-type wands) so striking/cancellation deaths can be
attributed; muse_unslime()'s scroll-of-fire explosion and the
monster stinking-cloud scroll thread the responsible monster.
* src/mthrowu.c: ohitmon() credits the throwing pet at its kill
site and around potionhit() (cleared afterward since the potion
may not kill).
* src/mhitm.c:
- credit pets for beheading and 1-in-30 deadly poison kills
(both previously bare mondied()), the armor-material sear in
missmm(), every passivemm() counterattack kill including the
assess_dmg tail, and all four monster-vs-monster petrification
sites (monstone() now reaches the livelog with attribution).
- the gray dragon-scaled armor passive cancel passed
youattack=TRUE in a monster-vs-monster context, handing the
hero credit and blame when it killed a clay golem attacker;
pass FALSE and credit the wearer instead.
- wrap the melee and passive-hide cancellation calls so a tame
canceller gets credit for a clay golem death.
* src/monmove.c: credit a tame mind flayer's psychic wave kills;
mb_trapped() door-trap blasts and hezrou stench clouds thread
the responsible monster.
* src/eat.c: eat_brains() credits a tame petrifier when the brain
eater turns to stone.
* src/explode.c, src/decl.c, include/decl.h: new exploder global
(same lifecycle as buzzer/thrower, saved and restored around
nested calls so chained gas spore blasts keep the right actor);
mon_explodes() sets it after its internal mondead() so
m_detach() does not clear it; the explode() monkilled branch
credits a tame exploder.
* src/mcastu.c, src/artifact.c: thread the caster/wielder through
the acid blast, fire/ice bolt, and Tempest/Harbinger/Dichotomy
surge explosions.
* src/region.c, include/region.h, include/extern.h, src/read.c,
src/mkmaze.c: create_gas_cloud() takes an explicit creator
(&youmonst, a monster, or NULL for environment) and records a
creator m_id in NhRegion for pet credit at the gas cloud kill
site. The new field is deliberately not saved (both allocators
zero the struct), so the save format is unchanged; attribution
is dropped across save/reload.
* src/spell.c: the spell 'Power Word Kill' used monkilled(), denying XP,
conduct effects, and the livelog for a directly targeted hero kill;
use xkilled().
Delayed-death attribution (withering, zombie sickness, disease,
petrification timers) still only tracks hero-vs-not bits; per-monster
source tracking needs new saved fields and is left for a future
save-breaking version.1 parent c5cd679 commit e57ea79
19 files changed
Lines changed: 261 additions & 70 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5537 | 5537 | | |
5538 | 5538 | | |
5539 | 5539 | | |
| 5540 | + | |
5540 | 5541 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
| 311 | + | |
| 312 | + | |
312 | 313 | | |
313 | 314 | | |
314 | 315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2410 | 2410 | | |
2411 | 2411 | | |
2412 | 2412 | | |
2413 | | - | |
| 2413 | + | |
| 2414 | + | |
2414 | 2415 | | |
2415 | 2416 | | |
2416 | 2417 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
64 | 70 | | |
65 | 71 | | |
66 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2201 | 2201 | | |
2202 | 2202 | | |
2203 | 2203 | | |
| 2204 | + | |
2204 | 2205 | | |
2205 | 2206 | | |
2206 | 2207 | | |
| |||
2481 | 2482 | | |
2482 | 2483 | | |
2483 | 2484 | | |
| 2485 | + | |
| 2486 | + | |
2484 | 2487 | | |
2485 | 2488 | | |
2486 | 2489 | | |
2487 | 2490 | | |
2488 | 2491 | | |
| 2492 | + | |
2489 | 2493 | | |
2490 | 2494 | | |
2491 | 2495 | | |
| |||
2665 | 2669 | | |
2666 | 2670 | | |
2667 | 2671 | | |
| 2672 | + | |
| 2673 | + | |
2668 | 2674 | | |
2669 | 2675 | | |
2670 | 2676 | | |
2671 | 2677 | | |
2672 | 2678 | | |
| 2679 | + | |
2673 | 2680 | | |
2674 | 2681 | | |
2675 | 2682 | | |
| |||
2982 | 2989 | | |
2983 | 2990 | | |
2984 | 2991 | | |
| 2992 | + | |
| 2993 | + | |
2985 | 2994 | | |
2986 | 2995 | | |
2987 | 2996 | | |
2988 | 2997 | | |
2989 | 2998 | | |
| 2999 | + | |
2990 | 3000 | | |
2991 | 3001 | | |
2992 | 3002 | | |
2993 | 3003 | | |
2994 | 3004 | | |
| 3005 | + | |
| 3006 | + | |
2995 | 3007 | | |
2996 | 3008 | | |
2997 | 3009 | | |
2998 | 3010 | | |
2999 | 3011 | | |
| 3012 | + | |
3000 | 3013 | | |
3001 | 3014 | | |
3002 | 3015 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
264 | 269 | | |
265 | 270 | | |
266 | 271 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
| 644 | + | |
| 645 | + | |
644 | 646 | | |
645 | 647 | | |
646 | 648 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
542 | 542 | | |
543 | 543 | | |
544 | 544 | | |
| 545 | + | |
| 546 | + | |
545 | 547 | | |
546 | 548 | | |
547 | 549 | | |
| |||
1005 | 1007 | | |
1006 | 1008 | | |
1007 | 1009 | | |
| 1010 | + | |
1008 | 1011 | | |
1009 | 1012 | | |
1010 | 1013 | | |
| |||
1036 | 1039 | | |
1037 | 1040 | | |
1038 | 1041 | | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
1039 | 1048 | | |
1040 | 1049 | | |
| 1050 | + | |
1041 | 1051 | | |
1042 | 1052 | | |
1043 | 1053 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1010 | 1010 | | |
1011 | 1011 | | |
1012 | 1012 | | |
| 1013 | + | |
1013 | 1014 | | |
1014 | 1015 | | |
1015 | 1016 | | |
| |||
1151 | 1152 | | |
1152 | 1153 | | |
1153 | 1154 | | |
| 1155 | + | |
| 1156 | + | |
1154 | 1157 | | |
1155 | 1158 | | |
| 1159 | + | |
1156 | 1160 | | |
1157 | 1161 | | |
1158 | 1162 | | |
| |||
1172 | 1176 | | |
1173 | 1177 | | |
1174 | 1178 | | |
| 1179 | + | |
| 1180 | + | |
1175 | 1181 | | |
1176 | 1182 | | |
1177 | 1183 | | |
| 1184 | + | |
1178 | 1185 | | |
1179 | 1186 | | |
1180 | 1187 | | |
| |||
1457 | 1464 | | |
1458 | 1465 | | |
1459 | 1466 | | |
| 1467 | + | |
| 1468 | + | |
1460 | 1469 | | |
1461 | 1470 | | |
1462 | 1471 | | |
1463 | 1472 | | |
1464 | 1473 | | |
1465 | 1474 | | |
| 1475 | + | |
1466 | 1476 | | |
1467 | 1477 | | |
1468 | 1478 | | |
| |||
1477 | 1487 | | |
1478 | 1488 | | |
1479 | 1489 | | |
| 1490 | + | |
| 1491 | + | |
1480 | 1492 | | |
1481 | 1493 | | |
1482 | 1494 | | |
1483 | 1495 | | |
1484 | 1496 | | |
| 1497 | + | |
1485 | 1498 | | |
1486 | 1499 | | |
1487 | 1500 | | |
| |||
0 commit comments