diff -Naur nethack-3.4.3/src/muse.c nethack-cancel/src/muse.c --- nethack-3.4.3/src/muse.c 2003-12-08 10:39:13.000000000 +1100 +++ nethack-cancel/src/muse.c 2003-12-20 13:12:34.000000000 +1100 @@ -957,6 +957,7 @@ /*#define MUSE_WAN_TELEPORTATION 15*/ #define MUSE_POT_SLEEPING 16 #define MUSE_SCR_EARTH 17 +#define MUSE_WAN_CANCELLATION 18 /* Select an offensive item/action for a monster. Returns TRUE iff one is * found. @@ -1034,6 +1035,11 @@ m.offensive = obj; m.has_offense = MUSE_WAN_STRIKING; } + nomore(MUSE_WAN_CANCELLATION); + if(obj->otyp == WAN_CANCELLATION && obj->spe > 0) { + m.offensive = obj; + m.has_offense = MUSE_WAN_CANCELLATION; + } nomore(MUSE_POT_PARALYSIS); if(obj->otyp == POT_PARALYSIS && multi >= 0) { m.offensive = obj; @@ -1308,6 +1314,7 @@ return (mtmp->mhp <= 0) ? 1 : 2; case MUSE_WAN_TELEPORTATION: case MUSE_WAN_STRIKING: + case MUSE_WAN_CANCELLATION: zap_oseen = oseen; mzapmsg(mtmp, otmp, FALSE); otmp->spe--; diff -Naur nethack-3.4.3/src/zap.c nethack-cancel/src/zap.c --- nethack-3.4.3/src/zap.c 2003-12-08 10:39:13.000000000 +1100 +++ nethack-cancel/src/zap.c 2003-12-20 13:38:40.000000000 +1100 @@ -804,6 +804,17 @@ } } +boolean cancellable(obj) +register struct obj *obj; +{ + return objects[obj->otyp].oc_magic + || (obj->spe && (obj->oclass == ARMOR_CLASS || + obj->oclass == WEAPON_CLASS || is_weptool(obj))) + || obj->otyp == POT_ACID + || obj->otyp == POT_SICKNESS; + +} + /* cancel obj, possibly carried by you or a monster */ void cancel_item(obj) @@ -854,6 +865,40 @@ break; /* case RIN_PROTECTION: not needed */ } + + + /* MRKR: Cancelled *DSM reverts to scales. */ + /* Suggested by Daniel Morris in RGRN */ + + if (obj->otyp >= GRAY_DRAGON_SCALE_MAIL && + obj->otyp <= YELLOW_DRAGON_SCALE_MAIL) { + /* dragon scale mail reverts to dragon scales */ + + boolean worn = (obj == uarm); + + if (!Blind) { + char buf[BUFSZ]; + pline("%s %s reverts to natural form!", + Shk_Your(buf, obj), xname(obj)); + } + else if (worn) { + Your("armor feels looser."); + } + costly_cancel(obj); + + if (worn) { + setworn((struct obj *)0, W_ARM); + } + + /* assumes same order */ + obj->otyp = GRAY_DRAGON_SCALES + + obj->otyp - GRAY_DRAGON_SCALE_MAIL; + + if (worn) { + setworn(obj, W_ARM); + } + } + if (objects[obj->otyp].oc_magic || (obj->spe && (obj->oclass == ARMOR_CLASS || obj->oclass == WEAPON_CLASS || is_weptool(obj))) @@ -904,6 +949,7 @@ return; } + /* Remove a positive enchantment or charge from obj, * possibly carried by you or a monster */ @@ -2248,6 +2294,36 @@ find_ac(); } } + else { /* select one random item to cancel */ + struct obj *otmp; + int count = 0; + + for (otmp = (youdefend ? invent : mdef->minvent); + otmp; otmp = otmp->nobj) { + if (cancellable(otmp)) { + count++; + } + } + + if (count > 0) { + int o = rnd(count); + + for (otmp = (youdefend ? invent : mdef->minvent); + otmp; otmp = otmp->nobj) { + if (cancellable(otmp)) { + o--; + if (o == 0) { + cancel_item(otmp); + break; + } + } + } + if (youdefend) { + flags.botl = 1; /* potential AC change */ + find_ac(); + } + } + } /* now handle special cases */ if (youdefend) {