More bugfixes for the recent artifact gifting changes

This commit is contained in:
Alex Smith
2024-12-12 07:35:50 +00:00
parent 459c456838
commit 3491535548
5 changed files with 11 additions and 10 deletions

View File

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

View File

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

View File

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

View File

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

View File

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