From b242fbce5aedb13665702de41da4a57ac1af0e14 Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Thu, 30 Sep 2021 11:05:50 -0400 Subject: [PATCH] Fix: artifacts silently removed from the game Death drops will generate a random item, which may be an artifact. After the object is created, some rules are applied to check whether its size matches the monster that dropped it; if it fails these checks, the item is deleted. aosdict recently pointed out that if the death drop was an artifact, this would permanently remove it from the game. Use artifact_exist(..., FALSE) in various cases where potential artifact objects are created, then immediately removed. This will prevent artifacts from being removed from play by marking the artifact as available to create again. --- src/mon.c | 2 ++ src/sp_lev.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/mon.c b/src/mon.c index 08b7484a3..40299b0db 100644 --- a/src/mon.c +++ b/src/mon.c @@ -2954,6 +2954,8 @@ xkilled( if (mdat->msize < MZ_HUMAN && otyp != FIGURINE /* oc_big is also oc_bimanual and oc_bulky */ && (otmp->owt > 30 || objects[otyp].oc_big)) { + if (otmp->oartifact) + artifact_exists(otmp, safe_oname(otmp), FALSE); delobj(otmp); } else if (!flooreffects(otmp, x, y, nomsg ? "" : "fall")) { place_object(otmp, x, y); diff --git a/src/sp_lev.c b/src/sp_lev.c index 4117305c8..f83dc71d0 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -2219,6 +2219,8 @@ create_object(object* o, struct mkroom* croom) cobj->owt = weight(cobj); } else { obj_extract_self(otmp); + if (otmp->oartifact) + artifact_exists(otmp, safe_oname(otmp), FALSE); obfree(otmp, NULL); return; }