formatting: src/t*.c - z*.c continuation lines

End of first pass, but '[&|?:][ \t]*$' doesn't catch trailing operater
followed by end-of-line comment so more needs to be done.  As with the
past couple of batches, I've removed redundant parentheses from 'return'
statements but only for files that had continuation fix-ups.

I've also removed tabs from comments in some of the files, but didn't
start until part way through this subset of the sources.
This commit is contained in:
PatR
2015-10-28 17:33:38 -07:00
parent 530ba8e3d3
commit a447534b2f
10 changed files with 589 additions and 594 deletions
+20 -19
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 teleport.c $NHDT-Date: 1433014241 2015/05/30 19:30:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.59 $ */
/* NetHack 3.6 teleport.c $NHDT-Date: 1446078762 2015/10/29 00:32:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.61 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -387,7 +387,7 @@ boolean force_it;
register struct obj *otmp;
if (mtmp == u.usteed)
return (FALSE);
return FALSE;
if (mtmp->mleashed) {
otmp = get_mleash(mtmp);
@@ -528,7 +528,7 @@ dotele()
You("don't know that spell.");
else
You("are not able to teleport at will.");
return (0);
return 0;
}
}
}
@@ -559,9 +559,9 @@ dotele()
if (castit) {
exercise(A_WIS, TRUE);
if (spelleffects(sp_no, TRUE))
return (1);
return 1;
else if (!wizard)
return (0);
return 0;
} else {
u.uen -= energy;
context.botl = 1;
@@ -576,11 +576,11 @@ dotele()
(void) next_to_u();
} else {
You1(shudder_for_moment);
return (0);
return 0;
}
if (!trap)
morehungry(100);
return (1);
return 1;
}
void
@@ -912,19 +912,19 @@ struct monst *mtmp;
if (!xx) {
/* no current location (migrating monster arrival) */
if (dndest.nlx && On_W_tower_level(&u.uz))
return ((yy & 2) != 0)
^ /* inside xor not within */
!within_bounded_area(x, y, dndest.nlx, dndest.nly,
dndest.nhx, dndest.nhy);
return (((yy & 2) != 0)
/* inside xor not within */
^ !within_bounded_area(x, y, dndest.nlx, dndest.nly,
dndest.nhx, dndest.nhy));
if (updest.lx && (yy & 1) != 0) /* moving up */
return (within_bounded_area(x, y, updest.lx, updest.ly, updest.hx,
updest.hy)
return (within_bounded_area(x, y, updest.lx, updest.ly,
updest.hx, updest.hy)
&& (!updest.nlx
|| !within_bounded_area(x, y, updest.nlx, updest.nly,
updest.nhx, updest.nhy)));
if (dndest.lx && (yy & 1) == 0) /* moving down */
return (within_bounded_area(x, y, dndest.lx, dndest.ly, dndest.hx,
dndest.hy)
return (within_bounded_area(x, y, dndest.lx, dndest.ly,
dndest.hx, dndest.hy)
&& (!dndest.nlx
|| !within_bounded_area(x, y, dndest.nlx, dndest.nly,
dndest.nhx, dndest.nhy)));
@@ -1212,12 +1212,13 @@ register struct obj *obj;
|| (restricted_fall
&& (!within_bounded_area(tx, ty, dndest.lx, dndest.ly,
dndest.hx, dndest.hy)
|| (dndest.nlx && within_bounded_area(
tx, ty, dndest.nlx, dndest.nly,
dndest.nhx, dndest.nhy)))) ||
|| (dndest.nlx
&& within_bounded_area(tx, ty,
dndest.nlx, dndest.nly,
dndest.nhx, dndest.nhy))))
/* on the Wizard Tower levels, objects inside should
stay inside and objects outside should stay outside */
(dndest.nlx && On_W_tower_level(&u.uz)
|| (dndest.nlx && On_W_tower_level(&u.uz)
&& within_bounded_area(tx, ty, dndest.nlx, dndest.nly,
dndest.nhx, dndest.nhy)
!= within_bounded_area(otx, oty, dndest.nlx, dndest.nly,
+82 -89
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 trap.c $NHDT-Date: 1445126429 2015/10/18 00:00:29 $ $NHDT-Branch: master $:$NHDT-Revision: 1.241 $ */
/* NetHack 3.6 trap.c $NHDT-Date: 1446078765 2015/10/29 00:32:45 $ $NHDT-Branch: master $:$NHDT-Revision: 1.242 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -441,7 +441,7 @@ register int x, y, typ;
if (Sokoban)
maybe_finish_sokoban();
}
return (ttmp);
return ttmp;
}
void
@@ -600,9 +600,9 @@ int *fail_reason;
/* statues of unique monsters from bones or wishing end
up here (cant_revive() sets mnum to be doppelganger;
mptr reflects the original form for use by newcham()) */
if ((mnum == PM_DOPPELGANGER && mptr != &mons[PM_DOPPELGANGER]) ||
if ((mnum == PM_DOPPELGANGER && mptr != &mons[PM_DOPPELGANGER])
/* block quest guards from other roles */
(mptr->msound == MS_GUARDIAN
|| (mptr->msound == MS_GUARDIAN
&& quest_info(MS_GUARDIAN) != mnum)) {
mon = makemon(&mons[PM_DOPPELGANGER], x, y,
NO_MINVENT | MM_NOCOUNTBIRTH | MM_ADJACENTOK);
@@ -656,17 +656,17 @@ int *fail_reason;
/* "the|your|Manlobbi's statue [of a wombat]" */
shkp = shop_keeper(*in_rooms(mon->mx, mon->my, SHOPBASE));
Sprintf(statuename, "%s%s", shk_your(tmpbuf, statue),
(cause == ANIMATE_SPELL &&
(cause == ANIMATE_SPELL
/* avoid "of a shopkeeper" if it's Manlobbi himself
(if carried, it can't be unpaid--hence won't be
described as "Manlobbi's statue"--because there
wasn't any living shk when statue was picked up) */
(mon != shkp || carried(statue)))
&& (mon != shkp || carried(statue)))
? xname(statue)
: "statue");
pline("%s %s!", upstart(statuename), comes_to_life);
} else if (Hallucination) { /* They don't know it's a statue */
pline_The("%s suddenly seems more animated.", rndmonnam(NULL));
pline_The("%s suddenly seems more animated.", rndmonnam((char *) 0));
} else if (cause == ANIMATE_SHATTER) {
if (cansee(x, y))
Sprintf(statuename, "%s%s", shk_your(tmpbuf, statue),
@@ -691,10 +691,10 @@ int *fail_reason;
which refers to "it" so needs to follow a message describing
the object ("the statue comes to life" one above) */
if (cause != ANIMATE_NORMAL && costly_spot(x, y)
&& (shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) != 0 &&
&& (shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) != 0
/* avoid charging for Manlobbi's statue of Manlobbi
if stone-to-flesh is used on petrified shopkeep */
mon != shkp)
&& mon != shkp)
(void) stolen_value(statue, x, y, (boolean) shkp->mpeaceful,
FALSE);
@@ -2067,7 +2067,7 @@ register struct monst *mtmp;
|| (tt == HOLE && !mindless(mptr)))) {
/* it has been in such a trap - perhaps it escapes */
if (rn2(4))
return (0);
return 0;
} else {
mtmp->mtrapseen |= (1 << (tt - 1));
}
@@ -2141,7 +2141,6 @@ register struct monst *mtmp;
if (thitm(0, mtmp, otmp, d(2, 6), FALSE))
trapkilled = TRUE;
break;
case SQKY_BOARD:
if (is_flyer(mptr))
break;
@@ -2160,7 +2159,6 @@ register struct monst *mtmp;
/* wake up nearby monsters */
wake_nearto(mtmp->mx, mtmp->my, 40);
break;
case BEAR_TRAP:
if (mptr->msize > MZ_SMALL && !amorphous(mptr) && !is_flyer(mptr)
&& !is_whirly(mptr) && !unsolid(mptr)) {
@@ -2184,7 +2182,6 @@ register struct monst *mtmp;
if (mtmp->mtrapped)
trapkilled = thitm(0, mtmp, (struct obj *) 0, d(2, 4), FALSE);
break;
case SLP_GAS_TRAP:
if (!resists_sleep(mtmp) && !breathless(mptr) && !mtmp->msleeping
&& mtmp->mcanmove) {
@@ -2194,7 +2191,6 @@ register struct monst *mtmp;
}
}
break;
case RUST_TRAP: {
struct obj *target;
@@ -2256,7 +2252,7 @@ register struct monst *mtmp;
(void) split_mon(mtmp, (struct monst *) 0);
}
break;
}
} /* RUST_TRAP */
case FIRE_TRAP:
mfiretrap:
if (in_sight)
@@ -2318,7 +2314,6 @@ register struct monst *mtmp;
if (see_it)
seetrap(trap);
break;
case PIT:
case SPIKED_PIT:
fallverb = "falls";
@@ -2386,19 +2381,19 @@ register struct monst *mtmp;
} else
break;
}
/* Fall through */
/*FALLTHRU*/
case LEVEL_TELEP:
case MAGIC_PORTAL: {
int mlev_res;
mlev_res = mlevel_tele_trap(mtmp, trap, inescapable, in_sight);
if (mlev_res)
return (mlev_res);
} break;
return mlev_res;
break;
}
case TELEP_TRAP:
mtele_trap(mtmp, trap, in_sight);
break;
case WEB:
/* Monster in a web. */
if (webmaker(mptr))
@@ -2477,10 +2472,8 @@ register struct monst *mtmp;
}
}
break;
case STATUE_TRAP:
break;
case MAGIC_TRAP:
/* A magic trap. Monsters usually immune. */
if (!rn2(21))
@@ -2526,7 +2519,6 @@ register struct monst *mtmp;
newsym(trap->tx, trap->ty);
}
break;
case LANDMINE:
if (rn2(3))
break; /* monsters usually don't set it off */
@@ -2571,7 +2563,6 @@ register struct monst *mtmp;
nomovemsg = "The explosion awakens you!";
}
break;
case POLY_TRAP:
if (resists_magm(mtmp)) {
shieldeff(mtmp->mx, mtmp->my);
@@ -2583,7 +2574,6 @@ register struct monst *mtmp;
seetrap(trap);
}
break;
case ROLLING_BOULDER_TRAP:
if (!is_flyer(mptr)) {
int style = ROLL | (in_sight ? 0 : LAUNCH_UNSEEN);
@@ -2604,7 +2594,6 @@ register struct monst *mtmp;
}
}
break;
case VIBRATING_SQUARE:
if (see_it && !Blind) {
if (in_sight)
@@ -2616,7 +2605,6 @@ register struct monst *mtmp;
seetrap(trap);
}
break;
default:
impossible("Some monster encountered a strange trap of type %d.",
tt);
@@ -2810,7 +2798,7 @@ long hmask, emask; /* might cancel timeout */
if (u.uswallow) {
You("float down, but you are still %s.",
is_animal(u.ustuck->data) ? "swallowed" : "engulfed");
return (1);
return 1;
}
if (Punished && !carried(uball)
@@ -2909,10 +2897,10 @@ long hmask, emask; /* might cancel timeout */
dotrap(trap, 0);
}
if (!Is_airlevel(&u.uz) && !Is_waterlevel(&u.uz) && !u.uswallow &&
if (!Is_airlevel(&u.uz) && !Is_waterlevel(&u.uz) && !u.uswallow
/* falling through trap door calls goto_level,
and goto_level does its own pickup() call */
on_level(&u.uz, &current_dungeon_level))
&& on_level(&u.uz, &current_dungeon_level))
(void) pickup(1);
return 1;
}
@@ -3096,12 +3084,9 @@ domagictrap()
break;
/* very occasionally something nice happens. */
case 19:
/* tame nearby monsters */
{
register int i, j;
register struct monst *mtmp;
case 19: { /* tame nearby monsters */
int i, j;
struct monst *mtmp;
(void) adjattrib(A_CHA, 1, FALSE);
for (i = -1; i <= 1; i++)
@@ -3114,10 +3099,7 @@ domagictrap()
}
break;
}
case 20:
/* uncurse stuff */
{
case 20: { /* uncurse stuff */
struct obj pseudo;
long save_conf = HConfusion;
@@ -3500,14 +3482,14 @@ boolean *lostsome;
}
}
if (!otmp)
return (FALSE); /* nothing to drop! */
return FALSE; /* nothing to drop! */
if (otmp->owornmask)
remove_worn_item(otmp, FALSE);
*lostsome = TRUE;
dropx(otmp);
invc--;
}
return (TRUE);
return TRUE;
}
/*
@@ -3527,7 +3509,7 @@ drown()
if (!rn2(5))
inpool_ok = TRUE;
else
return (FALSE);
return FALSE;
}
if (!u.uinwater) {
@@ -3549,7 +3531,7 @@ drown()
losehp(i, "rusting away", KILLED_BY);
}
if (inpool_ok)
return (FALSE);
return FALSE;
if ((i = number_leashed()) > 0) {
pline_The("leash%s slip%s loose.", (i > 1) ? "es" : "",
@@ -3576,7 +3558,7 @@ drown()
u.uinwater = 1;
under_water(1);
vision_full_recalc = 1;
return (FALSE);
return FALSE;
}
if ((Teleportation || can_teleport(youmonst.data)) && !Unaware
&& (Teleport_control || rn2(3) < Luck + 2)) {
@@ -3584,14 +3566,14 @@ drown()
if (!level.flags.noteleport) {
(void) dotele();
if (!is_pool(u.ux, u.uy))
return (TRUE);
return TRUE;
} else
pline_The("attempted teleport spell fails.");
}
if (u.usteed) {
dismount_steed(DISMOUNT_GENERIC);
if (!is_pool(u.ux, u.uy))
return (TRUE);
return TRUE;
}
crawl_ok = FALSE;
x = y = 0; /* lint suppression */
@@ -3634,7 +3616,7 @@ crawl:
if (succ) {
pline("Pheew! That was close.");
teleds(x, y, TRUE);
return (TRUE);
return TRUE;
}
/* still too much weight */
pline("But in vain.");
@@ -3662,7 +3644,7 @@ crawl:
You("find yourself back %s.",
Is_waterlevel(&u.uz) ? "in an air bubble" : "on land");
}
return (TRUE);
return TRUE;
}
void
@@ -4143,7 +4125,7 @@ boolean force;
char the_trap[BUFSZ], qbuf[QBUFSZ];
if (!getdir((char *) 0))
return (0);
return 0;
x = u.ux + u.dx;
y = u.uy + u.dy;
if (!isok(x, y)) {
@@ -4199,7 +4181,7 @@ boolean force;
(ttmp->ttyp == WEB) ? "Remove" : "Disarm", the_trap);
switch (ynq(qbuf)) {
case 'q':
return (0);
return 0;
case 'n':
trap_skipped = TRUE;
deal_with_floor_trap = FALSE;
@@ -4257,7 +4239,7 @@ boolean force;
doname, ansimpleoname, "a box");
switch (ynq(qbuf)) {
case 'q':
return (0);
return 0;
case 'n':
continue;
}
@@ -4272,7 +4254,7 @@ boolean force;
switch (ynq("Disarm it?")) {
case 'q':
return (1);
return 1;
case 'n':
trap_skipped = TRUE;
continue;
@@ -4293,16 +4275,16 @@ boolean force;
}
} else
pline("That %s was not trapped.", xname(otmp));
return (1);
return 1;
} else {
You("find no traps on %s.", the(xname(otmp)));
return (1);
return 1;
}
}
You(trap_skipped ? "find no other traps here."
: "know of no traps here.");
return (0);
return 0;
}
if (stumble_on_door_mimic(x, y))
@@ -4314,19 +4296,19 @@ boolean force;
if (!IS_DOOR(levl[x][y].typ)) {
if (!trap_skipped)
You("know of no traps there.");
return (0);
return 0;
}
switch (levl[x][y].doormask) {
case D_NODOOR:
You("%s no door there.", Blind ? "feel" : "see");
return (0);
return 0;
case D_ISOPEN:
pline("This door is safely open.");
return (0);
return 0;
case D_BROKEN:
pline("This door is broken.");
return (0);
return 0;
}
if ((levl[x][y].doormask & D_TRAPPED
@@ -4335,7 +4317,7 @@ boolean force;
You("find a trap on the door!");
exercise(A_WIS, TRUE);
if (ynq("Disarm it?") != 'y')
return (1);
return 1;
if (levl[x][y].doormask & D_TRAPPED) {
ch = 15 + (Role_if(PM_ROGUE) ? u.ulevel * 3 : u.ulevel);
exercise(A_DEX, TRUE);
@@ -4355,10 +4337,10 @@ boolean force;
}
} else
pline("This door was not trapped.");
return (1);
return 1;
} else {
You("find no traps on the door.");
return (1);
return 1;
}
}
@@ -4618,7 +4600,7 @@ boolean disarm;
}
}
return TRUE;
}
} /* case 21 */
case 20:
case 19:
case 18:
@@ -4658,7 +4640,7 @@ boolean disarm;
if (dmg)
losehp(dmg, "electric shock", KILLED_BY_AN);
break;
}
} /* case 6 */
case 5:
case 4:
case 3:
@@ -4705,12 +4687,13 @@ t_at(x, y)
register int x, y;
{
register struct trap *trap = ftrap;
while (trap) {
if (trap->tx == x && trap->ty == y)
return (trap);
return trap;
trap = trap->ntrap;
}
return ((struct trap *) 0);
return (struct trap *) 0;
}
void
@@ -4720,11 +4703,14 @@ register struct trap *trap;
register struct trap *ttmp;
clear_conjoined_pits(trap);
if (trap == ftrap)
if (trap == ftrap) {
ftrap = ftrap->ntrap;
else {
for (ttmp = ftrap; ttmp->ntrap != trap; ttmp = ttmp->ntrap)
;
} else {
for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap)
if (ttmp->ntrap == trap)
break;
if (!ttmp)
panic("deltrap: no preceding trap!");
ttmp->ntrap = trap->ntrap;
}
if (Sokoban && (trap->ttyp == PIT || trap->ttyp == HOLE))
@@ -4738,6 +4724,7 @@ struct trap *trap2, *trap1;
boolean u_entering_trap2;
{
int dx, dy, diridx, adjidx;
if (!trap1 || !trap2)
return FALSE;
if (!isok(trap2->tx, trap2->ty) || !isok(trap1->tx, trap1->ty)
@@ -4766,13 +4753,14 @@ struct trap *trap;
{
int diridx, adjidx, x, y;
struct trap *t;
if (trap && (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT)) {
for (diridx = 0; diridx < 8; ++diridx) {
if (trap->conjoined & (1 << diridx)) {
x = trap->tx + xdir[diridx];
y = trap->ty + ydir[diridx];
t = t_at(x, y);
if (isok(x, y) && t
if (isok(x, y)
&& (t = t_at(x, y)) != 0
&& (t->ttyp == PIT || t->ttyp == SPIKED_PIT)) {
adjidx = (diridx + 4) % 8;
t->conjoined &= ~(1 << adjidx);
@@ -4794,20 +4782,23 @@ struct trap *trap;
{
struct trap *t;
int diridx, x, y;
if (!trap) return;
for(diridx = 0; diridx < 8; ++diridx) {
if (!trap)
return;
for (diridx = 0; diridx < 8; ++diridx) {
x = trap->tx + xdir[diridx];
y = trap->ty + ydir[diridx];
if (isok(x,y)) {
if (((t = t_at(x,y)) != 0) &&
(t->ttyp == PIT || t->ttyp == SPIKED_PIT)) {
if (isok(x, y)) {
if ((t = t_at(x, y)) != 0
&& (t->ttyp == PIT || t->ttyp == SPIKED_PIT)) {
trap->conjoined |= (1 << diridx);
join_adjacent_pits(t);
} else trap->conjoined &= ~(1 << diridx);
} else
trap->conjoined &= ~(1 << diridx);
}
}
}
#endif
#endif /*0*/
/*
* Returns TRUE if you escaped a pit and are standing on the precipice.
@@ -4929,12 +4920,14 @@ boolean nocorpse;
boolean
unconscious()
{
return (boolean)(
multi < 0
&& (u.usleep || (nomovemsg
if (multi >= 0)
return FALSE;
return (boolean) (u.usleep
|| (nomovemsg
&& (!strncmp(nomovemsg, "You awake", 9)
|| !strncmp(nomovemsg, "You regain con", 14)
|| !strncmp(nomovemsg, "You are consci", 14)))));
|| !strncmp(nomovemsg, "You are consci", 14))));
}
static const char lava_killer[] = "molten lava";
@@ -4972,8 +4965,8 @@ lava_effects()
/* Check whether we should burn away boots *first* so we know whether to
* make the player sink into the lava. Assumption: water walking only
* comes
* from boots. */
* comes from boots.
*/
if (Wwalking && uarmf && is_organic(uarmf) && !uarmf->oerodeproof) {
obj = uarmf;
pline("%s into flame!", Yobjnam2(obj, "burst"));
@@ -5041,7 +5034,7 @@ lava_effects()
pline("You're still burning.");
}
You("find yourself back on solid %s.", surface(u.ux, u.uy));
return (TRUE);
return TRUE;
} else if (!Wwalking && (!u.utrap || u.utraptype != TT_LAVA)) {
boil_away = !Fire_resistance;
/* if not fire resistant, sink_into_lava() will quickly be fatal;
@@ -5060,7 +5053,7 @@ burn_stuff:
destroy_item(SCROLL_CLASS, AD_FIRE);
destroy_item(SPBOOK_CLASS, AD_FIRE);
destroy_item(POTION_CLASS, AD_FIRE);
return (FALSE);
return FALSE;
}
/* called each turn when trapped in lava */
+43 -45
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 uhitm.c $NHDT-Date: 1445126430 2015/10/18 00:00:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.148 $ */
/* NetHack 3.6 uhitm.c $NHDT-Date: 1446078766 2015/10/29 00:32:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.149 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -116,8 +116,8 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
* If the monster dies immediately from the blow, the 'I' will
* not stay there, so the player will have suddenly forgotten
* the square's contents for no apparent reason.
if (!canspotmon(mtmp) &&
!glyph_is_invisible(levl[bhitpos.x][bhitpos.y].glyph))
if (!canspotmon(mtmp)
&& !glyph_is_invisible(levl[bhitpos.x][bhitpos.y].glyph))
map_invisible(bhitpos.x, bhitpos.y);
*/
return FALSE;
@@ -139,9 +139,9 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
/* if it was an invisible mimic, treat it as if we stumbled
* onto a visible mimic
*/
if (mtmp->m_ap_type && !Protection_from_shape_changers &&
if (mtmp->m_ap_type && !Protection_from_shape_changers
/* applied pole-arm attack is too far to get stuck */
distu(mtmp->mx, mtmp->my) <= 2) {
&& distu(mtmp->mx, mtmp->my) <= 2) {
if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK))
u.ustuck = mtmp;
}
@@ -157,7 +157,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
*/
if (glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph)) {
seemimic(mtmp);
return (FALSE);
return FALSE;
}
stumble_onto_mimic(mtmp);
return TRUE;
@@ -170,7 +170,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
newsym(mtmp->mx, mtmp->my);
if (glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph)) {
seemimic(mtmp);
return (FALSE);
return FALSE;
}
if (!((Blind ? Blind_telepat : Unblind_telepat) || Detect_monsters)) {
struct obj *obj;
@@ -198,18 +198,18 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
/* Intelligent chaotic weapons (Stormbringer) want blood */
if (wep && wep->oartifact == ART_STORMBRINGER) {
override_confirmation = TRUE;
return (FALSE);
return FALSE;
}
if (canspotmon(mtmp)) {
Sprintf(qbuf, "Really attack %s?", mon_nam(mtmp));
if (!paranoid_query(ParanoidHit, qbuf)) {
context.move = 0;
return (TRUE);
return TRUE;
}
}
}
return (FALSE);
return FALSE;
}
/*
@@ -350,13 +350,13 @@ register struct monst *mtmp;
Strcpy(buf, y_monnam(mtmp));
buf[0] = highc(buf[0]);
You("stop. %s is in the way!", buf);
return (TRUE);
return TRUE;
} else if ((mtmp->mfrozen || (!mtmp->mcanmove)
|| (mtmp->data->mmove == 0)) && rn2(6)) {
pline("%s doesn't seem to move!", Monnam(mtmp));
return (TRUE);
return TRUE;
} else
return (FALSE);
return FALSE;
}
}
@@ -368,7 +368,7 @@ register struct monst *mtmp;
bhitpos.x = u.ux + u.dx;
bhitpos.y = u.uy + u.dy;
if (attack_checks(mtmp, uwep))
return (TRUE);
return TRUE;
if (Upolyd && noattacks(youmonst.data)) {
/* certain "pacifist" monsters don't attack */
@@ -377,9 +377,9 @@ register struct monst *mtmp;
goto atk_done;
}
if (check_capacity("You cannot fight while so heavily loaded.") ||
if (check_capacity("You cannot fight while so heavily loaded.")
/* consume extra nutrition during combat; maybe pass out */
overexertion())
|| overexertion())
goto atk_done;
if (u.twoweap && !can_twoweapon())
@@ -408,7 +408,7 @@ register struct monst *mtmp;
&& (m_move(mtmp, 0) == 2 || /* it died */
mtmp->mx != u.ux + u.dx
|| mtmp->my != u.uy + u.dy)) /* it moved */
return (FALSE);
return FALSE;
if (Upolyd)
(void) hmonas(mtmp);
@@ -427,7 +427,7 @@ atk_done:
&& !(u.uswallow && mtmp == u.ustuck))
map_invisible(u.ux + u.dx, u.uy + u.dy);
return (TRUE);
return TRUE;
}
/* really hit target monster; returns TRUE if it still lives */
@@ -483,7 +483,7 @@ struct attack *uattk;
cutworm(mon, x, y, weapon);
}
}
return (malive);
return malive;
}
/* hit target monster; returns TRUE if it still lives */
@@ -514,7 +514,7 @@ struct attack *uattk;
if (wepbefore && !uwep)
wep_was_destroyed = TRUE;
(void) passive(mon, mhit, malive, AT_WEAP, wep_was_destroyed);
return (malive);
return malive;
}
boolean /* general "damage monster" routine */
@@ -558,9 +558,9 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
boolean silvermsg = FALSE, silverobj = FALSE;
boolean valid_weapon_attack = FALSE;
boolean unarmed = !uwep && !uarm && !uarms;
boolean hand_to_hand = (thrown == HMON_MELEE ||
boolean hand_to_hand = (thrown == HMON_MELEE
/* not grapnels; applied implies uwep */
(thrown == HMON_APPLIED && is_pole(uwep)));
|| (thrown == HMON_APPLIED && is_pole(uwep)));
int jousting = 0;
int wtype;
struct obj *monwep;
@@ -602,13 +602,13 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
|| obj->oclass == GEM_CLASS) {
/* is it not a melee weapon? */
if (/* if you strike with a bow... */
is_launcher(obj) ||
is_launcher(obj)
/* or strike with a missile in your hand... */
(!thrown && (is_missile(obj) || is_ammo(obj))) ||
|| (!thrown && (is_missile(obj) || is_ammo(obj)))
/* or use a pole at short range and not mounted... */
(!thrown && !u.usteed && is_pole(obj)) ||
|| (!thrown && !u.usteed && is_pole(obj))
/* or throw a missile without the proper bow... */
(is_ammo(obj) && (thrown != HMON_THROWN
|| (is_ammo(obj) && (thrown != HMON_THROWN
|| !ammo_and_launcher(obj, uwep)))) {
/* then do only 1-2 points of damage */
if (mdat == &mons[PM_SHADE] && !shade_glare(obj))
@@ -644,9 +644,9 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
valid_weapon_attack = (tmp > 1);
if (!valid_weapon_attack || mon == u.ustuck || u.twoweap) {
; /* no special bonuses */
} else if (mon->mflee && Role_if(PM_ROGUE) && !Upolyd &&
} else if (mon->mflee && Role_if(PM_ROGUE) && !Upolyd
/* multi-shot throwing is too powerful here */
hand_to_hand) {
&& hand_to_hand) {
You("strike %s from behind!", mon_nam(mon));
tmp += rnd(u.ulevel);
hittxt = TRUE;
@@ -759,9 +759,7 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
ysimple_name(obj));
release_camera_demon(obj, u.ux, u.uy);
useup(obj);
return (TRUE);
/*NOTREACHED*/
break;
return TRUE;
case CORPSE: /* fixed by polder@cs.vu.nl */
if (touch_petrifies(&mons[obj->corpsenm])) {
tmp = 1;
@@ -776,10 +774,10 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
if (resists_ston(mon))
break;
/* note: hp may be <= 0 even if munstoned==TRUE */
return (boolean)(mon->mhp > 0);
return (boolean) (mon->mhp > 0);
#if 0
} else if (touch_petrifies(mdat)) {
/* maybe turn the corpse into a statue? */
; /* maybe turn the corpse into a statue? */
#endif
}
tmp = (obj->corpsenm >= LOW_PM ? mons[obj->corpsenm].msize
@@ -825,7 +823,7 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
minstapetrify(mon, TRUE);
if (resists_ston(mon))
break;
return (boolean)(mon->mhp > 0);
return (boolean) (mon->mhp > 0);
} else { /* ordinary egg(s) */
const char *eggp =
(obj->corpsenm != NON_PM && obj->known)
@@ -1403,7 +1401,7 @@ register struct attack *mattk;
&& u.umonnum != PM_SUCCUBUS && u.umonnum != PM_INCUBUS
&& u.umonnum != PM_BALROG) {
demonpet();
return (0);
return 0;
}
switch (mattk->adtyp) {
case AD_STUN:
@@ -1764,9 +1762,9 @@ register struct attack *mattk;
xkilled(mdef, 0);
} else if (tmp)
killed(mdef);
return (2);
return 2;
}
return (1);
return 1;
}
STATIC_OVL int
@@ -1807,7 +1805,7 @@ register struct attack *mattk;
mdef->mhp -= tmp;
if (mdef->mhp <= 0) {
killed(mdef);
return (2);
return 2;
}
} else {
shieldeff(mdef->mx, mdef->my);
@@ -1820,7 +1818,7 @@ register struct attack *mattk;
default:
break;
}
return (1);
return 1;
}
STATIC_OVL void
@@ -1957,7 +1955,7 @@ register struct attack *mattk;
exercise(A_CON, TRUE);
}
end_engulf();
return (2);
return 2;
case AD_PHYS:
if (youmonst.data == &mons[PM_FOG_CLOUD]) {
pline("%s is laden with your moisture.", Monnam(mdef));
@@ -2032,7 +2030,7 @@ register struct attack *mattk;
if ((mdef->mhp -= dam) <= 0) {
killed(mdef);
if (mdef->mhp <= 0) /* not lifesaved */
return (2);
return 2;
}
You("%s %s!", is_animal(youmonst.data) ? "regurgitate" : "expel",
mon_nam(mdef));
@@ -2042,7 +2040,7 @@ register struct attack *mattk;
}
}
}
return (0);
return 0;
}
void
@@ -2105,7 +2103,7 @@ register struct monst *mon;
sum[i] = dhit;
/* might be a worm that gets cut in half */
if (m_at(u.ux + u.dx, u.uy + u.dy) != mon)
return (boolean)(nsum != 0);
return (boolean) (nsum != 0);
/* Do not print "You hit" message, since known_hitum
* already did it.
*/
@@ -2247,7 +2245,7 @@ register struct monst *mon;
rehumanize();
}
if (sum[i] == 2)
return ((boolean) passive(mon, 1, 0, mattk->aatyp, FALSE));
return (boolean) passive(mon, 1, 0, mattk->aatyp, FALSE);
/* defender dead */
else {
(void) passive(mon, sum[i], 1, mattk->aatyp, FALSE);
@@ -2258,7 +2256,7 @@ register struct monst *mon;
if (multi < 0)
break; /* If paralyzed while attacking, i.e. floating eye */
}
return ((boolean)(nsum != 0));
return (boolean) (nsum != 0);
}
/* Special (passive) attacks on you by monsters done here. */
+50 -46
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 vault.c $NHDT-Date: 1432512773 2015/05/25 00:12:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.38 $ */
/* NetHack 3.6 vault.c $NHDT-Date: 1446078792 2015/10/29 00:33:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.39 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -126,7 +126,7 @@ int x, y;
STATIC_OVL void
restfakecorr(grd)
register struct monst *grd;
struct monst *grd;
{
/* it seems you left the corridor - let the guard disappear */
if (clear_fcorr(grd, FALSE)) {
@@ -135,10 +135,12 @@ register struct monst *grd;
}
}
boolean grddead(grd) /* called in mon.c */
register struct monst *grd;
/* called in mon.c */
boolean
grddead(grd)
struct monst *grd;
{
register boolean dispose = clear_fcorr(grd, TRUE);
boolean dispose = clear_fcorr(grd, TRUE);
if (!dispose) {
/* destroy guard's gold; drop any other inventory */
@@ -162,16 +164,16 @@ register struct monst *grd;
STATIC_OVL boolean
in_fcorridor(grd, x, y)
register struct monst *grd;
struct monst *grd;
int x, y;
{
register int fci;
struct egd *egrd = EGD(grd);
for (fci = EGD(grd)->fcbeg; fci < EGD(grd)->fcend; fci++)
if (x == EGD(grd)->fakecorr[fci].fx
&& y == EGD(grd)->fakecorr[fci].fy)
return (TRUE);
return (FALSE);
for (fci = egrd->fcbeg; fci < egrd->fcend; fci++)
if (x == egrd->fakecorr[fci].fx && y == egrd->fakecorr[fci].fy)
return TRUE;
return FALSE;
}
STATIC_OVL
@@ -184,9 +186,9 @@ findgd()
if (DEADMONSTER(mtmp))
continue;
if (mtmp->isgd && on_level(&(EGD(mtmp)->gdlevel), &u.uz))
return (mtmp);
return mtmp;
}
return ((struct monst *) 0);
return (struct monst *) 0;
}
char
@@ -197,8 +199,8 @@ char *array;
for (ptr = array; *ptr; ptr++)
if (rooms[*ptr - ROOMOFFSET].rtype == VAULT)
return (*ptr);
return ('\0');
return *ptr;
return '\0';
}
void
@@ -376,10 +378,9 @@ invault()
(void) mungspaces(buf);
} while (!letter(buf[0]) && --trycount > 0);
if (u.ualign.type == A_LAWFUL &&
/* ignore trailing text, in case player includes character's rank
*/
strncmpi(buf, plname, (int) strlen(plname)) != 0) {
if (u.ualign.type == A_LAWFUL
/* ignore trailing text, in case player includes rank */
&& strncmpi(buf, plname, (int) strlen(plname)) != 0) {
adjalign(-1); /* Liar! */
}
@@ -542,18 +543,17 @@ register struct monst *grd;
uchar typ;
struct fakecorridor *fcp;
register struct egd *egrd = EGD(grd);
register struct rm *crm;
register boolean goldincorridor = FALSE,
struct rm *crm;
boolean goldincorridor = FALSE,
u_in_vault = vault_occupied(u.urooms) ? TRUE : FALSE,
grd_in_vault =
*in_rooms(grd->mx, grd->my, VAULT) ? TRUE : FALSE;
grd_in_vault = *in_rooms(grd->mx, grd->my, VAULT) ? TRUE : FALSE;
boolean disappear_msg_seen = FALSE, semi_dead = (grd->mhp <= 0);
long umoney = money_cnt(invent);
register boolean u_carry_gold = ((umoney + hidden_gold()) > 0L);
boolean see_guard, newspot = FALSE;
if (!on_level(&(egrd->gdlevel), &u.uz))
return (-1);
return -1;
nx = ny = m = n = 0;
if (!u_in_vault && !grd_in_vault)
wallify_vault(grd);
@@ -572,17 +572,17 @@ register struct monst *grd;
}
if (!in_fcorridor(grd, grd->mx, grd->my))
(void) clear_fcorr(grd, TRUE);
return (-1);
return -1;
}
if (abs(egrd->ogx - grd->mx) > 1 || abs(egrd->ogy - grd->my) > 1)
return (-1); /* teleported guard - treat as monster */
return -1; /* teleported guard - treat as monster */
if (egrd->witness) {
verbalize("How dare you %s that gold, scoundrel!",
(egrd->witness & GD_EATGOLD) ? "consume" : "destroy");
egrd->witness = 0;
grd->mpeaceful = 0;
return (-1);
return -1;
}
if (egrd->fcend == 1) {
if (u_in_vault && (u_carry_gold || um_dist(grd->mx, grd->my, 1))) {
@@ -601,12 +601,12 @@ register struct monst *grd;
levl[m][n].typ = egrd->fakecorr[0].ftyp;
newsym(m, n);
grd->mpeaceful = 0;
return (-1);
return -1;
}
/* not fair to get mad when (s)he's fainted or paralyzed */
if (!is_fainted() && multi >= 0)
egrd->warncnt++;
return (0);
return 0;
}
if (!u_in_vault) {
@@ -626,7 +626,7 @@ register struct monst *grd;
: "are confronted by %s.",
/* "an angry guard" */
x_monnam(grd, ARTICLE_A, "angry", 0, FALSE));
return (-1);
return -1;
} else {
if (!Deaf)
verbalize("Well, begone.");
@@ -646,23 +646,23 @@ register struct monst *grd;
disappear_msg_seen = TRUE;
goto cleanup;
}
if (u_carry_gold && (in_fcorridor(grd, u.ux, u.uy) ||
if (u_carry_gold && (in_fcorridor(grd, u.ux, u.uy)
/* cover a 'blind' spot */
(egrd->fcend > 1 && u_in_vault))) {
|| (egrd->fcend > 1 && u_in_vault))) {
if (!grd->mx) {
restfakecorr(grd);
return (-2);
return -2;
}
if (egrd->warncnt < 6) {
egrd->warncnt = 6;
if (!Deaf)
verbalize("Drop all your gold, scoundrel!");
return (0);
return 0;
} else {
if (!Deaf)
verbalize("So be it, rogue!");
grd->mpeaceful = 0;
return (-1);
return -1;
}
}
}
@@ -714,7 +714,7 @@ register struct monst *grd;
&& !(u.ustuck && !sticks(youmonst.data)))
verbalize("Move along!");
restfakecorr(grd);
return (0); /* didn't move */
return 0; /* didn't move */
}
x = grd->mx;
y = grd->my;
@@ -834,9 +834,9 @@ newpos:
if (!semi_dead && (in_fcorridor(grd, u.ux, u.uy) || cansee(x, y))) {
if (!disappear_msg_seen && see_guard)
pline("Suddenly, %s disappears.", noit_mon_nam(grd));
return (1);
return 1;
}
return (-2);
return -2;
}
egrd->ogx = grd->mx; /* update old positions */
egrd->ogy = grd->my;
@@ -852,7 +852,7 @@ newpos:
} else
newsym(grd->mx, grd->my);
restfakecorr(grd);
return (1);
return 1;
}
/* Routine when dying or quitting with a vault guard around */
@@ -900,25 +900,27 @@ paygd()
long
hidden_gold()
{
register long value = 0L;
register struct obj *obj;
long value = 0L;
struct obj *obj;
for (obj = invent; obj; obj = obj->nobj)
if (Has_contents(obj))
value += contained_gold(obj);
/* unknown gold stuck inside statues may cause some consternation... */
return (value);
return value;
}
boolean gd_sound() /* prevent "You hear footsteps.." when inappropriate */
/* prevent "You hear footsteps.." when inappropriate */
boolean
gd_sound()
{
register struct monst *grd = findgd();
struct monst *grd = findgd();
if (vault_occupied(u.urooms))
return (FALSE);
return FALSE;
else
return ((boolean)(grd == (struct monst *) 0));
return (boolean) (grd == (struct monst *) 0);
}
void
@@ -926,9 +928,11 @@ vault_gd_watching(activity)
unsigned int activity;
{
struct monst *guard = findgd();
if (guard && guard->mcansee && m_canseeu(guard)) {
if (activity == GD_EATGOLD || activity == GD_DESTROYGOLD)
EGD(guard)->witness = activity;
}
}
/*vault.c*/
+48 -38
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 weapon.c $NHDT-Date: 1445126431 2015/10/18 00:00:31 $ $NHDT-Branch: master $:$NHDT-Revision: 1.54 $ */
/* NetHack 3.6 weapon.c $NHDT-Date: 1446078767 2015/10/29 00:32:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.55 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -348,13 +348,13 @@ struct monst *mon;
tmp = 1;
}
return (tmp);
return tmp;
}
STATIC_DCL struct obj *FDECL(oselect, (struct monst *, int));
#define Oselect(x) \
if ((otmp = oselect(mtmp, x)) != 0) \
return (otmp);
return otmp;
STATIC_OVL struct obj *
oselect(mtmp, x)
@@ -365,9 +365,8 @@ int x;
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj) {
if (otmp->otyp == x
&&
/* never select non-cockatrice corpses */
!((x == CORPSE || x == EGG)
&& !((x == CORPSE || x == EGG)
&& !touch_petrifies(&mons[otmp->corpsenm]))
&& (!otmp->oartifact || touch_artifact(otmp, mtmp)))
return otmp;
@@ -391,7 +390,9 @@ static NEARDATA const int pwep[] = { HALBERD, BARDICHE, SPETUM,
static struct obj *propellor;
struct obj *select_rwep(mtmp) /* select a ranged weapon for the monster */
/* select a ranged weapon for the monster */
struct obj *
select_rwep(mtmp)
register struct monst *mtmp;
{
register struct obj *otmp;
@@ -497,7 +498,7 @@ register struct monst *mtmp;
/* Don't throw a cursed weapon-in-hand or an artifact */
if ((otmp = oselect(mtmp, rwep[i])) && !otmp->oartifact
&& !(otmp == MON_WEP(mtmp) && mwelded(otmp)))
return (otmp);
return otmp;
} else
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj) {
if (otmp->otyp == LOADSTONE && !otmp->cursed)
@@ -523,8 +524,9 @@ static const NEARDATA short hwep[] = {
SCALPEL, KNIFE, WORM_TOOTH
};
/* select a hand to hand weapon for the monster */
struct obj *
select_hwep(mtmp) /* select a hand to hand weapon for the monster */
select_hwep(mtmp)
register struct monst *mtmp;
{
register struct obj *otmp;
@@ -772,7 +774,7 @@ abon()
else if (dex < 8)
return (sbon - 1);
else if (dex < 14)
return (sbon);
return sbon;
else
return (sbon + dex - 14);
}
@@ -784,24 +786,24 @@ dbon()
int str = ACURR(A_STR);
if (Upolyd)
return (0);
return 0;
if (str < 6)
return (-1);
return -1;
else if (str < 16)
return (0);
return 0;
else if (str < 18)
return (1);
return 1;
else if (str == 18)
return (2); /* up to 18 */
return 2; /* up to 18 */
else if (str <= STR18(75))
return (3); /* up to 18/75 */
return 3; /* up to 18/75 */
else if (str <= STR18(90))
return (4); /* up to 18/90 */
return 4; /* up to 18/90 */
else if (str < STR18(100))
return (5); /* up to 18/99 */
return 5; /* up to 18/99 */
else
return (6);
return 6;
}
/* increase a towel's wetness */
@@ -933,12 +935,17 @@ can_advance(skill, speedy)
int skill;
boolean speedy;
{
return !P_RESTRICTED(skill) && P_SKILL(skill) < P_MAX_SKILL(skill)
&& ((wizard && speedy)
|| (P_ADVANCE(skill) >= (unsigned) practice_needed_to_advance(
P_SKILL(skill))
&& u.skills_advanced < P_SKILL_LIMIT
&& u.weapon_slots >= slots_required(skill)));
if (P_RESTRICTED(skill)
|| P_SKILL(skill) >= P_MAX_SKILL(skill)
|| u.skills_advanced >= P_SKILL_LIMIT)
return FALSE;
if (wizard && speedy)
return TRUE;
return (boolean) ((int) P_ADVANCE(skill)
>= practice_needed_to_advance(P_SKILL(skill))
&& u.weapon_slots >= slots_required(skill));
}
/* return true if this skill could be advanced if more slots were available */
@@ -946,10 +953,13 @@ STATIC_OVL boolean
could_advance(skill)
int skill;
{
return !P_RESTRICTED(skill) && P_SKILL(skill) < P_MAX_SKILL(skill)
&& ((P_ADVANCE(skill)
>= (unsigned) practice_needed_to_advance(P_SKILL(skill))
&& u.skills_advanced < P_SKILL_LIMIT));
if (P_RESTRICTED(skill)
|| P_SKILL(skill) >= P_MAX_SKILL(skill)
|| u.skills_advanced >= P_SKILL_LIMIT)
return FALSE;
return (boolean) ((int) P_ADVANCE(skill)
>= practice_needed_to_advance(P_SKILL(skill)));
}
/* return true if this skill has reached its maximum and there's been enough
@@ -958,9 +968,12 @@ STATIC_OVL boolean
peaked_skill(skill)
int skill;
{
return !P_RESTRICTED(skill) && P_SKILL(skill) >= P_MAX_SKILL(skill)
&& ((P_ADVANCE(skill)
>= (unsigned) practice_needed_to_advance(P_SKILL(skill))));
if (P_RESTRICTED(skill))
return FALSE;
return (boolean) (P_SKILL(skill) >= P_MAX_SKILL(skill)
&& ((int) P_ADVANCE(skill)
>= practice_needed_to_advance(P_SKILL(skill))));
}
STATIC_OVL void
@@ -1186,8 +1199,7 @@ int n; /* number of slots to lose; normally one */
int skill;
while (--n >= 0) {
/* deduct first from unused slots, then from last placed slot, if any
*/
/* deduct first from unused slots then from last placed one, if any */
if (u.weapon_slots) {
u.weapon_slots--;
} else if (u.skills_advanced) {
@@ -1212,14 +1224,12 @@ struct obj *obj;
int type;
if (!obj)
/* Not using a weapon */
return (P_BARE_HANDED_COMBAT);
return P_BARE_HANDED_COMBAT; /* Not using a weapon */
if (obj->oclass != WEAPON_CLASS && obj->oclass != TOOL_CLASS
&& obj->oclass != GEM_CLASS)
/* Not a weapon, weapon-tool, or ammo */
return (P_NONE);
return P_NONE; /* Not a weapon, weapon-tool, or ammo */
type = objects[obj->otyp].oc_skill;
return ((type < 0) ? -type : type);
return (type < 0) ? -type : type;
}
int
+57 -58
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 wizard.c $NHDT-Date: 1436753529 2015/07/13 02:12:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.39 $ */
/* NetHack 3.6 wizard.c $NHDT-Date: 1446078768 2015/10/29 00:32:48 $ $NHDT-Branch: master $:$NHDT-Revision: 1.42 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -92,8 +92,8 @@ register struct monst *mtmp;
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
if (otmp->otyp == AMULET_OF_YENDOR)
return (1);
return (0);
return 1;
return 0;
}
int
@@ -107,8 +107,8 @@ register struct monst *mtmp;
|| otmp->otyp == BELL_OF_OPENING
|| otmp->otyp == CANDELABRUM_OF_INVOCATION
|| otmp->otyp == SPE_BOOK_OF_THE_DEAD)
return (1);
return (0);
return 1;
return 0;
}
/*
@@ -130,17 +130,17 @@ register int mask;
{
switch (mask) {
case M3_WANTSAMUL:
return (AMULET_OF_YENDOR);
return AMULET_OF_YENDOR;
case M3_WANTSBELL:
return (BELL_OF_OPENING);
return BELL_OF_OPENING;
case M3_WANTSCAND:
return (CANDELABRUM_OF_INVOCATION);
return CANDELABRUM_OF_INVOCATION;
case M3_WANTSBOOK:
return (SPE_BOOK_OF_THE_DEAD);
return SPE_BOOK_OF_THE_DEAD;
default:
break; /* 0 signifies quest artifact */
}
return (0);
return 0;
}
/*
@@ -158,11 +158,11 @@ register short otyp;
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj) {
if (otyp) {
if (otmp->otyp == otyp)
return (1);
return 1;
} else if (is_quest_artifact(otmp))
return (1);
return 1;
}
return (0);
return 0;
}
STATIC_OVL struct monst *
@@ -176,9 +176,9 @@ register short otyp;
/* no need for !DEADMONSTER check here since they have no inventory */
if (mtmp2 != mtmp)
if (mon_has_arti(mtmp2, otyp))
return (mtmp2);
return mtmp2;
return ((struct monst *) 0);
return (struct monst *) 0;
}
STATIC_OVL struct obj *
@@ -190,10 +190,10 @@ register short otyp;
for (otmp = fobj; otmp; otmp = otmp->nobj)
if (otyp) {
if (otmp->otyp == otyp)
return (otmp);
return otmp;
} else if (is_quest_artifact(otmp))
return (otmp);
return ((struct obj *) 0);
return otmp;
return (struct obj *) 0;
}
STATIC_OVL boolean
@@ -202,19 +202,19 @@ register int mask;
{
switch (mask) {
case M3_WANTSAMUL:
return (boolean)(u.uhave.amulet);
return (boolean) u.uhave.amulet;
case M3_WANTSBELL:
return (boolean)(u.uhave.bell);
return (boolean) u.uhave.bell;
case M3_WANTSCAND:
return (boolean)(u.uhave.menorah);
return (boolean) u.uhave.menorah;
case M3_WANTSBOOK:
return (boolean)(u.uhave.book);
return (boolean) u.uhave.book;
case M3_WANTSARTI:
return (boolean)(u.uhave.questart);
return (boolean) u.uhave.questart;
default:
break;
}
return (0);
return 0;
}
STATIC_OVL unsigned long
@@ -232,15 +232,15 @@ register struct monst *mtmp;
otyp = which_arti(mask);
if (!mon_has_arti(mtmp, otyp)) {
if (you_have(mask))
return (STRAT(STRAT_PLAYER, u.ux, u.uy, mask));
return STRAT(STRAT_PLAYER, u.ux, u.uy, mask);
else if ((otmp = on_ground(otyp)))
return (STRAT(STRAT_GROUND, otmp->ox, otmp->oy, mask));
else if ((mtmp2 = other_mon_has_arti(mtmp, otyp)) != 0 &&
return STRAT(STRAT_GROUND, otmp->ox, otmp->oy, mask);
else if ((mtmp2 = other_mon_has_arti(mtmp, otyp)) != 0
/* when seeking the Amulet, avoid targetting the Wizard
or temple priests (to protect Moloch's high priest) */
(otyp != AMULET_OF_YENDOR
&& (otyp != AMULET_OF_YENDOR
|| (!mtmp2->iswiz && !inhistemple(mtmp2))))
return (STRAT(STRAT_MONSTR, mtmp2->mx, mtmp2->my, mask));
return STRAT(STRAT_MONSTR, mtmp2->mx, mtmp2->my, mask);
}
return (unsigned long) STRAT_NONE;
}
@@ -251,24 +251,24 @@ register struct monst *mtmp;
{
unsigned long strat, dstrat;
if (!is_covetous(mtmp->data) ||
if (!is_covetous(mtmp->data)
/* perhaps a shopkeeper has been polymorphed into a master
lich; we don't want it teleporting to the stairs to heal
because that will leave its shop untended */
(mtmp->isshk && inhishop(mtmp)) ||
|| (mtmp->isshk && inhishop(mtmp))
/* likewise for temple priests */
(mtmp->ispriest && inhistemple(mtmp)))
|| (mtmp->ispriest && inhistemple(mtmp)))
return (unsigned long) STRAT_NONE;
switch ((mtmp->mhp * 3) / mtmp->mhpmax) { /* 0-3 */
default:
case 0: /* panic time - mtmp is almost snuffed */
return (unsigned long) (STRAT_HEAL);
return (unsigned long) STRAT_HEAL;
case 1: /* the wiz is less cautious */
if (mtmp->data != &mons[PM_WIZARD_OF_YENDOR])
return (unsigned long) (STRAT_HEAL);
return (unsigned long) STRAT_HEAL;
/* else fall through */
case 2:
@@ -282,29 +282,28 @@ register struct monst *mtmp;
if (context.made_amulet)
if ((strat = target_on(M3_WANTSAMUL, mtmp)) != STRAT_NONE)
return (strat);
return strat;
if (u.uevent.invoked) { /* priorities change once gate opened */
if ((strat = target_on(M3_WANTSARTI, mtmp)) != STRAT_NONE)
return (strat);
return strat;
if ((strat = target_on(M3_WANTSBOOK, mtmp)) != STRAT_NONE)
return (strat);
return strat;
if ((strat = target_on(M3_WANTSBELL, mtmp)) != STRAT_NONE)
return (strat);
return strat;
if ((strat = target_on(M3_WANTSCAND, mtmp)) != STRAT_NONE)
return (strat);
return strat;
} else {
if ((strat = target_on(M3_WANTSBOOK, mtmp)) != STRAT_NONE)
return (strat);
return strat;
if ((strat = target_on(M3_WANTSBELL, mtmp)) != STRAT_NONE)
return (strat);
return strat;
if ((strat = target_on(M3_WANTSCAND, mtmp)) != STRAT_NONE)
return (strat);
return strat;
if ((strat = target_on(M3_WANTSARTI, mtmp)) != STRAT_NONE)
return (strat);
return strat;
}
return (dstrat);
return dstrat;
}
int
@@ -333,14 +332,14 @@ register struct monst *mtmp;
if (distu(mtmp->mx, mtmp->my) > (BOLT_LIM * BOLT_LIM))
if (mtmp->mhp <= mtmp->mhpmax - 8) {
mtmp->mhp += rnd(8);
return (1);
return 1;
}
/* fall through :-) */
case STRAT_NONE: /* harass */
if (!rn2(!mtmp->mflee ? 5 : 33))
mnexto(mtmp);
return (0);
return 0;
default: /* kill, maim, pillage! */
{
@@ -350,12 +349,12 @@ register struct monst *mtmp;
struct obj *otmp;
if (!targ) { /* simply wants you to close */
return (0);
return 0;
}
if ((u.ux == tx && u.uy == ty) || where == STRAT_PLAYER) {
/* player is standing on it (or has it) */
mnexto(mtmp);
return (0);
return 0;
}
if (where == STRAT_GROUND) {
if (!MON_AT(tx, ty) || (mtmp->mx == tx && mtmp->my == ty)) {
@@ -370,23 +369,23 @@ register struct monst *mtmp;
: distant_name(otmp, doname));
obj_extract_self(otmp);
(void) mpickobj(mtmp, otmp);
return (1);
return 1;
} else
return (0);
return 0;
} else {
/* a monster is standing on it - cause some trouble */
if (!rn2(5))
mnexto(mtmp);
return (0);
return 0;
}
} else { /* a monster has it - 'port beside it. */
(void) mnearto(mtmp, tx, ty, FALSE);
return (0);
return 0;
}
}
}
/*NOTREACHED*/
return (0);
return 0;
}
void
@@ -525,9 +524,9 @@ resurrect()
verb = "elude";
mmtmp = &migrating_mons;
while ((mtmp = *mmtmp) != 0) {
if (mtmp->iswiz &&
if (mtmp->iswiz
/* if he has the Amulet, he won't bring it to you */
!mon_has_amulet(mtmp)
&& !mon_has_amulet(mtmp)
&& (elapsed = monstermoves - mtmp->mlstmv) > 0L) {
mon_catchup_elapsed_time(mtmp, elapsed);
if (elapsed >= LARGEST_INT)
@@ -559,8 +558,8 @@ resurrect()
}
}
/* Here, we make trouble for the poor shmuck who actually */
/* managed to do in the Wizard. */
/* Here, we make trouble for the poor shmuck who actually
managed to do in the Wizard. */
void
intervene()
{
+13 -21
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 worm.c $NHDT-Date: 1432512770 2015/05/25 00:12:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.16 $ */
/* NetHack 3.6 worm.c $NHDT-Date: 1446078769 2015/10/29 00:32:49 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -43,8 +43,7 @@ STATIC_DCL struct wseg *FDECL(create_worm_tail, (int));
* (the head). Note that the segment that wheads[wormno] points
* to, is not displayed. It is simply there to keep track of
* where the head came from, so that worm movement and display
*are
* simplified later.
* are simplified later.
* Keeping the head segment of the worm at the end of the list
* of tail segments is an endless source of confusion, but it is
* necessary.
@@ -95,7 +94,7 @@ get_wormno()
new_wormno++;
}
return (0); /* level infested with worms */
return 0; /* level infested with worms */
}
/*
@@ -672,24 +671,20 @@ register xchar *nx, *ny;
*nx = x;
*ny = y;
*nx += (x > 1 ? /* extreme left ? */
(x < COLNO ? /* extreme right ? */
(rn2(3) - 1) /* neither so +1, 0, or -1 */
*nx += (x > 1 /* extreme left ? */
? (x < COLNO /* extreme right ? */
? (rn2(3) - 1) /* neither so +1, 0, or -1 */
: -rn2(2)) /* 0, or -1 */
: rn2(2)); /* 0, or 1 */
*ny +=
(*nx == x ? /* same kind of thing with y */
(y > 1 ? (y < ROWNO ? (rn2(2) ? 1 : -1) : -1) : 1)
*ny += (*nx == x /* same kind of thing with y */
? (y > 1 ? (y < ROWNO ? (rn2(2) ? 1 : -1) : -1) : 1)
: (y > 1 ? (y < ROWNO ? (rn2(3) - 1) : -rn2(2)) : rn2(2)));
}
/* count_wsegs()
*
* returns
* the number of visible segments that a worm has.
* returns the number of visible segments that a worm has.
*/
int
count_wsegs(mtmp)
struct monst *mtmp;
@@ -708,9 +703,7 @@ struct monst *mtmp;
}
/* create_worm_tail()
*
* will create a worm tail chain of (num_segs + 1) and return a pointer to
* it.
* will create a worm tail chain of (num_segs + 1) and return pointer to it.
*/
STATIC_OVL
struct wseg *
@@ -737,11 +730,10 @@ int num_segs;
i++;
}
return (new_tail);
return new_tail;
}
/* worm_known()
*
* Is any segment of this worm in viewing range? Note: caller must check
* invisibility and telepathy (which should only show the head anyway).
* Mostly used in the canseemon() macro.
@@ -802,9 +794,9 @@ int x1, y1, x2, y2;
/* we don't know which of <x1,y2> or <x2,y1> we'll hit first, but
whichever it is, they're consecutive iff next seg is the other */
if (curr->wx == x1 && curr->wy == y2)
return (boolean)(wnxt->wx == x2 && wnxt->wy == y1);
return (boolean) (wnxt->wx == x2 && wnxt->wy == y1);
if (curr->wx == x2 && curr->wy == y1)
return (boolean)(wnxt->wx == x1 && wnxt->wy == y2);
return (boolean) (wnxt->wx == x1 && wnxt->wy == y2);
}
/* should never reach here... */
return FALSE;
+4 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 worn.c $NHDT-Date: 1445214551 2015/10/19 00:29:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.45 $ */
/* NetHack 3.6 worn.c $NHDT-Date: 1446078770 2015/10/29 00:32:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.46 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -658,7 +658,7 @@ long flag;
for (obj = mon->minvent; obj; obj = obj->nobj)
if (obj->owornmask & flag)
return obj;
return ((struct obj *) 0);
return (struct obj *) 0;
}
}
@@ -871,9 +871,9 @@ boolean polyspot;
}
}
if (handless_or_tiny || has_horns(mdat)) {
if ((otmp = which_armor(mon, W_ARMH)) != 0 &&
if ((otmp = which_armor(mon, W_ARMH)) != 0
/* flimsy test for horns matches polyself handling */
(handless_or_tiny || !is_flimsy(otmp))) {
&& (handless_or_tiny || !is_flimsy(otmp))) {
if (vis)
pline("%s helmet falls to the %s!", s_suffix(Monnam(mon)),
surface(mon->mx, mon->my));
+35 -37
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 write.c $NHDT-Date: 1442276267 2015/09/15 00:17:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */
/* NetHack 3.6 write.c $NHDT-Date: 1446078770 2015/10/29 00:32:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.16 $ */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
@@ -20,8 +20,7 @@ register struct obj *otmp;
switch (otmp->otyp) {
#ifdef MAIL
case SCR_MAIL:
return (2);
/* break; */
return 2;
#endif
case SCR_LIGHT:
case SCR_GOLD_DETECTION:
@@ -30,39 +29,32 @@ register struct obj *otmp;
case SCR_AMNESIA:
case SCR_FIRE:
case SCR_EARTH:
return (8);
/* break; */
return 8;
case SCR_DESTROY_ARMOR:
case SCR_CREATE_MONSTER:
case SCR_PUNISHMENT:
return (10);
/* break; */
return 10;
case SCR_CONFUSE_MONSTER:
return (12);
/* break; */
return 12;
case SCR_IDENTIFY:
return (14);
/* break; */
return 14;
case SCR_ENCHANT_ARMOR:
case SCR_REMOVE_CURSE:
case SCR_ENCHANT_WEAPON:
case SCR_CHARGING:
return (16);
/* break; */
return 16;
case SCR_SCARE_MONSTER:
case SCR_STINKING_CLOUD:
case SCR_TAMING:
case SCR_TELEPORTATION:
return (20);
/* break; */
return 20;
case SCR_GENOCIDE:
return (30);
/* break; */
return 30;
case SCR_BLANK_PAPER:
default:
impossible("You can't write such a weird scroll!");
}
return (1000);
return 1000;
}
/* decide whether the hero knowns a particular scroll's label;
@@ -97,6 +89,7 @@ struct obj *objlist;
static NEARDATA const char write_on[] = { SCROLL_CLASS, SPBOOK_CLASS, 0 };
/* write -- applying a magic marker */
int
dowrite(pen)
register struct obj *pen;
@@ -127,8 +120,11 @@ register struct obj *pen;
return 0;
/* can't write on a novel (unless/until it's been converted into a blank
spellbook), but we want messages saying so to avoid "spellbook" */
typeword = (paper->otyp == SPE_NOVEL) ? "book"
: (paper->oclass == SPBOOK_CLASS) ? "spellbook" : "scroll";
typeword = (paper->otyp == SPE_NOVEL)
? "book"
: (paper->oclass == SPBOOK_CLASS)
? "spellbook"
: "scroll";
if (Blind) {
if (!paper->dknown) {
You("don't know if that %s is blank or not.", typeword);
@@ -185,16 +181,18 @@ register struct obj *pen;
entry, so we don't simply use first match with it;
also, player might assign same name multiple times
and if so, we choose one of those matches randomly */
if (objects[i].oc_uname && !strcmpi(objects[i].oc_uname, nm) &&
/* first match: chance incremented to 1,
!rn2(1) is 1, we remember i;
second match: chance incremented to 2,
!rn2(2) has 1/2 chance to replace i;
third match: chance incremented to 3,
!rn2(3) has 1/3 chance to replace i
and 2/3 chance to keep previous 50:50
choice; so on for higher match counts */
!rn2(++deferralchance))
if (objects[i].oc_uname && !strcmpi(objects[i].oc_uname, nm)
/*
* First match: chance incremented to 1,
* !rn2(1) is 1, we remember i;
* second match: chance incremented to 2,
* !rn2(2) has 1/2 chance to replace i;
* third match: chance incremented to 3,
* !rn2(3) has 1/3 chance to replace i
* and 2/3 chance to keep previous 50:50
* choice; so on for higher match counts.
*/
&& !rn2(++deferralchance))
deferred = i;
}
/* writing by user-assigned name is same as by description:
@@ -238,7 +236,7 @@ found:
if (pen->spe < basecost / 2) {
Your("marker is too dry to write that!");
obfree(new_obj, (struct obj *) 0);
return (1);
return 1;
}
/* we're really going to write now, so calculate cost
@@ -259,7 +257,7 @@ found:
useup(paper);
}
obfree(new_obj, (struct obj *) 0);
return (1);
return 1;
}
pen->spe -= actualcost;
@@ -287,11 +285,11 @@ found:
*/
/* if known, then either by-name or by-descr works */
if (!objects[new_obj->otyp].oc_name_known &&
if (!objects[new_obj->otyp].oc_name_known
/* else if named, then only by-descr works */
!(by_descr && label_known(new_obj->otyp, invent)) &&
&& !(by_descr && label_known(new_obj->otyp, invent))
/* and Luck might override after both checks have failed */
rnl(Role_if(PM_WIZARD) ? 5 : 15)) {
&& rnl(Role_if(PM_WIZARD) ? 5 : 15)) {
You("%s to write that.", by_descr ? "fail" : "don't know how");
/* scrolls disappear, spellbooks don't */
if (paper->oclass == SPBOOK_CLASS) {
@@ -308,7 +306,7 @@ found:
useup(paper);
}
obfree(new_obj, (struct obj *) 0);
return (1);
return 1;
}
/* can write scrolls when blind, but requires luck too;
attempts to write books when blind are caught above */
@@ -342,7 +340,7 @@ found:
new_obj =
hold_another_object(new_obj, "Oops! %s out of your grasp!",
The(aobjnam(new_obj, "slip")), (const char *) 0);
return (1);
return 1;
}
/* most book descriptions refer to cover appearance, so we can issue a
+68 -68
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 zap.c $NHDT-Date: 1431998738 2015/05/19 01:25:38 $ $NHDT-Branch: master $:$NHDT-Revision: 1.223 $ */
/* NetHack 3.6 zap.c $NHDT-Date: 1446078771 2015/10/29 00:32:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.230 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -110,16 +110,14 @@ struct obj *obj;
so that casting a spell won't re-discover its forgotten book. */
if (obj->oclass != SPBOOK_CLASS) {
/* if type already discovered, treat this item has having been seen
even if the hero is currently blinded (skips redundant makeknown)
*/
even if hero is currently blinded (skips redundant makeknown) */
if (objects[obj->otyp].oc_name_known) {
obj->dknown = 1; /* will usually be set already */
/* otherwise discover it if this item itself has been or can be
* seen */
/* otherwise discover it if item itself has been or can be seen */
} else {
/* in case it was picked up while blind and then zapped without
examining inventory after regaining sight (bypassing xname())
*/
examining inventory after regaining sight (bypassing xname) */
if (!Blind)
obj->dknown = 1;
/* make the discovery iff we know what we're manipulating */
@@ -1002,13 +1000,14 @@ register struct obj *obj;
boolean u_ring;
/* Is this a charged/enchanted object? */
if (!obj || (!objects[obj->otyp].oc_charged && obj->oclass != WEAPON_CLASS
if (!obj
|| (!objects[obj->otyp].oc_charged && obj->oclass != WEAPON_CLASS
&& obj->oclass != ARMOR_CLASS && !is_weptool(obj))
|| obj->spe <= 0)
return (FALSE);
return FALSE;
if (defends(AD_DRLI, obj) || defends_when_carried(AD_DRLI, obj)
|| obj_resists(obj, 10, 90))
return (FALSE);
return FALSE;
/* Charge for the cost of the object */
costly_alteration(obj, COST_DRAIN);
@@ -1062,7 +1061,7 @@ register struct obj *obj;
}
if (carried(obj))
update_inventory();
return (TRUE);
return TRUE;
}
boolean
@@ -1070,7 +1069,8 @@ obj_resists(obj, ochance, achance)
struct obj *obj;
int ochance, achance; /* percent chance for ordinary objects, artifacts */
{
if (obj->otyp == AMULET_OF_YENDOR || obj->otyp == SPE_BOOK_OF_THE_DEAD
if (obj->otyp == AMULET_OF_YENDOR
|| obj->otyp == SPE_BOOK_OF_THE_DEAD
|| obj->otyp == CANDELABRUM_OF_INVOCATION
|| obj->otyp == BELL_OF_OPENING
|| (obj->otyp == CORPSE && is_rider(&mons[obj->corpsenm]))) {
@@ -1078,7 +1078,7 @@ int ochance, achance; /* percent chance for ordinary objects, artifacts */
} else {
int chance = rn2(100);
return ((boolean)(chance < (obj->oartifact ? achance : ochance)));
return (boolean) (chance < (obj->oartifact ? achance : ochance));
}
}
@@ -1104,7 +1104,7 @@ struct obj *obj;
if (obj->quan > 4L)
zap_odds /= 2;
return ((boolean)(!rn2(zap_odds)));
return (boolean) !rn2(zap_odds);
}
/* Use up at least minwt number of things made of material mat.
@@ -2054,6 +2054,7 @@ struct obj *otmp;
static NEARDATA const char zap_syms[] = { WAND_CLASS, 0 };
/* 'z' command (or 'y' if numbed_pad==-1) */
int
dozap()
{
@@ -2061,10 +2062,10 @@ dozap()
int damage;
if (check_capacity((char *) 0))
return (0);
return 0;
obj = getobj(zap_syms, "zap");
if (!obj)
return (0);
return 0;
check_unpaid(obj);
@@ -2074,7 +2075,7 @@ dozap()
else if (obj->cursed && !rn2(WAND_BACKFIRE_CHANCE)) {
backfire(obj); /* the wand blows up in your face! */
exercise(A_STR, FALSE);
return (1);
return 1;
} else if (!(objects[obj->otyp].oc_dir == NODIR) && !getdir((char *) 0)) {
if (!Blind)
pline("%s glows and fades.", The(xname(obj)));
@@ -2103,7 +2104,7 @@ dozap()
useup(obj);
}
update_inventory(); /* maybe used a charge */
return (1);
return 1;
}
int
@@ -2409,7 +2410,7 @@ boolean ordinary;
that the wand itself has been seen */
if (learn_it)
learnwand(obj);
return (damage);
return damage;
}
/* called when poly'd hero uses breath attack against self */
@@ -2938,7 +2939,7 @@ int skill;
const char *
exclam(force)
register int force;
int force;
{
/* force == 0 occurs e.g. with sleep ray */
/* note that large force is usual with wands so that !! would
@@ -2948,16 +2949,16 @@ register int force;
void
hit(str, mtmp, force)
register const char *str;
register struct monst *mtmp;
register const char *force; /* usually either "." or "!" */
const char *str;
struct monst *mtmp;
const char *force; /* usually either "." or "!" */
{
if ((!cansee(bhitpos.x, bhitpos.y) && !canspotmon(mtmp)
&& !(u.uswallow && mtmp == u.ustuck)) || !flags.verbose)
pline("%s %s it.", The(str), vtense(str, "hit"));
else
pline("%s %s %s%s", The(str), vtense(str, "hit"), mon_nam(mtmp),
force);
pline("%s %s %s%s", The(str), vtense(str, "hit"),
mon_nam(mtmp), force);
}
void
@@ -2990,8 +2991,7 @@ int range, *skipstart, *skipend;
* when an IMMEDIATE wand is zapped (ZAPPED_WAND)
* when a light beam is flashed (FLASHED_LIGHT)
* when a mirror is applied (INVIS_BEAM)
* A thrown/kicked object falls down at the end of its range or when a
*monster
* A thrown/kicked object falls down at end of its range or when a monster
* is hit. The variable 'bhitpos' is set to the final position of the weapon
* thrown/zapped. The ray of a wand may affect (by calling a provided
* function) several objects and monsters on its path. The return value
@@ -3058,7 +3058,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
if (is_pick(obj) && inside_shop(x, y)
&& (mtmp = shkcatch(obj, x, y))) {
tmp_at(DISP_END, 0);
return (mtmp);
return mtmp;
}
typ = levl[bhitpos.x][bhitpos.y].typ;
@@ -3323,7 +3323,7 @@ int dx, dy;
mtmp = m_at(bhitpos.x, bhitpos.y);
m_respond(mtmp);
tmp_at(DISP_END, 0);
return (mtmp);
return mtmp;
}
if (!ZAP_POS(levl[bhitpos.x][bhitpos.y].typ)
|| closed_door(bhitpos.x, bhitpos.y)) {
@@ -3341,7 +3341,7 @@ int dx, dy;
} else { /* we catch it */
tmp_at(DISP_END, 0);
You("skillfully catch the boomerang.");
return (&youmonst);
return &youmonst;
}
}
tmp_at(bhitpos.x, bhitpos.y);
@@ -3360,8 +3360,9 @@ int dx, dy;
return (struct monst *) 0;
}
/* used by buzz(); also used by munslime(muse.c) */
int zhitm(mon, type, nd, ootmp) /* returns damage to mon */
/* used by buzz(); also used by munslime(muse.c); returns damage to mon */
int
zhitm(mon, type, nd, ootmp)
register struct monst *mon;
register int type, nd;
struct obj **ootmp; /* to return worn armor for caller to disintegrate */
@@ -3519,7 +3520,7 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */
debugpline3("zapped monster hp = %d (= %d - %d)", mon->mhp - tmp,
mon->mhp, tmp);
mon->mhp -= tmp;
return (tmp);
return tmp;
}
STATIC_OVL void
@@ -3736,7 +3737,7 @@ int type; /* either hero cast spell type or 0 */
/* very high armor protection does not achieve invulnerability */
ac = AC_VALUE(ac);
return (3 - chance) < ac + spell_bonus;
return (3 - chance < ac + spell_bonus);
}
STATIC_OVL void
@@ -4023,14 +4024,14 @@ register int dx, dy;
explode(sx, sy, type, d(12, 6), 0, EXPL_FIERY);
get_out_buzz:
if (shopdamage)
pay_for_damage(
abstype == ZT_FIRE
pay_for_damage(abstype == ZT_FIRE
? "burn away"
: abstype == ZT_COLD
? "shatter"
:
/* "damage" indicates wall rather than door */
abstype == ZT_ACID ? "damage" : abstype == ZT_DEATH
: abstype == ZT_ACID
? "damage"
: abstype == ZT_DEATH
? "disintegrate"
: "destroy",
FALSE);
@@ -4426,7 +4427,9 @@ short exploding_wand_typ;
return rangemod;
}
void fracture_rock(obj) /* fractured by pick-axe or wand of striking */
/* fractured by pick-axe or wand of striking */
void
fracture_rock(obj)
register struct obj *obj; /* no texts here! */
{
xchar x, y;
@@ -4781,7 +4784,7 @@ int osym, dmgtyp;
m_useup(mtmp, obj);
}
}
return (tmp);
return tmp;
}
int
@@ -4842,7 +4845,7 @@ int damage, tell;
killed(mtmp);
}
}
return (resisted);
return resisted;
}
#define MAXWISHTRY 5
@@ -4851,37 +4854,32 @@ STATIC_OVL void
wishcmdassist(triesleft)
int triesleft;
{
static NEARDATA const char *wishinfo[] =
{
"Wish details:", "", "Enter the name of an object, such as "
"\"potion of monster detection\",",
"\"scroll labeled README\", \"elven mithril-coat\", or "
"\"Grimtooth\"",
"(without the quotes).", "", "For object types which come in "
"stacks, you may specify a plural "
"name",
"such as \"potions of healing\", or specify a count, such as "
"\"1000 gold",
static NEARDATA const char *
wishinfo[] = {
"Wish details:",
"",
"Enter the name of an object, such as \"potion of monster detection\",",
"\"scroll labeled README\", \"elven mithril-coat\", or \"Grimtooth\"",
"(without the quotes).",
"",
"For object types which come in stacks, you may specify a plural name",
"such as \"potions of healing\", or specify a count, such as \"1000 gold",
"pieces\", although that aspect of your wish might not be granted.",
"",
"You may also specify various prefix values which might be used to",
"modify the item, such as \"uncursed\" or \"rustproof\" or \"+1\".",
"Most modifiers shown when viewing your inventory can be "
"specified.",
"", "You may specify 'nothing' to explicitly decline this wish.", 0,
"Most modifiers shown when viewing your inventory can be specified.",
"",
"You may specify 'nothing' to explicitly decline this wish.",
0,
},
preserve_wishless[] = "Doing so will preserve "
"'wishless' conduct.",
retry_info[] = "If you specify an "
"unrecognized object name %s%s "
"time%s,",
retry_too[] =
"a randomly chosen item will be granted.",
preserve_wishless[] = "Doing so will preserve 'wishless' conduct.",
retry_info[] =
"If you specify an unrecognized object name %s%s time%s,",
retry_too[] = "a randomly chosen item will be granted.",
suppress_cmdassist[] =
"(Suppress this assistance with "
"!cmdassist in your config file.)",
*cardinals[] = { "zero", "one", "two",
"three", "four", "five" },
"(Suppress this assistance with !cmdassist in your config file.)",
*cardinals[] = { "zero", "one", "two", "three", "four", "five" },
too_many[] = "too many";
int i;
winid win;
@@ -4895,10 +4893,12 @@ int triesleft;
if (!u.uconduct.wishes)
putstr(win, 0, preserve_wishless);
putstr(win, 0, "");
Sprintf(buf, retry_info, (triesleft >= 0 && triesleft < SIZE(cardinals))
Sprintf(buf, retry_info,
(triesleft >= 0 && triesleft < SIZE(cardinals))
? cardinals[triesleft]
: too_many,
(triesleft < MAXWISHTRY) ? " more" : "", plur(triesleft));
(triesleft < MAXWISHTRY) ? " more" : "",
plur(triesleft));
putstr(win, 0, buf);
putstr(win, 0, retry_too);
putstr(win, 0, "");