wizard ^G tweaks

Wizard mode's ^G lets you specify "tame <foo>", "peaceful <foo>", or
"hostile <foo>" to override the created monster's default disposition.
Since it also lets you override the restriction against creating unique
monsters and various other special ones like shopkeepers (a post-3.4.3
change), it became possible to produce tame versions of monsters that
ordinarily are impossible to tame.  That's pretty iffy even when it only
applies to debugging, so switch from internal tameness conversion to use
of tamedog() to get the non-tameable cases handled.  (Minor side-effect:
full moon might prevent a request for "tame dog" from starting out tame.)

     Also, for <N>^G, give up before the specified count is reached if
creation fails when creating multiple copies of a specific type of monster,
on the assumption that the level has become filled up.  (When the type is
random, keep trying in case you subsequently get something different which
could survive on water or inside solid rock.)
This commit is contained in:
nethack.rankin
2006-09-28 03:56:02 +00:00
parent 008366c273
commit e6f9adcc53

View File

@@ -2066,30 +2066,27 @@ create_particular()
whichpm = &mons[which];
}
for (i = 0; i <= multi; i++) {
if (randmonst)
whichpm = rndmonst();
if (monclass != MAXMCLASSES)
whichpm = mkclass(monclass, 0);
else if (randmonst)
whichpm = rndmonst();
mtmp = makemon(whichpm, u.ux, u.uy, NO_MM_FLAGS);
if (!mtmp) {
/* quit trying if creation failed and is going to repeat */
if (monclass == MAXMCLASSES && !randmonst) break;
/* otherwise try again */
continue;
}
if (maketame) {
mtmp = makemon(whichpm, u.ux, u.uy, MM_EDOG);
if (mtmp) {
initedog(mtmp);
set_malign(mtmp);
newsym(mtmp->mx, mtmp->my);
}
} else {
mtmp = makemon(whichpm, u.ux, u.uy, NO_MM_FLAGS);
if ((makepeaceful || makehostile) && mtmp) {
mtmp->mtame = 0; /* sanity precaution */
mtmp->mpeaceful = makepeaceful ? 1 : 0;
set_malign(mtmp);
}
}
if (mtmp) {
madeany = TRUE;
if (mtmp->cham >= LOW_PM && firstchoice != NON_PM)
(void)newcham(mtmp, &mons[firstchoice], FALSE, FALSE);
(void) tamedog(mtmp, (struct obj *) 0);
} else if (makepeaceful || makehostile) {
mtmp->mtame = 0; /* sanity precaution */
mtmp->mpeaceful = makepeaceful ? 1 : 0;
set_malign(mtmp);
}
madeany = TRUE;
if (mtmp->cham >= LOW_PM && firstchoice != NON_PM)
(void)newcham(mtmp, &mons[firstchoice], FALSE, FALSE);
}
}
return madeany;