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.
This commit is contained in:
Michael Meyer
2021-09-30 11:05:50 -04:00
committed by PatR
parent cffeecee26
commit b242fbce5a
2 changed files with 4 additions and 0 deletions

View File

@@ -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);

View File

@@ -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;
}