diff --git a/lf.c b/lf.c index c6118c7..d459a32 100644 --- a/lf.c +++ b/lf.c @@ -12383,6 +12383,8 @@ void giveobflags(lifeform_t *lf, object_t *o, enum FLAG whattype) { newval[1] = f->val[2]; // cursed objects might confer different flags... + // TODO: if you uncurse the object, you don't lose the penalty until + // you take it off. if (iscursed(o)) { if (newid == F_VISRANGEMOD) { if (newval[0] != NA) { @@ -25234,8 +25236,6 @@ int takeoff(lifeform_t *lf, object_t *o) { } // remove the equipped flag - killflagsofid(o->flags, F_EQUIPPED); - taketime(lf, getactspeed(lf)); if (gamemode == GM_GAMESTARTED) { if (isplayer(lf)) { @@ -25249,15 +25249,9 @@ int takeoff(lifeform_t *lf, object_t *o) { } - unequipeffects(lf, o); - - // if you don't have a pack, it goes to the ground. - if (lfhasflag(lf, F_NOPACK)) { - moveob(o, lf->cell->obpile, o->amt); - } + makeunequipped(lf, o); return B_FALSE; - } @@ -26023,8 +26017,6 @@ int unweild(lifeform_t *lf, object_t *o) { return B_TRUE; } - // remove the equipped flag - killflagsofid(o->flags, F_EQUIPPED); // unweilding doesn't take any time if (gamemode == GM_GAMESTARTED) { @@ -26037,12 +26029,7 @@ int unweild(lifeform_t *lf, object_t *o) { } } - unequipeffects(lf, o); - - // if you don't have a pack, it goes to the ground. - if (lfhasflag(lf, F_NOPACK)) { - moveob(o, lf->cell->obpile, o->amt); - } + makeunequipped(lf, o); return B_FALSE; } diff --git a/objects.c b/objects.c index 973b3ad..254c785 100644 --- a/objects.c +++ b/objects.c @@ -9071,6 +9071,17 @@ int makedullermaybe(object_t *o, int howmuch) { return B_FALSE; } +void makeunequipped(lifeform_t *lf, object_t *o) { + // remove the equipped flag + killflagsofid(o->flags, F_EQUIPPED); + + unequipeffects(lf, o); + + // if you don't have a pack, it goes to the ground. + if (lfhasflag(lf, F_NOPACK)) { + moveob(o, lf->cell->obpile, o->amt); + } +} void makehot(object_t *o, int howmuch, int howlong) { flag_t *f; @@ -13750,6 +13761,35 @@ int readsomething(lifeform_t *lf, object_t *o) { // otherwise only equipped objects will be uncursed. if (o->blessed || isequipped(oo)) { uncurseob(oo, &seen); + if (isequipped(oo)) { + // forcibly unequip it. + makeunequipped(lf, oo); + + if (isplayer(lf)) { + char obname[BUFLEN]; + // announce + getobname(oo,obname,oo->amt); + if (oo->pile->owner == lf) { + msg("Your %s vanishes and reappears in your pack.", noprefix(obname)); + } else { + msg("Your %s vanishes and appears on the ground.", noprefix(obname)); + } + } else if (cansee(player, lf)) { + char obname[BUFLEN],lfname[BUFLEN]; + // announce + getobname(oo,obname,oo->amt); + getlfname(lf, lfname); + if (oo->pile->owner == lf) { + msg("%s%s %s vanishes and reappears in %ss pack.", lfname, + getpossessive(lfname), + noprefix(obname), it(lf)); + } else { + msg("%s%s %s vanishes and appears on the ground.", lfname, + getpossessive(lfname), + noprefix(obname)); + } + } + } } } } diff --git a/objects.h b/objects.h index bd2da9d..1ed12e7 100644 --- a/objects.h +++ b/objects.h @@ -261,6 +261,7 @@ lifeform_t *makeanimated(lifeform_t *lf, object_t *o, int level); void makecool(object_t *o, int howmuch, int howlong); int makeduller(object_t *o, int howmuch); int makedullermaybe(object_t *o, int howmuch); +void makeunequipped(lifeform_t *lf, object_t *o); void makehot(object_t *o, int howmuch, int howlong); void makeknown(enum OBTYPE otid); void makeknownobclass(enum OBCLASS ocid, enum RARITY rrlev);