E void NDECL(restartcham);
E void FDECL(restore_cham, (struct monst *));
E void FDECL(mon_animal_list, (BOOLEAN_P));
-E int FDECL(newcham, (struct monst *,struct permonst *,BOOLEAN_P));
+E int FDECL(newcham, (struct monst *,struct permonst *,BOOLEAN_P,BOOLEAN_P));
E int FDECL(can_be_hatched, (int));
E int FDECL(egg_type_from_parent, (int,BOOLEAN_P));
E boolean FDECL(dead_species, (int,BOOLEAN_P));
delobj(obj);
if (poly) {
- char oldpet[BUFSZ];
-#ifdef STEED
- long mw = mtmp->misc_worn_check;
-
- mtmp->misc_worn_check &= ~W_SADDLE;
-#endif
- Strcpy(oldpet, Monnam(mtmp));
-#ifdef STEED
- mtmp->misc_worn_check = mw;
-#endif
- if (newcham(mtmp, (struct permonst *)0, FALSE) &&
- cansee(mtmp->mx, mtmp->my)) {
- uchar save_mnamelth = mtmp->mnamelth;
- mtmp->mnamelth = 0;
- pline("%s turns into %s!", oldpet, a_monnam(mtmp));
- mtmp->mnamelth = save_mnamelth;
- }
+ (void) newcham(mtmp, (struct permonst *)0, FALSE,
+ cansee(mtmp->mx, mtmp->my));
}
/* limit "instant" growth to prevent potential abuse */
if (grow && (int) mtmp->m_lev < (int)mtmp->data->mlevel + 15) {
mtmp->cham = CHAM_ORDINARY;
else {
mtmp->cham = mcham;
- (void) newcham(mtmp, rndmonst(), FALSE);
+ (void) newcham(mtmp, rndmonst(), FALSE, FALSE);
}
} else if (mndx == PM_WIZARD_OF_YENDOR) {
mtmp->iswiz = TRUE;
mdef->data != &mons[PM_FIRE_ELEMENTAL] &&
mdef->data != &mons[PM_SALAMANDER] &&
mdef->data != &mons[PM_GREEN_SLIME]) {
- if (vis) pline("%s turns into slime.", Monnam(mdef));
- (void) newcham(mdef, &mons[PM_GREEN_SLIME], FALSE);
+ (void) newcham(mdef, &mons[PM_GREEN_SLIME], FALSE, vis);
mdef->mstrategy &= ~STRAT_WAITFORU;
tmp = 0;
}
/* possibly polymorph shapechangers and lycanthropes */
if (mtmp->cham && !rn2(6))
- (void) newcham(mtmp, (struct permonst *)0, FALSE);
+ (void) newcham(mtmp, (struct permonst *)0, FALSE, FALSE);
were_change(mtmp);
/* gradually time out temporary problems */
delobj(otmp);
ptr = mtmp->data;
if (poly) {
- if (newcham(mtmp, (struct permonst *)0, FALSE))
+ if (newcham(mtmp, (struct permonst *)0,
+ FALSE, FALSE))
ptr = mtmp->data;
} else if (grow) {
ptr = grow_up(mtmp, (struct monst *)0);
delobj(otmp); /* munch */
ptr = mtmp->data;
if (poly) {
- if (newcham(mtmp, (struct permonst *)0, FALSE)) ptr = mtmp->data;
+ if (newcham(mtmp, (struct permonst *)0, FALSE, FALSE))
+ ptr = mtmp->data;
} else if (grow) {
ptr = grow_up(mtmp, (struct monst *)0);
} else if (heal) {
/* it's a golem, and not a stone golem */
if(canseemon(mtmp))
pline("%s solidifies...", Monnam(mtmp));
- if (newcham(mtmp, &mons[PM_STONE_GOLEM], FALSE)) {
+ if (newcham(mtmp, &mons[PM_STONE_GOLEM], FALSE, FALSE)) {
if(canseemon(mtmp))
pline("Now it's %s.", an(mtmp->data->mname));
} else {
mcham = (int) mtmp->cham;
if (mcham) {
mtmp->cham = CHAM_ORDINARY;
- (void) newcham(mtmp, &mons[cham_to_pm[mcham]], FALSE);
+ (void) newcham(mtmp, &mons[cham_to_pm[mcham]],
+ FALSE, FALSE);
}
if(is_were(mtmp->data) && mtmp->data->mlet != S_HUMAN)
new_were(mtmp);
mcham = (int) mon->cham;
if (mcham) {
mon->cham = CHAM_ORDINARY;
- (void) newcham(mon, &mons[cham_to_pm[mcham]], FALSE);
+ (void) newcham(mon, &mons[cham_to_pm[mcham]], FALSE, FALSE);
} else if (is_were(mon->data) && !is_human(mon->data)) {
new_were(mon);
}
/* make a chameleon look like a new monster; returns 1 if it actually changed */
int
-newcham(mtmp, mdat, polyspot)
+newcham(mtmp, mdat, polyspot, msg)
struct monst *mtmp;
struct permonst *mdat;
boolean polyspot; /* change is the result of wand or spell of polymorph */
+boolean msg; /* "The oldmon turns into a newmon!" */
{
int mhp, hpn, hpd;
int mndx, tryct;
struct permonst *olddata = mtmp->data;
+ char oldname[BUFSZ];
+
+ if (msg) {
+ /* like Monnam() but never mention saddle */
+ Strcpy(oldname, x_monnam(mtmp, ARTICLE_THE, (char *)0,
+ SUPPRESS_SADDLE, FALSE));
+ oldname[0] = highc(oldname[0]);
+ }
/* mdat = 0 -> caller wants a random monster shape */
tryct = 0;
newsym(mtmp->mx,mtmp->my);
+ if (msg) {
+ uchar save_mnamelth = mtmp->mnamelth;
+ mtmp->mnamelth = 0;
+ pline("%s turns into %s!", oldname,
+ mdat == &mons[PM_GREEN_SLIME] ? "slime" :
+ x_monnam(mtmp, ARTICLE_A, (char*)0, SUPPRESS_SADDLE, FALSE));
+ mtmp->mnamelth = save_mnamelth;
+ }
+
mon_break_armor(mtmp, polyspot);
if (!(mtmp->misc_worn_check & W_ARMG))
mselftouch(mtmp, "No longer petrify-resistant, ",
mndx = monsndx(mtmp->data);
if ((mvitals[mndx].mvflags & G_GENOD) || kill_cham[mtmp->cham]) {
if (mtmp->cham && !kill_cham[mtmp->cham])
- (void) newcham(mtmp, (struct permonst *)0, FALSE);
+ (void) newcham(mtmp, (struct permonst *)0, FALSE, FALSE);
else
mondead(mtmp);
}
case MUSE_WAN_POLYMORPH:
mzapmsg(mtmp, otmp, TRUE);
otmp->spe--;
- (void) newcham(mtmp, muse_newcham_mon(mtmp), TRUE);
+ (void) newcham(mtmp, muse_newcham_mon(mtmp), TRUE, FALSE);
if (oseen) makeknown(WAN_POLYMORPH);
return 2;
case MUSE_POT_POLYMORPH:
mquaffmsg(mtmp, otmp);
if (vismon) pline("%s suddenly mutates!", Monnam(mtmp));
- (void) newcham(mtmp, muse_newcham_mon(mtmp), FALSE);
+ (void) newcham(mtmp, muse_newcham_mon(mtmp), FALSE, FALSE);
if (oseen) makeknown(POT_POLYMORPH);
m_useup(mtmp, otmp);
return 2;
if (mtmp->wormno) worm_move(mtmp);
newsym(trapx, trapy);
- (void) newcham(mtmp, (struct permonst *)0, FALSE);
+ (void) newcham(mtmp, (struct permonst *)0, FALSE, FALSE);
return 2;
case MUSE_BULLWHIP:
/* attempt to disarm hero */
case POLY_TRAP:
if (!resists_magm(mtmp)) {
if (!resist(mtmp, WAND_CLASS, 0, NOTELL)) {
- (void) newcham(mtmp, (struct permonst *)0, FALSE);
+ (void) newcham(mtmp, (struct permonst *)0,
+ FALSE, FALSE);
if (!can_saddle(mtmp) || !can_ride(mtmp)) {
dismount_steed(DISMOUNT_POLY);
} else {
if (resists_magm(mtmp)) {
shieldeff(mtmp->mx, mtmp->my);
} else if (!resist(mtmp, WAND_CLASS, 0, NOTELL)) {
- (void) newcham(mtmp, (struct permonst *)0, FALSE);
+ (void) newcham(mtmp, (struct permonst *)0,
+ FALSE, FALSE);
if (in_sight) seetrap(trap);
}
break;
mdef->data != &mons[PM_SALAMANDER] &&
mdef->data != &mons[PM_GREEN_SLIME]) {
You("turn %s into slime.", mon_nam(mdef));
- (void) newcham(mdef, &mons[PM_GREEN_SLIME], FALSE);
+ (void) newcham(mdef, &mons[PM_GREEN_SLIME], FALSE, FALSE);
tmp = 0;
}
break;
/* no corpse after system shock */
xkilled(mtmp, 3);
} else if (newcham(mtmp, (struct permonst *)0,
- (otyp != POT_POLYMORPH))) {
+ (otyp != POT_POLYMORPH), FALSE)) {
if (!Hallucination && canspotmon(mtmp))
makeknown(otyp);
}
if (monsndx(mtmp->data) == PM_STONE_GOLEM) {
char *name = Monnam(mtmp);
/* turn into flesh golem */
- if (newcham(mtmp, &mons[PM_FLESH_GOLEM], FALSE)) {
+ if (newcham(mtmp, &mons[PM_FLESH_GOLEM], FALSE, FALSE)) {
if (canseemon(mtmp))
pline("%s turns to flesh!", name);
} else {