diff --git a/include/extern.h b/include/extern.h index 931bc1456..8eeaf7010 100644 --- a/include/extern.h +++ b/include/extern.h @@ -137,7 +137,7 @@ extern void init_artifacts(void); extern void save_artifacts(NHFILE *); extern void restore_artifacts(NHFILE *); extern const char *artiname(int); -extern struct obj *mk_artifact(struct obj *, aligntyp, uchar); +extern struct obj *mk_artifact(struct obj *, aligntyp, uchar, boolean); extern const char *artifact_name(const char *, short *, boolean) NONNULLARG1; extern boolean exist_artifact(int, const char *) NONNULLPTRS; extern void artifact_exists(struct obj *, const char *, boolean, unsigned) ; diff --git a/src/artifact.c b/src/artifact.c index 9537df732..446e4ab95 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -151,7 +151,8 @@ struct obj * mk_artifact( struct obj *otmp, /* existing object; ignored if alignment specified */ aligntyp alignment, /* target alignment, or A_NONE */ - uchar max_giftvalue) /* cap on generated giftvalue */ + uchar max_giftvalue, /* cap on generated giftvalue */ + boolean adjust_spe) /* whether to add spe to situational artifacts */ { const struct artifact *a; int m, n, altn; @@ -237,10 +238,10 @@ mk_artifact( a = &artilist[m]; /* make an appropriate object if necessary, then christen it */ - if (by_align) { - int new_spe; + otmp = mksobj((int) a->otyp, TRUE, FALSE); - otmp = mksobj((int) a->otyp, TRUE, FALSE); + if (adjust_spe) { + int new_spe; /* Adjust otmp->spe by a->gen_spe. (This is a no-op for non-weapons, which always have a gen_spe of 0, and for many diff --git a/src/mkobj.c b/src/mkobj.c index ae26c4430..e332502bd 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -880,7 +880,7 @@ mksobj_init(struct obj *otmp, boolean artif) otmp->opoisoned = 1; if (artif && !rn2(20 + (10 * nartifact_exist()))) - otmp = mk_artifact(otmp, (aligntyp) A_NONE, 99); + otmp = mk_artifact(otmp, (aligntyp) A_NONE, 99, TRUE); break; case FOOD_CLASS: otmp->oeaten = 0; @@ -1084,7 +1084,7 @@ mksobj_init(struct obj *otmp, boolean artif) } else blessorcurse(otmp, 10); if (artif && !rn2(40 + (10 * nartifact_exist()))) - otmp = mk_artifact(otmp, (aligntyp) A_NONE, 99); + otmp = mk_artifact(otmp, (aligntyp) A_NONE, 99, TRUE); /* simulate lacquered armor for samurai */ if (Role_if(PM_SAMURAI) && otmp->otyp == SPLINT_MAIL && (svm.moves <= 1 || In_quest(&u.uz))) { @@ -1230,7 +1230,7 @@ mksobj(int otyp, boolean init, boolean artif) /* unique objects may have an associated artifact entry */ if (objects[otyp].oc_unique && !otmp->oartifact) - otmp = mk_artifact(otmp, (aligntyp) A_NONE, 99); + otmp = mk_artifact(otmp, (aligntyp) A_NONE, 99, FALSE); otmp->owt = weight(otmp); return otmp; } diff --git a/src/mplayer.c b/src/mplayer.c index acccaf31c..9e839b8fd 100644 --- a/src/mplayer.c +++ b/src/mplayer.c @@ -262,7 +262,7 @@ mk_mplayer(struct permonst *ptr, coordxy x, coordxy y, boolean special) else if (!rn2(2)) otmp->greased = 1; if (special && rn2(2)) - otmp = mk_artifact(otmp, A_NONE, 99); + otmp = mk_artifact(otmp, A_NONE, 99, FALSE); /* usually increase stack size if stackable weapon */ if (objects[otmp->otyp].oc_merge && !otmp->oartifact && monmightthrowwep(otmp)) diff --git a/src/pray.c b/src/pray.c index c47e42f6d..827b03226 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1794,7 +1794,7 @@ bestow_artifact(uchar max_giftvalue) if (do_bestow) { struct obj *otmp; otmp = mk_artifact((struct obj *) 0, a_align(u.ux, u.uy), - max_giftvalue); + max_giftvalue, TRUE); if (otmp) { char buf[BUFSZ];