Skip to content

Commit 626ed70

Browse files
committed
Vary vampire blood freshness from a fixed 5 to 8-15 turns per corpse.
A vampire could drain a corpse's blood only while it was at most 5 turns old (ice-adjusted). Widen and randomize that window to 8-15 turns, varying per corpse, so blood freshness is less predictable. The window is keyed to the corpse's o_id rather than rolled on each check. A "coagulated" result returns 3 from eatcorpse(), which makes doeat() return 0 without consuming a turn, so a per-attempt rn1() roll could be re-rolled for free by re-issuing the eat command until it landed on 15. A stable o_id-derived value cannot be re-rolled, is unpredictable to the player, and stays identical across the player drink, resume, and pet appetite checks. * mkobj.c: add blood_freshness(), returning 8 + (o_id % 8) turns beside peek_at_iced_corpse_age(). * eat.c: route the initial drain gate in eatcorpse() and the resume-drain gate in doeat() through blood_freshness() instead of the literal 5. * dog.c: route the tame vampire pet's blood-corpse appetite check through blood_freshness() so it agrees with the player's window. * extern.h: declare blood_freshness().
1 parent f7df57d commit 626ed70

5 files changed

Lines changed: 22 additions & 4 deletions

File tree

‎doc/evilhack-changelog.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5492,4 +5492,5 @@ The following changes to date are:
54925492
- Fix: prevent revived or animated monsters from keeping a steed link
54935493
- Allow players to recover post-crash emergency saves
54945494
- Fix: prevent animated statues from spawning a fresh steed
5495+
- Vary vampire blood freshness from a fixed 5 to 8-15 turns per corpse
54955496

‎include/extern.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,6 +1543,7 @@ E void FDECL(add_to_buried, (struct obj *));
15431543
E void FDECL(dealloc_obj, (struct obj *));
15441544
E void FDECL(obj_ice_effects, (int, int, BOOLEAN_P));
15451545
E long FDECL(peek_at_iced_corpse_age, (struct obj *));
1546+
E long FDECL(blood_freshness, (struct obj *));
15461547
E int FDECL(hornoplenty, (struct obj *, BOOLEAN_P, struct obj *));
15471548
E void NDECL(obj_sanity_check);
15481549
E struct obj *FDECL(obj_nexto, (struct obj *));

‎src/dog.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,8 @@ struct obj *obj;
12921292
&& has_blood(&safe_mons(obj->corpsenm))
12931293
&& (!obj->odrained
12941294
|| obj->oeaten > (unsigned) drain_level(obj))
1295-
&& peek_at_iced_corpse_age(obj) + 5 >= monstermoves);
1295+
&& peek_at_iced_corpse_age(obj)
1296+
+ blood_freshness(obj) >= monstermoves);
12961297

12971298
if (!blood_corpse)
12981299
return TABU;

‎src/eat.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,7 +2051,8 @@ struct obj *otmp;
20512051
return 3;
20522052
} else if (mnum == PM_LIZARD /* lizards don't rot */
20532053
|| (rotted <= 0L
2054-
&& (peek_at_iced_corpse_age(otmp) + 5) >= monstermoves)) {
2054+
&& (peek_at_iced_corpse_age(otmp)
2055+
+ blood_freshness(otmp)) >= monstermoves)) {
20552056
char *buf = corpse_xname(otmp, (const char *) 0, CXN_PFX_THE);
20562057

20572058
You("drain the blood from %s.", buf);
@@ -3355,8 +3356,8 @@ doeat()
33553356
context.victual.piece = (struct obj *) 0; /* can't resume */
33563357

33573358
if ((otmp == context.victual.piece) && otmp->odrained
3358-
&& (peek_at_iced_corpse_age(otmp)
3359-
+ context.victual.usedtime + 5) < monstermoves)
3359+
&& (peek_at_iced_corpse_age(otmp) + context.victual.usedtime
3360+
+ blood_freshness(otmp)) < monstermoves)
33603361
context.victual.piece = (struct obj *) 0; /* can't resume */
33613362

33623363
if (otmp == context.victual.piece) {

‎src/mkobj.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,6 +2366,20 @@ struct obj *otmp;
23662366
return retval;
23672367
}
23682368

2369+
/*
2370+
* Number of turns a corpse's blood stays drinkable for a vampire after
2371+
* death (ice-adjusted age). Varies 8..15 per corpse, keyed to the
2372+
* object's o_id so the window is stable across repeated checks and
2373+
* identical for the player and a vampire pet -- it cannot be re-rolled
2374+
* by retrying the attempt.
2375+
*/
2376+
long
2377+
blood_freshness(otmp)
2378+
struct obj *otmp;
2379+
{
2380+
return 8L + (long) (otmp->o_id % 8);
2381+
}
2382+
23692383
STATIC_OVL void
23702384
obj_timer_checks(otmp, x, y, force)
23712385
struct obj *otmp;

0 commit comments

Comments
 (0)