wizard mode wishing - moat & traps
When wishing for terrain, allow type "moat" as well as "pool". And when wishing for a trap, verify that trap creation succeeded instead of always reporting that the requested type was made.
This commit is contained in:
+48
-41
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)objnam.c 3.5 2007/01/06 */
|
/* SCCS Id: @(#)objnam.c 3.5 2007/02/26 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -2701,71 +2701,77 @@ srch:
|
|||||||
* Disallow such topology tweaks for WIZKIT startup wishes.
|
* Disallow such topology tweaks for WIZKIT startup wishes.
|
||||||
*/
|
*/
|
||||||
if (wizard && !program_state.wizkit_wishing) {
|
if (wizard && !program_state.wizkit_wishing) {
|
||||||
int trap;
|
struct rm *lev;
|
||||||
|
int trap, x = u.ux, y = u.uy;
|
||||||
|
|
||||||
for (trap = NO_TRAP+1; trap < TRAPNUM; trap++) {
|
for (trap = NO_TRAP+1; trap < TRAPNUM; trap++) {
|
||||||
|
struct trap *t;
|
||||||
const char *tname;
|
const char *tname;
|
||||||
|
|
||||||
tname = defsyms[trap_to_defsym(trap)].explanation;
|
tname = defsyms[trap_to_defsym(trap)].explanation;
|
||||||
if (!strncmpi(tname, bp, strlen(tname))) {
|
if (strncmpi(tname, bp, strlen(tname))) continue;
|
||||||
/* avoid stupid mistakes */
|
/* found it; avoid stupid mistakes */
|
||||||
if((trap == TRAPDOOR || trap == HOLE)
|
if ((trap == TRAPDOOR || trap == HOLE) &&
|
||||||
&& !Can_fall_thru(&u.uz)) trap = ROCKTRAP;
|
!Can_fall_thru(&u.uz)) trap = ROCKTRAP;
|
||||||
(void) maketrap(u.ux, u.uy, trap);
|
if ((t = maketrap(x, y, trap)) != 0) {
|
||||||
pline("%s.", An(tname));
|
trap = t->ttyp;
|
||||||
return(&zeroobj);
|
tname = defsyms[trap_to_defsym(trap)].explanation;
|
||||||
}
|
pline("%s%s.", An(tname),
|
||||||
|
(trap != MAGIC_PORTAL) ? "" : " to nowhere");
|
||||||
|
} else
|
||||||
|
pline("Creation of %s failed.", An(tname));
|
||||||
|
return(&zeroobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* furniture and terrain */
|
/* furniture and terrain */
|
||||||
|
lev = &levl[x][y];
|
||||||
p = eos(bp);
|
p = eos(bp);
|
||||||
if(!BSTRCMP(bp, p-8, "fountain")) {
|
if(!BSTRCMP(bp, p-8, "fountain")) {
|
||||||
levl[u.ux][u.uy].typ = FOUNTAIN;
|
lev->typ = FOUNTAIN;
|
||||||
level.flags.nfountains++;
|
level.flags.nfountains++;
|
||||||
if(!strncmpi(bp, "magic ", 6))
|
if(!strncmpi(bp, "magic ", 6)) lev->blessedftn = 1;
|
||||||
levl[u.ux][u.uy].blessedftn = 1;
|
pline("A %sfountain.", lev->blessedftn ? "magic " : "");
|
||||||
pline("A %sfountain.",
|
newsym(x, y);
|
||||||
levl[u.ux][u.uy].blessedftn ? "magic " : "");
|
|
||||||
newsym(u.ux, u.uy);
|
|
||||||
return(&zeroobj);
|
return(&zeroobj);
|
||||||
}
|
}
|
||||||
if(!BSTRCMP(bp, p-6, "throne")) {
|
if(!BSTRCMP(bp, p-6, "throne")) {
|
||||||
levl[u.ux][u.uy].typ = THRONE;
|
lev->typ = THRONE;
|
||||||
pline("A throne.");
|
pline("A throne.");
|
||||||
newsym(u.ux, u.uy);
|
newsym(x, y);
|
||||||
return(&zeroobj);
|
return(&zeroobj);
|
||||||
}
|
}
|
||||||
# ifdef SINKS
|
# ifdef SINKS
|
||||||
if(!BSTRCMP(bp, p-4, "sink")) {
|
if(!BSTRCMP(bp, p-4, "sink")) {
|
||||||
levl[u.ux][u.uy].typ = SINK;
|
lev->typ = SINK;
|
||||||
level.flags.nsinks++;
|
level.flags.nsinks++;
|
||||||
pline("A sink.");
|
pline("A sink.");
|
||||||
newsym(u.ux, u.uy);
|
newsym(x, y);
|
||||||
return &zeroobj;
|
return &zeroobj;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
if(!BSTRCMP(bp, p-4, "pool")) {
|
/* ("water" matches "potion of water" rather than terrain) */
|
||||||
levl[u.ux][u.uy].typ = POOL;
|
if (!BSTRCMP(bp, p-4, "pool") || !BSTRCMP(bp, p-4, "moat")) {
|
||||||
del_engr_at(u.ux, u.uy);
|
lev->typ = !BSTRCMP(bp, p-4, "pool") ? POOL : MOAT;
|
||||||
pline("A pool.");
|
del_engr_at(x, y);
|
||||||
|
pline("A %s.", (lev->typ == POOL) ? "pool" : "moat");
|
||||||
/* Must manually make kelp! */
|
/* Must manually make kelp! */
|
||||||
water_damage(&level.objects[u.ux][u.uy], FALSE, TRUE);
|
water_damage(&level.objects[x][y], FALSE, TRUE);
|
||||||
newsym(u.ux, u.uy);
|
newsym(x, y);
|
||||||
return &zeroobj;
|
return &zeroobj;
|
||||||
}
|
}
|
||||||
if (!BSTRCMP(bp, p-4, "lava")) { /* also matches "molten lava" */
|
if (!BSTRCMP(bp, p-4, "lava")) { /* also matches "molten lava" */
|
||||||
levl[u.ux][u.uy].typ = LAVAPOOL;
|
lev->typ = LAVAPOOL;
|
||||||
del_engr_at(u.ux, u.uy);
|
del_engr_at(x, y);
|
||||||
pline("A pool of molten lava.");
|
pline("A pool of molten lava.");
|
||||||
if (!(Levitation || Flying)) (void) lava_effects();
|
if (!(Levitation || Flying)) (void) lava_effects();
|
||||||
newsym(u.ux, u.uy);
|
newsym(x, y);
|
||||||
return &zeroobj;
|
return &zeroobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!BSTRCMP(bp, p-5, "altar")) {
|
if(!BSTRCMP(bp, p-5, "altar")) {
|
||||||
aligntyp al;
|
aligntyp al;
|
||||||
|
|
||||||
levl[u.ux][u.uy].typ = ALTAR;
|
lev->typ = ALTAR;
|
||||||
if(!strncmpi(bp, "chaotic ", 8))
|
if(!strncmpi(bp, "chaotic ", 8))
|
||||||
al = A_CHAOTIC;
|
al = A_CHAOTIC;
|
||||||
else if(!strncmpi(bp, "neutral ", 8))
|
else if(!strncmpi(bp, "neutral ", 8))
|
||||||
@@ -2776,36 +2782,37 @@ srch:
|
|||||||
al = A_NONE;
|
al = A_NONE;
|
||||||
else /* -1 - A_CHAOTIC, 0 - A_NEUTRAL, 1 - A_LAWFUL */
|
else /* -1 - A_CHAOTIC, 0 - A_NEUTRAL, 1 - A_LAWFUL */
|
||||||
al = (!rn2(6)) ? A_NONE : rn2((int)A_LAWFUL+2) - 1;
|
al = (!rn2(6)) ? A_NONE : rn2((int)A_LAWFUL+2) - 1;
|
||||||
levl[u.ux][u.uy].altarmask = Align2amask( al );
|
lev->altarmask = Align2amask(al);
|
||||||
pline("%s altar.", An(align_str(al)));
|
pline("%s altar.", An(align_str(al)));
|
||||||
newsym(u.ux, u.uy);
|
newsym(x, y);
|
||||||
return(&zeroobj);
|
return(&zeroobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!BSTRCMP(bp, p-5, "grave") || !BSTRCMP(bp, p-9, "headstone")) {
|
if(!BSTRCMP(bp, p-5, "grave") || !BSTRCMP(bp, p-9, "headstone")) {
|
||||||
make_grave(u.ux, u.uy, (char *) 0);
|
make_grave(x, y, (char *)0);
|
||||||
pline("%s.", IS_GRAVE(levl[u.ux][u.uy].typ) ? "A grave" :
|
pline("%s.", IS_GRAVE(lev->typ) ? "A grave" :
|
||||||
"Can't place a grave here");
|
"Can't place a grave here");
|
||||||
newsym(u.ux, u.uy);
|
newsym(x, y);
|
||||||
return(&zeroobj);
|
return(&zeroobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!BSTRCMP(bp, p-4, "tree")) {
|
if(!BSTRCMP(bp, p-4, "tree")) {
|
||||||
levl[u.ux][u.uy].typ = TREE;
|
lev->typ = TREE;
|
||||||
pline("A tree.");
|
pline("A tree.");
|
||||||
newsym(u.ux, u.uy);
|
newsym(x, y);
|
||||||
block_point(u.ux, u.uy);
|
block_point(x, y);
|
||||||
return &zeroobj;
|
return &zeroobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!BSTRCMP(bp, p-4, "bars")) {
|
if(!BSTRCMP(bp, p-4, "bars")) {
|
||||||
levl[u.ux][u.uy].typ = IRONBARS;
|
lev->typ = IRONBARS;
|
||||||
pline("Iron bars.");
|
pline("Iron bars.");
|
||||||
newsym(u.ux, u.uy);
|
newsym(x, y);
|
||||||
return &zeroobj;
|
return &zeroobj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* WIZARD */
|
||||||
|
|
||||||
if(!oclass) return((struct obj *)0);
|
if(!oclass) return((struct obj *)0);
|
||||||
any:
|
any:
|
||||||
if(!oclass) oclass = wrpsym[rn2((int)sizeof(wrpsym))];
|
if(!oclass) oclass = wrpsym[rn2((int)sizeof(wrpsym))];
|
||||||
|
|||||||
Reference in New Issue
Block a user