MCPcopy Create free account
hub / github.com/NetHack/NetHack / create_particular_creation

Function create_particular_creation

src/read.c:3251–3357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3249}
3250
3251staticfn boolean
3252create_particular_creation(
3253 struct _create_particular_data *d)
3254{
3255 struct permonst *whichpm = NULL;
3256 int i, mx, my, firstchoice = NON_PM;
3257 struct monst *mtmp;
3258 boolean madeany = FALSE;
3259
3260 if (!d->randmonst) {
3261 firstchoice = d->which;
3262 if (cant_revive(&d->which, FALSE, (struct obj *) 0)
3263 && firstchoice != PM_LONG_WORM_TAIL) {
3264 /* wizard mode can override handling of special monsters */
3265 char buf[BUFSZ];
3266
3267 Sprintf(buf, "Creating %s instead; force %s?",
3268 mons[d->which].pmnames[NEUTRAL],
3269 mons[firstchoice].pmnames[NEUTRAL]);
3270 if (y_n(buf) == 'y')
3271 d->which = firstchoice;
3272 }
3273 whichpm = &mons[d->which];
3274 }
3275 for (i = 0; i < d->quan; i++) {
3276 mmflags_nht mmflags = NO_MM_FLAGS;
3277
3278 if (d->monclass != MAXMCLASSES)
3279 whichpm = mkclass(d->monclass, 0);
3280 else if (d->randmonst)
3281 whichpm = rndmonst();
3282 if (d->genderconf == -1) {
3283 /* no conflict exists between explicit gender term and
3284 the specified monster name */
3285 if (d->fem != -1 && (!whichpm || (!is_male(whichpm)
3286 && !is_female(whichpm))))
3287 mmflags |= (d->fem == FEMALE) ? MM_FEMALE
3288 : (d->fem == MALE) ? MM_MALE : 0;
3289 /* no surprise; "<mon> appears." rather than "<mon> appears!" */
3290 mmflags |= MM_NOEXCLAM;
3291 } else {
3292 /* conundrum alert: an explicit gender term conflicts with an
3293 explicit gender-tied naming term (i.e. male cavewoman) */
3294
3295 /* option not gone with: name overrides the explicit gender as
3296 commented out here */
3297 /* d->fem = d->genderconf; */
3298
3299 /* option chosen: let the explicit gender term (male or female)
3300 override the gender-tied naming term, so leave d->fem as-is */
3301
3302 mmflags |= (d->fem == FEMALE) ? MM_FEMALE
3303 : (d->fem == MALE) ? MM_MALE : 0;
3304
3305 /* another option would be to consider it a faulty specification
3306 and reject the request completely and produce a random monster
3307 with a gender matching that specified instead (i.e. there is
3308 no such thing as a male cavewoman) */

Callers 1

create_particularFunction · 0.85

Calls 12

cant_reviveFunction · 0.85
mkclassFunction · 0.85
rndmonstFunction · 0.85
makemonFunction · 0.85
tamedogFunction · 0.85
set_malignFunction · 0.85
can_saddleFunction · 0.85
which_armorFunction · 0.85
put_saddle_on_monFunction · 0.85
is_poolFunction · 0.85
flash_monFunction · 0.85
newchamFunction · 0.85

Tested by

no test coverage detected