-/* NetHack 3.6 makemon.c $NHDT-Date: 1433457069 2015/06/04 22:31:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.92 $ */
+/* NetHack 3.6 makemon.c $NHDT-Date: 1445556868 2015/10/22 23:34:28 $ $NHDT-Branch: master $:$NHDT-Revision: 1.99 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
return ((struct monst *) 0); /* no more monsters! */
}
fakemon.data = ptr; /* set up for goodpos */
- } while (++tryct <= 50 &&
+ } while (++tryct <= 50
/* in Sokoban, don't accept a giant on first try;
after that, boulder carriers are fair game */
- ((tryct == 1 && throws_rocks(ptr) && In_sokoban(&u.uz))
- || !goodpos(x, y, &fakemon, gpflags)));
+ && ((tryct == 1 && throws_rocks(ptr) && In_sokoban(&u.uz))
+ || !goodpos(x, y, &fakemon, gpflags)));
mndx = monsndx(ptr);
}
(void) propagate(mndx, countbirth, FALSE);
-/* NetHack 3.6 mhitm.c $NHDT-Date: 1432512766 2015/05/25 00:12:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.78 $ */
+/* NetHack 3.6 mhitm.c $NHDT-Date: 1445556871 2015/10/22 23:34:31 $ $NHDT-Branch: master $:$NHDT-Revision: 1.81 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
if (mdef == &youmonst)
dx = u.ux, dy = u.uy;
lev = &levl[dx][dy];
- if (IS_ROCK(lev->typ) || closed_door(dx, dy) || IS_TREE(lev->typ) ||
+ if (IS_ROCK(lev->typ) || closed_door(dx, dy) || IS_TREE(lev->typ)
/* not passes_bars(); engulfer isn't squeezing through */
- (lev->typ == IRONBARS && !is_whirly(magr->data)))
+ || (lev->typ == IRONBARS && !is_whirly(magr->data)))
return FALSE;
return TRUE;
-/* NetHack 3.6 mhitu.c $NHDT-Date: 1437877180 2015/07/26 02:19:40 $ $NHDT-Branch: master $:$NHDT-Revision: 1.128 $ */
+/* NetHack 3.6 mhitu.c $NHDT-Date: 1445556872 2015/10/22 23:34:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.129 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
}
}
-STATIC_OVL void missmu(mtmp, nearmiss, mattk) /* monster missed you */
-register struct monst *mtmp;
-register boolean nearmiss;
-register struct attack *mattk;
+/* monster missed you */
+STATIC_OVL void
+missmu(mtmp, nearmiss, mattk)
+struct monst *mtmp;
+boolean nearmiss;
+struct attack *mattk;
{
if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my);
if (could_seduce(mtmp, &youmonst, mattk) && !mtmp->mcan)
pline("%s pretends to be friendly.", Monnam(mtmp));
- else {
- if (!flags.verbose || !nearmiss)
- pline("%s misses.", Monnam(mtmp));
- else
- pline("%s just misses!", Monnam(mtmp));
- }
+ else
+ pline("%s %smisses!", Monnam(mtmp),
+ (nearmiss && flags.verbose) ? "just " : "");
+
stop_occupation();
}
-STATIC_OVL void mswings(mtmp, otemp) /* monster swings obj */
+/* monster swings obj */
+STATIC_OVL void
+mswings(mtmp, otemp)
struct monst *mtmp;
struct obj *otemp;
{
exercise(A_DEX, FALSE);
}
-STATIC_OVL void wildmiss(mtmp,
- mattk) /* monster attacked your displaced image */
+/* monster attacked your displaced image */
+STATIC_OVL void
+wildmiss(mtmp, mattk)
register struct monst *mtmp;
register struct attack *mattk;
{
return;
/* maybe it's attacking an image around the corner? */
- compat = (mattk->adtyp == AD_SEDU || mattk->adtyp == AD_SSEX)
- && could_seduce(mtmp, &youmonst, (struct attack *) 0);
+ compat = ((mattk->adtyp == AD_SEDU || mattk->adtyp == AD_SSEX)
+ && could_seduce(mtmp, &youmonst, (struct attack *) 0));
if (!mtmp->mcansee || (Invis && !perceives(mtmp->data))) {
const char *swings =
void
expels(mtmp, mdat, message)
-register struct monst *mtmp;
-register struct permonst
- *mdat; /* if mtmp is polymorphed, mdat != mtmp->data */
+struct monst *mtmp;
+struct permonst *mdat; /* if mtmp is polymorphed, mdat != mtmp->data */
boolean message;
{
if (message) {
if (!ranged)
nomul(0);
if (mtmp->mhp <= 0 || (Underwater && !is_swimmer(mtmp->data)))
- return (0);
+ return 0;
/* If swallowed, can only be affected by u.ustuck */
if (u.uswallow) {
if (mtmp != u.ustuck)
- return (0);
+ return 0;
u.ustuck->mux = u.ux;
u.ustuck->muy = u.uy;
range2 = 0;
foundyou = 1;
if (u.uinvulnerable)
- return (0); /* stomachs can't hurt you! */
+ return 0; /* stomachs can't hurt you! */
}
else if (u.usteed) {
if (mtmp == u.usteed)
/* Your steed won't attack you */
- return (0);
+ return 0;
/* Orcs like to steal and eat horses and the like */
if (!rn2(is_orc(mtmp->data) ? 2 : 4)
&& distu(mtmp->mx, mtmp->my) <= 2) {
/* Attack your steed instead */
i = mattackm(mtmp, u.usteed);
if ((i & MM_AGR_DIED))
- return (1);
+ return 1;
/* make sure steed is still alive and within range */
if ((i & MM_DEF_DIED) || !u.usteed
|| distu(mtmp->mx, mtmp->my) > 2)
- return (0);
+ return 0;
/* Let your steed retaliate */
- return (!!(mattackm(u.usteed, mtmp) & MM_DEF_DIED));
+ return !!(mattackm(u.usteed, mtmp) & MM_DEF_DIED);
}
}
is eligible for placing hero; we assume that a
removed monster remembers its old spot <mx,my> */
remove_monster(mtmp->mx, mtmp->my);
- if (!enexto(&cc, u.ux, u.uy, youmonst.data) ||
+ if (!enexto(&cc, u.ux, u.uy, youmonst.data)
/* a fish won't voluntarily swap positions
when it's in water and hero is over land */
- (mtmp->data->mlet == S_EEL && is_pool(mtmp->mx, mtmp->my)
- && !is_pool(u.ux, u.uy))) {
+ || (mtmp->data->mlet == S_EEL
+ && is_pool(mtmp->mx, mtmp->my)
+ && !is_pool(u.ux, u.uy))) {
/* couldn't find any spot for hero; this used to
kill off attacker, but now we just give a "miss"
message and keep both mtmp and hero at their
newsym(u.ux, u.uy);
if (youmonst.data->mlet != S_PIERCER)
- return (0); /* lurkers don't attack */
+ return 0; /* lurkers don't attack */
obj = which_armor(mtmp, WORN_HELMET);
if (obj && is_metallic(obj)) {
}
newsym(u.ux, u.uy);
}
- return (0);
+ return 0;
}
/* hero might be a mimic, concealed via #monster */
youmonst.m_ap_type = M_AP_NOTHING;
youmonst.mappearance = 0;
newsym(u.ux, u.uy);
- return (0);
+ return 0;
}
/* non-mimic hero might be mimicking an object after eating m corpse */
else
You_feel("%s move nearby.", something);
}
- return (0);
+ return 0;
}
/* Unlike defensive stuff, don't let them use item _and_ attack. */
break;
case AT_GAZE: /* can affect you either ranged or not */
- /* Medusa gaze already operated through m_respond in
- * dochug(); don't gaze more than once per round.
- */
+ /* Medusa gaze already operated through m_respond in
+ dochug(); don't gaze more than once per round. */
if (mdat != &mons[PM_MEDUSA])
sum[i] = gazemu(mtmp, mattk);
break;
if (youseeit)
pline("%s lunges forward and recoils!", Monnam(mtmp));
else
- You_hear("a %s nearby.", is_whirly(mtmp->data)
- ? "rushing noise"
- : "splat");
+ You_hear("a %s nearby.",
+ is_whirly(mtmp->data) ? "rushing noise"
+ : "splat");
}
}
break;
*/
if (mtmp->weapon_check == NEED_WEAPON || !MON_WEP(mtmp)) {
mtmp->weapon_check = NEED_HTH_WEAPON;
- /* mon_wield_item resets weapon_check as
- * appropriate */
+ /* mon_wield_item resets weapon_check as appropriate */
if (mon_wield_item(mtmp) != 0)
break;
}
break; /* attacker teleported, no more attacks */
/* sum[i] == 0: unsuccessful attack */
}
- return (0);
+ return 0;
}
STATIC_OVL boolean
long wearmask;
int armpro, mc = 0;
boolean is_you = (mon == &youmonst),
- gotprot = is_you ? (EProtection != 0L) :
+ gotprot = is_you ? (EProtection != 0L)
/* high priests have innate protection */
- (mon->data == &mons[PM_HIGH_PRIEST]);
+ : (mon->data == &mons[PM_HIGH_PRIEST]);
for (o = is_you ? invent : mon->minvent; o; o = o->nobj) {
/* a_can field is only applicable for armor (which must be worn) */
kformat = KILLED_BY;
}
make_stoned(5L, (char *) 0, kformat, kname);
- return (1);
+ return 1;
/* done_in_by(mtmp, STONING); */
}
}
return FALSE;
}
+/* monster swallows you, or damage if u.uswallow */
STATIC_OVL int
-gulpmu(mtmp, mattk) /* monster swallows you, or damage if u.uswallow */
+gulpmu(mtmp, mattk)
register struct monst *mtmp;
register struct attack *mattk;
{
return 0;
if ((t && ((t->ttyp == PIT) || (t->ttyp == SPIKED_PIT)))
&& sobj_at(BOULDER, u.ux, u.uy))
- return (0);
+ return 0;
if (Punished)
unplacebc(); /* ball&chain go away */
}
if (mtmp != u.ustuck)
- return (0);
+ return 0;
if (u.uswldtim > 0)
u.uswldtim -= 1;
pline("Obviously %s doesn't like your taste.", mon_nam(mtmp));
expels(mtmp, mtmp->data, FALSE);
}
- return (1);
+ return 1;
}
-STATIC_OVL int explmu(mtmp, mattk, ufound) /* monster explodes in your face */
+/* monster explodes in your face */
+STATIC_OVL int
+explmu(mtmp, mattk, ufound)
register struct monst *mtmp;
register struct attack *mattk;
boolean ufound;
boolean physical_damage = TRUE, kill_agr = TRUE;
if (mtmp->mcan)
- return (0);
+ return 0;
if (!ufound)
pline("%s explodes at a spot in %s!",
return (mtmp->mhp > 0) ? 0 : 2;
}
-int gazemu(mtmp, mattk) /* monster gazes at you */
+/* monster gazes at you */
+int
+gazemu(mtmp, mattk)
register struct monst *mtmp;
register struct attack *mattk;
{
: (!rn2(2) ? "a bit " : "somewhat "),
reactions[react]);
}
- return (0);
+ return 0;
}
-void mdamageu(mtmp, n) /* mtmp hits you for n points damage */
+/* mtmp hits you for n points damage */
+void
+mdamageu(mtmp, n)
register struct monst *mtmp;
register int n;
{
xchar genagr, gendef;
if (is_animal(magr->data))
- return (0);
+ return 0;
if (magr == &youmonst) {
pagr = youmonst.data;
agrinvis = (Invis != 0);
Sprintf(hairbuf, "let me run my fingers through your %s",
body_part(HAIR));
verbalize("Take off your %s; %s.", str,
- (obj == uarm) ? "let's get a little closer"
- : (obj == uarmc || obj == uarms)
- ? "it's in the way"
- : (obj == uarmf)
- ? "let me rub your feet"
- : (obj == uarmg)
- ? "they're too clumsy"
- : (obj == uarmu)
- ? "let me massage you"
- :
- /* obj == uarmh */
- hairbuf);
+ (obj == uarm)
+ ? "let's get a little closer"
+ : (obj == uarmc || obj == uarms)
+ ? "it's in the way"
+ : (obj == uarmf)
+ ? "let me rub your feet"
+ : (obj == uarmg)
+ ? "they're too clumsy"
+ : (obj == uarmu)
+ ? "let me massage you"
+ /* obj == uarmh */
+ : hairbuf);
}
remove_worn_item(obj, TRUE);
}
&& (wornitems & protector) != protector))) {
if (poly_when_stoned(mtmp->data)) {
mon_to_stone(mtmp);
- return (1);
+ return 1;
}
pline("%s turns to stone!", Monnam(mtmp));
stoned = 1;
(void) drain_item(otmp);
/* No message */
}
- return (1);
+ return 1;
default:
break;
}
mon->mhp = u.mh / 2;
u.mh -= mon->mhp;
context.botl = 1;
- return (mon);
+ return mon;
}
/*mhitu.c*/
-/* NetHack 3.6 mon.c $NHDT-Date: 1445215021 2015/10/19 00:37:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.190 $ */
+/* NetHack 3.6 mon.c $NHDT-Date: 1445556873 2015/10/22 23:34:33 $ $NHDT-Branch: master $:$NHDT-Revision: 1.192 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
dryup(mtmp->mx, mtmp->my, FALSE);
if (inpool)
water_damage_chain(mtmp->minvent, FALSE);
- return (0);
+ return 0;
} else if (mtmp->data == &mons[PM_IRON_GOLEM] && inpool && !rn2(5)) {
int dam = d(2, 6);
/* Nymphs take everything. Most monsters don't pick up corpses. */
if (!str ? searches_for_item(mtmp, otmp)
: !!(index(str, otmp->oclass))) {
- if (otmp->otyp == CORPSE && mtmp->data->mlet != S_NYMPH &&
+ if (otmp->otyp == CORPSE && mtmp->data->mlet != S_NYMPH
/* let a handful of corpse types thru to can_carry() */
- !touch_petrifies(&mons[otmp->corpsenm])
+ && !touch_petrifies(&mons[otmp->corpsenm])
&& otmp->corpsenm != PM_LIZARD
&& !acidic(&mons[otmp->corpsenm]))
continue;
}
/* for restricting monsters' object-pickup.
- *
+ *
* to support the new pet behavior, this now returns the max # of objects
* that a given monster could pick up from a pile. frequently this will be
* otmp->quan, but special cases for 'only one' now exist so.
|| (IS_DOOR(nowtyp) && (levl[x][y].doormask & ~D_BROKEN))
|| (IS_DOOR(ntyp) && (levl[nx][ny].doormask & ~D_BROKEN))
|| ((IS_DOOR(nowtyp) || IS_DOOR(ntyp))
- && Is_rogue_level(&u.uz)) ||
+ && Is_rogue_level(&u.uz))
/* mustn't pass between adjacent long worm segments,
but can attack that way */
- (m_at(x, ny) && m_at(nx, y) && worm_cross(x, y, nx, ny)
- && !m_at(nx, ny) && (nx != u.ux || ny != u.uy))))
+ || (m_at(x, ny) && m_at(nx, y) && worm_cross(x, y, nx, ny)
+ && !m_at(nx, ny) && (nx != u.ux || ny != u.uy))))
continue;
if ((is_pool(nx, ny) == wantpool || poolok)
&& (lavaok || !is_lava(nx, ny))) {
Sprintf(killer.name, "%s explosion", s_suffix(mdat->mname));
killer.format = KILLED_BY_AN;
explode(mon->mx, mon->my, -1, tmp, MON_EXPLODE, EXPL_NOXIOUS);
- return (FALSE);
+ return FALSE;
}
}
otmp = mkobj(RANDOM_CLASS, TRUE);
/* don't create large objects from small monsters */
otyp = otmp->otyp;
- if (mdat->msize < MZ_HUMAN && otyp != FIGURINE &&
+ if (mdat->msize < MZ_HUMAN && otyp != FIGURINE
/* oc_big is also oc_bimanual and oc_bulky */
- (otmp->owt > 30 || objects[otyp].oc_big)) {
+ && (otmp->owt > 30 || objects[otyp].oc_big)) {
delobj(otmp);
} else if (!flooreffects(otmp, x, y, (dest & 1) ? "fall" : "")) {
place_object(otmp, x, y);
do {
if (!enexto(&mm, u.ux, u.uy, ptr))
return;
- if (couldsee(mm.x, mm.y) &&
+ if (couldsee(mm.x, mm.y)
/* don't move grid bugs diagonally */
- (diagok || mm.x == mtmp->mx || mm.y == mtmp->my)) {
+ && (diagok || mm.x == mtmp->mx || mm.y == mtmp->my)) {
rloc_to(mtmp, mm.x, mm.y);
return;
}
seemimic(mtmp)
register struct monst *mtmp;
{
- boolean is_blocker_appear = is_door_mappear(mtmp) ||
- is_obj_mappear(mtmp, BOULDER);
+ boolean is_blocker_appear = (is_door_mappear(mtmp)
+ || is_obj_mappear(mtmp, BOULDER));
if (has_mcorpsenm(mtmp))
freemcorpsenm(mtmp);
/* basic vampires can't become wolves; any can become fog or bat
(we don't enforce upper-case only for rogue level here) */
if (*mndx_p == PM_WOLF)
- return (mon->cham != PM_VAMPIRE);
+ return (boolean) (mon->cham != PM_VAMPIRE);
if (*mndx_p == PM_FOG_CLOUD || *mndx_p == PM_VAMPIRE_BAT)
return TRUE;
*mndx_p = NON_PM;
break;
}
- return (*mndx_p != NON_PM);
+ return (boolean) (*mndx_p != NON_PM);
}
int
-/* NetHack 3.6 mondata.c $NHDT-Date: 1437877181 2015/07/26 02:19:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.55 $ */
+/* NetHack 3.6 mondata.c $NHDT-Date: 1445556874 2015/10/22 23:34:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.57 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
struct obj *o;
if (is_you ? (Blind || Unaware)
- : (mon->mblinded || !mon->mcansee || !haseyes(ptr) ||
+ : (mon->mblinded || !mon->mcansee || !haseyes(ptr)
/* BUG: temporary sleep sets mfrozen, but since
paralysis does too, we can't check it */
- mon->msleeping))
+ || mon->msleeping))
return TRUE;
/* yellow light, Archon; !dust vortex, !cobra, !raven */
if (dmgtype_fromattack(ptr, AD_BLND, AT_EXPL)
register int i, atyp;
long atk_mask = (1L << AT_BREA) | (1L << AT_SPIT) | (1L << AT_GAZE);
- /* was: (attacktype(ptr, AT_BREA) || attacktype(ptr, AT_WEAP) ||
- attacktype(ptr, AT_SPIT) || attacktype(ptr, AT_GAZE) ||
- attacktype(ptr, AT_MAGC));
- but that's too slow -dlc
+ /* was: (attacktype(ptr, AT_BREA) || attacktype(ptr, AT_WEAP)
+ * || attacktype(ptr, AT_SPIT) || attacktype(ptr, AT_GAZE)
+ * || attacktype(ptr, AT_MAGC));
+ * but that's too slow -dlc
*/
for (i = 0; i < NATTK; i++) {
atyp = ptr->mattk[i].aatyp;
-/* NetHack 3.6 monmove.c $NHDT-Date: 1431563244 2015/05/14 00:27:24 $ $NHDT-Branch: master $:$NHDT-Revision: 1.70 $ */
+/* NetHack 3.6 monmove.c $NHDT-Date: 1445556875 2015/10/22 23:34:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.76 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
if (mtmp->mhp <= 0) {
mondied(mtmp);
if (mtmp->mhp > 0) /* lifesaved */
- return (FALSE);
+ return FALSE;
else
- return (TRUE);
+ return TRUE;
}
- return (FALSE);
+ return FALSE;
}
/* check whether a monster is carrying a locking/unlocking tool */
/* a similar check is in monster_nearby() in hack.c */
/* check whether hero notices monster and stops current activity */
if (occupation && !rd && !Confusion && (!mtmp->mpeaceful || Hallucination)
- &&
/* it's close enough to be a threat */
- distu(mtmp->mx, mtmp->my) <= (BOLT_LIM + 1) * (BOLT_LIM + 1) &&
+ && distu(mtmp->mx, mtmp->my) <= (BOLT_LIM + 1) * (BOLT_LIM + 1)
/* and either couldn't see it before, or it was too far away */
- (!already_saw_mon || !couldsee(x, y)
- || distu(x, y) > (BOLT_LIM + 1) * (BOLT_LIM + 1)) &&
+ && (!already_saw_mon || !couldsee(x, y)
+ || distu(x, y) > (BOLT_LIM + 1) * (BOLT_LIM + 1))
/* can see it now, or sense it and would normally see it */
- (canseemon(mtmp) || (sensemon(mtmp) && couldsee(mtmp->mx, mtmp->my)))
+ && (canseemon(mtmp)
+ || (sensemon(mtmp) && couldsee(mtmp->mx, mtmp->my)))
&& mtmp->mcanmove && !noattacks(mtmp->data)
&& !onscary(u.ux, u.uy, mtmp))
stop_occupation();
- return (rd);
+ return rd;
}
boolean
* Rodney, lawful minions, angels, the Riders */
if (mtmp->iswiz || is_lminion(mtmp) || mtmp->data == &mons[PM_ANGEL]
|| is_rider(mtmp->data))
- return (FALSE);
+ return FALSE;
/* should this still be true for defiled/molochian altars? */
- if (IS_ALTAR(levl[x][y].typ) && (mtmp->data->mlet == S_VAMPIRE
- || is_vampshifter(mtmp)))
- return(TRUE);
+ if (IS_ALTAR(levl[x][y].typ)
+ && (mtmp->data->mlet == S_VAMPIRE || is_vampshifter(mtmp)))
+ return TRUE;
/* the scare monster scroll doesn't have any of the below
* restrictions, being its own source of power */
- if (sobj_at(SCR_SCARE_MONSTER, x, y)) return(TRUE);
+ if (sobj_at(SCR_SCARE_MONSTER, x, y))
+ return TRUE;
/* creatures who don't (or can't) fear a written Elbereth:
* all the above plus shopkeepers, guards, blind or
*
* Elbereth doesn't work in Gehennom, the Elemental Planes, or the
* Astral Plane; the influence of the Valar only reaches so far. */
- return (epresent
- && ((u.ux == x && u.uy == y)
- || (Displaced && mtmp->mux == x && mtmp->muy == y))
- && !(mtmp->isshk || mtmp->isgd || !mtmp->mcansee
- || mtmp->mpeaceful || mtmp->data->mlet == S_HUMAN
- || mtmp->data == &mons[PM_MINOTAUR]
- || Inhell || In_endgame(&u.uz)));
-
+ return (epresent
+ && ((u.ux == x && u.uy == y)
+ || (Displaced && mtmp->mux == x && mtmp->muy == y))
+ && !(mtmp->isshk || mtmp->isgd || !mtmp->mcansee
+ || mtmp->mpeaceful || mtmp->data->mlet == S_HUMAN
+ || mtmp->data == &mons[PM_MINOTAUR]
+ || Inhell || In_endgame(&u.uz)));
}
&& (!(mtmp->data->mlet == S_NYMPH
|| mtmp->data == &mons[PM_JABBERWOCK]
#if 0 /* DEFERRED */
- || mtmp->data == &mons[PM_VORPAL_JABBERWOCK]
+ || mtmp->data == &mons[PM_VORPAL_JABBERWOCK]
#endif
|| mtmp->data->mlet == S_LEPRECHAUN) || !rn2(50))
&& (Aggravate_monster
|| (!rn2(7) && mtmp->m_ap_type != M_AP_FURNITURE
&& mtmp->m_ap_type != M_AP_OBJECT))) {
mtmp->msleeping = 0;
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
/* ungrab/expel held/swallowed hero */
if (mtmp->mcanmove && (mtmp->mstrategy & STRAT_CLOSE)
&& !mtmp->msleeping && monnear(mtmp, u.ux, u.uy))
quest_talk(mtmp); /* give the leaders a chance to speak */
- return (0); /* other frozen monsters can't do anything */
+ return 0; /* other frozen monsters can't do anything */
}
/* there is a chance we will wake it */
if (mtmp->msleeping && !disturb(mtmp)) {
if (Hallucination)
newsym(mtmp->mx, mtmp->my);
- return (0);
+ return 0;
}
/* not frozen or sleeping: wipe out texts written in the dust */
if (mtmp->mflee && !rn2(40) && can_teleport(mdat) && !mtmp->iswiz
&& !level.flags.noteleport) {
(void) rloc(mtmp, TRUE);
- return (0);
+ return 0;
}
if (mdat->msound == MS_SHRIEK && !um_dist(mtmp->mx, mtmp->my, 1))
m_respond(mtmp);
if (mdat == &mons[PM_MEDUSA] && couldsee(mtmp->mx, mtmp->my))
m_respond(mtmp);
if (mtmp->mhp <= 0)
- return (1); /* m_respond gaze can kill medusa */
+ return 1; /* m_respond gaze can kill medusa */
/* fleeing monsters might regain courage */
if (mtmp->mflee && !mtmp->mfleetim && mtmp->mhp == mtmp->mhpmax
/* since no way is an image going to pay it off */
}
} else if (demon_talk(mtmp))
- return (1); /* you paid it off */
+ return 1; /* you paid it off */
}
/* the watch will look around and see if you are up to no good :-) */
&& !(mtmp->mtrapped && !nearby && select_rwep(mtmp))) {
mtmp->weapon_check = NEED_HTH_WEAPON;
if (mon_wield_item(mtmp) != 0)
- return (0);
+ return 0;
}
}
case 1: /* monster moved */
/* Maybe it stepped on a trap and fell asleep... */
if (mtmp->msleeping || !mtmp->mcanmove)
- return (0);
+ return 0;
/* Monsters can move and then shoot on same turn;
our hero can't. Is that fair? */
if (!nearby && (ranged_attk(mdat) || find_offensive(mtmp)))
if (distu(mtmp->mx, mtmp->my) > 2)
unstuck(mtmp);
}
- return (0);
+ return 0;
case 2: /* monster died */
- return (1);
+ return 1;
}
}
if (!mtmp->mpeaceful || (Conflict && !resist(mtmp, RING_CLASS, 0, 0))) {
if (inrange && !noattacks(mdat) && u.uhp > 0 && !scared && tmp != 3)
if (mattacku(mtmp))
- return (1); /* monster died (e.g. exploded) */
+ return 1; /* monster died (e.g. exploded) */
if (mtmp->wormno)
wormhitu(mtmp);
{
if (sticks(youmonst.data) && mtmp == u.ustuck && !u.uswallow) {
pline("%s cannot escape from you!", Monnam(mtmp));
- return (TRUE);
+ return TRUE;
}
- return (FALSE);
+ return FALSE;
}
/*
int i = mintrap(mtmp);
if (i >= 2) {
newsym(mtmp->mx, mtmp->my);
- return (2);
+ return 2;
} /* it died */
if (i == 1)
- return (0); /* still in trap, so didn't move */
+ return 0; /* still in trap, so didn't move */
}
ptr = mtmp->data; /* mintrap() can change mtmp->data -dlc */
if (mtmp->isshk) {
mmoved = shk_move(mtmp);
if (mmoved == -2)
- return (2);
+ return 2;
if (mmoved >= 0)
goto postmov;
mmoved = 0; /* follow player outside shop */
if (mtmp->isgd) {
mmoved = gd_move(mtmp);
if (mmoved == -2)
- return (2);
+ return 2;
if (mmoved >= 0)
goto postmov;
mmoved = 0;
&& (intruder != mtmp)) {
notonhead = (intruder->mx != tx || intruder->my != ty);
if (mattackm(mtmp, intruder) == 2)
- return (2);
+ return 2;
mmoved = 1;
} else
mmoved = 0;
if (mtmp->ispriest) {
mmoved = pri_move(mtmp);
if (mmoved == -2)
- return (2);
+ return 2;
if (mmoved >= 0)
goto postmov;
mmoved = 0;
if (!Deaf && canseemon(mtmp))
verbalize("I'm late!");
mongone(mtmp);
- return (2);
+ return 2;
}
#endif
}
not_special:
if (u.uswallow && !mtmp->mflee && u.ustuck != mtmp)
- return (1);
+ return 1;
omx = mtmp->mx;
omy = mtmp->my;
gx = mtmp->mux;
&& touch_petrifies(&mons[otmp->corpsenm]))))
&& touch_artifact(otmp, mtmp)) {
if (can_carry(mtmp, otmp) > 0
- && (throws_rocks(ptr)
- || !sobj_at(BOULDER, xx, yy))
+ && (throws_rocks(ptr) || !sobj_at(BOULDER, xx, yy))
&& (!is_unicorn(ptr)
- || objects[otmp->otyp].oc_material
- == GEMSTONE) &&
+ || objects[otmp->otyp].oc_material == GEMSTONE)
/* Don't get stuck circling an Elbereth */
- !(onscary(xx, yy, mtmp))) {
+ && !(onscary(xx, yy, mtmp))) {
minr = distmin(omx, omy, xx, yy);
oomx = min(COLNO - 1, omx + minr);
oomy = min(ROWNO - 1, omy + minr);
register int j;
if (mmoved == 1 && (u.ux != nix || u.uy != niy) && itsstuck(mtmp))
- return (3);
+ return 3;
if (mmoved == 1 && can_tunnel && needspick(ptr)
&& ((IS_ROCK(levl[nix][niy].typ) && may_dig(nix, niy))
mtmp->weapon_check = NEED_PICK_AXE;
}
if (mtmp->weapon_check >= NEED_PICK_AXE && mon_wield_item(mtmp))
- return (3);
+ return 3;
}
/* If ALLOW_U is set, either it's trying to attack you, or it
* thinks it is. In either case, attack this spot in preference to
if (nix == u.ux && niy == u.uy) {
mtmp->mux = u.ux;
mtmp->muy = u.uy;
- return (0);
+ return 0;
}
/* The monster may attack another based on 1 of 2 conditions:
* 1 - It may be confused.
} else {
if (is_unicorn(ptr) && rn2(2) && !tele_restrict(mtmp)) {
(void) rloc(mtmp, TRUE);
- return (1);
+ return 1;
}
if (mtmp->wormno)
worm_nomove(mtmp);
if (mintrap(mtmp) >= 2) {
if (mtmp->mx)
newsym(mtmp->mx, mtmp->my);
- return (2); /* it died */
+ return 2; /* it died */
}
ptr = mtmp->data;
newsym(mtmp->mx, mtmp->my);
unblock_point(mtmp->mx, mtmp->my); /* vision */
if (mb_trapped(mtmp))
- return (2);
+ return 2;
} else {
if (flags.verbose) {
if (observeit)
newsym(mtmp->mx, mtmp->my);
unblock_point(mtmp->mx, mtmp->my); /* vision */
if (mb_trapped(mtmp))
- return (2);
+ return 2;
} else {
if (flags.verbose) {
if (observeit)
newsym(mtmp->mx, mtmp->my);
unblock_point(mtmp->mx, mtmp->my); /* vision */
if (mb_trapped(mtmp))
- return (2);
+ return 2;
} else {
if (flags.verbose) {
if (observeit)
if (canseemon(mtmp))
pline("%s eats through the iron bars.", Monnam(mtmp));
dissolve_bars(mtmp->mx, mtmp->my);
- return (3);
+ return 3;
} else if (flags.verbose && canseemon(mtmp))
Norep("%s %s %s the iron bars.", Monnam(mtmp),
/* pluralization fakes verb conjugation */
/* possibly dig */
if (can_tunnel && mdig_tunnel(mtmp))
- return (2); /* mon died (position already updated) */
+ return 2; /* mon died (position already updated) */
/* set also in domove(), hack.c */
if (u.uswallow && mtmp == u.ustuck
after_shk_move(mtmp);
}
}
- return (mmoved);
+ return mmoved;
}
void
closed_door(x, y)
register int x, y;
{
- return ((boolean)(IS_DOOR(levl[x][y].typ)
- && (levl[x][y].doormask & (D_LOCKED | D_CLOSED))));
+ return (boolean) (IS_DOOR(levl[x][y].typ)
+ && (levl[x][y].doormask & (D_LOCKED | D_CLOSED)));
}
boolean
if (levtyp == DRAWBRIDGE_UP)
levtyp = db_under_typ(levl[x][y].drawbridgemask);
- return (boolean)(ACCESSIBLE(levtyp) && !closed_door(x, y));
+ return (boolean) (ACCESSIBLE(levtyp) && !closed_door(x, y));
}
/* decide where the monster thinks you are standing */
if (!disp)
goto found_you;
- /* without something like the following, invis. and displ.
+ /* without something like the following, invisibility and displacement
are too powerful */
gotu = notseen ? !rn2(3) : Displaced ? !rn2(4) : FALSE;
-#if 0 /* this never worked as intended & isn't needed anyway */
- /* If invis but not displaced, staying around gets you 'discovered' */
- gotu |= (!Displaced && u.dx == 0 && u.dy == 0);
-#endif
-
if (!gotu) {
register int try_cnt = 0;
do {
-/* NetHack 3.6 monst.c $NHDT-Date: 1432512763 2015/05/25 00:12:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.51 $ */
+/* NetHack 3.6 monst.c $NHDT-Date: 1445556875 2015/10/22 23:34:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.53 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, HI_ZAP),
#if 0 /* not yet implemented */
MON("beholder", S_EYE,
- LVL(6, 3, 4, 0, -10), (G_GENO|2),
+ LVL(6, 3, 4, 0, -10), (G_GENO | 2),
A(ATTK(AT_GAZE, AD_SLOW, 0, 0), ATTK(AT_GAZE, AD_SLEE, 2,25),
ATTK(AT_GAZE, AD_DISN, 0, 0), ATTK(AT_GAZE, AD_STON, 0, 0),
ATTK(AT_GAZE, AD_CNCL, 2, 4), ATTK(AT_BITE, AD_PHYS, 2, 4)),
SIZ(10, 10, MS_SILENT, MZ_SMALL), MR_COLD, 0,
- M1_FLY|M1_BREATHLESS|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS,
- M2_NOPOLY|M2_HOSTILE|M2_NEUTER, M3_INFRAVISIBLE, CLR_BROWN),
+ M1_FLY | M1_BREATHLESS | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS,
+ M2_NOPOLY | M2_HOSTILE | M2_NEUTER, M3_INFRAVISIBLE, CLR_BROWN),
#endif
/*
* felines
A(ATTK(AT_BITE, AD_PHYS, 2, 6),
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(1500, 500, MS_ROAR, MZ_HUGE), 0, 0,
- M1_FLY|M1_THICK_HIDE|M1_NOHANDS|M1_CARNIVORE,
- M2_HOSTILE|M2_STRONG|M2_GREEDY|M2_JEWELS, 0, CLR_CYAN),
+ M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_CARNIVORE,
+ M2_HOSTILE | M2_STRONG | M2_GREEDY | M2_JEWELS, 0, CLR_CYAN),
#endif
MON("baby red dragon", S_DRAGON, LVL(12, 9, 2, 10, 0), G_GENO,
A(ATTK(AT_BITE, AD_PHYS, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
0, DRAGON_SILVER),
#if 0 /* DEFERRED */
MON("shimmering dragon", S_DRAGON,
- LVL(15, 9, -1, 20, 4), (G_GENO|1),
+ LVL(15, 9, -1, 20, 4), (G_GENO | 1),
A(ATTK(AT_BREA, AD_MAGM, 4, 6), ATTK(AT_BITE, AD_PHYS, 3, 8),
ATTK(AT_CLAW, AD_PHYS, 1, 4), ATTK(AT_CLAW, AD_PHYS, 1, 4),
NO_ATTK, NO_ATTK),
SIZ(WT_DRAGON, 1500, MS_ROAR, MZ_GIGANTIC), 0, 0,
- M1_FLY|M1_THICK_HIDE|M1_NOHANDS|M1_SEE_INVIS|M1_OVIPAROUS|
- M1_CARNIVORE,
- M2_HOSTILE|M2_STRONG|M2_NASTY|M2_GREEDY|M2_JEWELS|M2_MAGIC,
+ M1_FLY | M1_THICK_HIDE | M1_NOHANDS | M1_SEE_INVIS | M1_OVIPAROUS
+ | M1_CARNIVORE,
+ M2_HOSTILE | M2_STRONG | M2_NASTY | M2_GREEDY | M2_JEWELS | M2_MAGIC,
0, CLR_CYAN),
#endif
MON("red dragon", S_DRAGON, LVL(15, 9, -1, 20, -4), (G_GENO | 1),
CLR_ORANGE),
#if 0 /* DEFERRED */
MON("vorpal jabberwock", S_JABBERWOCK,
- LVL(20, 12, -2, 50, 0), (G_GENO|1),
+ LVL(20, 12, -2, 50, 0), (G_GENO | 1),
A(ATTK(AT_BITE, AD_PHYS, 3, 10), ATTK(AT_BITE, AD_PHYS, 3, 10),
ATTK(AT_CLAW, AD_PHYS, 3, 10), ATTK(AT_CLAW, AD_PHYS, 3, 10),
NO_ATTK, NO_ATTK),
SIZ(1300, 600, MS_BURBLE, MZ_LARGE), 0, 0,
- M1_ANIMAL|M1_FLY|M1_CARNIVORE,
- M2_HOSTILE|M2_STRONG|M2_NASTY|M2_COLLECT, M3_INFRAVISIBLE, HI_LORD),
+ M1_ANIMAL | M1_FLY | M1_CARNIVORE,
+ M2_HOSTILE | M2_STRONG | M2_NASTY | M2_COLLECT, M3_INFRAVISIBLE,
+ HI_LORD),
#endif
/*
* Kops
M3_INFRAVISIBLE, CLR_BLUE),
#if 0 /* DEFERRED */
MON("vampire mage", S_VAMPIRE,
- LVL(20, 14, -4, 50, -9), (G_GENO|G_NOCORPSE|1),
+ LVL(20, 14, -4, 50, -9), (G_GENO | G_NOCORPSE | 1),
A(ATTK(AT_CLAW, AD_DRLI, 2, 8), ATTK(AT_BITE, AD_DRLI, 1, 8),
ATTK(AT_MAGC, AD_SPEL, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK),
- SIZ(WT_HUMAN, 400, MS_VAMPIRE, MZ_HUMAN), MR_SLEEP|MR_POISON, 0,
- M1_FLY|M1_BREATHLESS|M1_HUMANOID|M1_POIS|M1_REGEN,
- M2_UNDEAD|M2_STALK|M2_HOSTILE|M2_STRONG|M2_NASTY|M2_LORD|M2_MALE|
- M2_MAGIC|M2_SHAPESHIFTER, M3_INFRAVISIBLE, HI_ZAP),
+ SIZ(WT_HUMAN, 400, MS_VAMPIRE, MZ_HUMAN), MR_SLEEP | MR_POISON, 0,
+ M1_FLY | M1_BREATHLESS | M1_HUMANOID | M1_POIS | M1_REGEN,
+ M2_UNDEAD | M2_STALK | M2_HOSTILE | M2_STRONG | M2_NASTY | M2_LORD
+ | M2_MALE | M2_MAGIC | M2_SHAPESHIFTER,
+ M3_INFRAVISIBLE, HI_ZAP),
#endif
MON("Vlad the Impaler", S_VAMPIRE, LVL(14, 18, -3, 80, -10),
(G_NOGEN | G_NOCORPSE | G_UNIQ),
/* Two for elves - one of each sex.
*/
MON("Earendil", S_HUMAN,
- LVL(20, 12, 0, 50, -20), (G_NOGEN|G_UNIQ),
+ LVL(20, 12, 0, 50, -20), (G_NOGEN | G_UNIQ),
A(ATTK(AT_WEAP, AD_PHYS, 1, 8),
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(WT_ELF, 350, MS_LEADER, MZ_HUMAN), MR_SLEEP, MR_SLEEP,
- M1_HUMANOID|M1_SEE_INVIS|M1_OMNIVORE,
- M2_NOPOLY|M2_ELF|M2_HUMAN|M2_PNAME|M2_PEACEFUL|M2_STRONG|
- M2_MALE|M2_COLLECT|M2_MAGIC,
- M3_CLOSE|M3_INFRAVISION|M3_INFRAVISIBLE, HI_LORD),
+ M1_HUMANOID | M1_SEE_INVIS | M1_OMNIVORE,
+ M2_NOPOLY | M2_ELF | M2_HUMAN | M2_PNAME | M2_PEACEFUL | M2_STRONG
+ | M2_MALE | M2_COLLECT | M2_MAGIC,
+ M3_CLOSE | M3_INFRAVISION | M3_INFRAVISIBLE, HI_LORD),
MON("Elwing", S_HUMAN,
- LVL(20, 12, 0, 50, -20), (G_NOGEN|G_UNIQ),
+ LVL(20, 12, 0, 50, -20), (G_NOGEN | G_UNIQ),
A(ATTK(AT_WEAP, AD_PHYS, 1, 8),
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(WT_ELF, 350, MS_LEADER, MZ_HUMAN), MR_SLEEP, MR_SLEEP,
- M1_HUMANOID|M1_SEE_INVIS|M1_OMNIVORE,
- M2_NOPOLY|M2_ELF|M2_HUMAN|M2_PNAME|M2_PEACEFUL|M2_STRONG|
- M2_FEMALE|M2_COLLECT|M2_MAGIC,
- M3_CLOSE|M3_INFRAVISION|M3_INFRAVISIBLE, HI_LORD),
+ M1_HUMANOID | M1_SEE_INVIS | M1_OMNIVORE,
+ M2_NOPOLY | M2_ELF | M2_HUMAN | M2_PNAME | M2_PEACEFUL | M2_STRONG
+ | M2_FEMALE | M2_COLLECT | M2_MAGIC,
+ M3_CLOSE | M3_INFRAVISION | M3_INFRAVISIBLE, HI_LORD),
#endif
MON("Hippocrates", S_HUMAN, LVL(20, 12, 0, 40, 0), (G_NOGEN | G_UNIQ),
A(ATTK(AT_WEAP, AD_PHYS, 1, 6), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISIBLE, HI_LORD),
#if 0 /* OBSOLETE */
MON("Goblin King", S_ORC,
- LVL(15, 12, 10, 0, -15), (G_NOGEN|G_UNIQ),
+ LVL(15, 12, 10, 0, -15), (G_NOGEN | G_UNIQ),
A(ATTK(AT_WEAP, AD_PHYS, 2, 6), ATTK(AT_WEAP, AD_PHYS, 2, 6),
ATTK(AT_CLAW, AD_SAMU, 1, 6), NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(750, 350, MS_NEMESIS, MZ_HUMAN), 0, 0,
- M1_HUMANOID|M1_OMNIVORE,
- M2_NOPOLY|M2_ORC|M2_HOSTILE|M2_STRONG|M2_STALK|M2_NASTY|M2_MALE|
- M2_GREEDY|M2_JEWELS|M2_COLLECT|M2_MAGIC,
- M3_WANTSARTI|M3_WAITFORU|M3_INFRAVISION|M3_INFRAVISIBLE, HI_LORD),
+ M1_HUMANOID | M1_OMNIVORE,
+ M2_NOPOLY | M2_ORC | M2_HOSTILE | M2_STRONG | M2_STALK | M2_NASTY
+ | M2_MALE | M2_GREEDY | M2_JEWELS | M2_COLLECT | M2_MAGIC,
+ M3_WANTSARTI | M3_WAITFORU | M3_INFRAVISION | M3_INFRAVISIBLE,
+ HI_LORD),
#endif
MON("Cyclops", S_GIANT, LVL(18, 12, 0, 0, -15), (G_NOGEN | G_UNIQ),
A(ATTK(AT_WEAP, AD_PHYS, 4, 8), ATTK(AT_WEAP, AD_PHYS, 4, 8),
A(ATTK(AT_WEAP, AD_PHYS, 2, 4), ATTK(AT_MAGC, AD_CLRC, 0, 0),
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(WT_ELF, 350, MS_GUARDIAN, MZ_HUMAN), MR_SLEEP, MR_SLEEP,
- M1_HUMANOID|M1_SEE_INVIS|M1_OMNIVORE,
- M2_NOPOLY|M2_ELF|M2_PEACEFUL|M2_COLLECT,
- M3_INFRAVISION|M3_INFRAVISIBLE, HI_DOMESTIC),
+ M1_HUMANOID | M1_SEE_INVIS | M1_OMNIVORE,
+ M2_NOPOLY | M2_ELF | M2_PEACEFUL | M2_COLLECT,
+ M3_INFRAVISION | M3_INFRAVISIBLE, HI_DOMESTIC),
#endif
MON("attendant", S_HUMAN, LVL(5, 12, 10, 10, 3), G_NOGEN,
A(ATTK(AT_WEAP, AD_PHYS, 1, 6), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
-/* NetHack 3.6 mthrowu.c $NHDT-Date: 1444258159 2015/10/07 22:49:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.58 $ */
+/* NetHack 3.6 mthrowu.c $NHDT-Date: 1445556876 2015/10/22 23:34:36 $ $NHDT-Branch: master $:$NHDT-Revision: 1.59 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
multishot = 1;
if (otmp->quan > 1L && /* no point checking if there's only 1 */
/* ammo requires corresponding launcher be wielded */
- (is_ammo(otmp) ? matching_launcher(otmp, mwep) :
+ (is_ammo(otmp) ? matching_launcher(otmp, mwep)
/* otherwise any stackable (non-ammo) weapon */
- otmp->oclass == WEAPON_CLASS) && !mtmp->mconf) {
+ : otmp->oclass == WEAPON_CLASS) && !mtmp->mconf) {
int skill = (int) objects[otmp->otyp].oc_skill;
/* Assumes lords are skilled, princes are expert */
case PM_NINJA:
if (skill == -P_SHURIKEN || skill == -P_DART)
multishot++;
- /*FALLTHRU*/
+ /*FALLTHRU*/
case PM_SAMURAI:
if (otmp->otyp == YA && mwep && mwep->otyp == YUMI)
multishot++;
-/* NetHack 3.6 muse.c $NHDT-Date: 1444260722 2015/10/07 23:32:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.65 $ */
+/* NetHack 3.6 muse.c $NHDT-Date: 1445556877 2015/10/22 23:34:37 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
m.has_misc = MUSE_POT_GAIN_LEVEL;
}
nomore(MUSE_BULLWHIP);
- if (obj->otyp == BULLWHIP && !mtmp->mpeaceful &&
+ if (obj->otyp == BULLWHIP && !mtmp->mpeaceful
/* the random test prevents whip-wielding
monster from attempting disarm every turn */
- uwep && !rn2(5) && obj == MON_WEP(mtmp) &&
+ && uwep && !rn2(5) && obj == MON_WEP(mtmp)
/* hero's location must be known and adjacent */
- mtmp->mux == u.ux && mtmp->muy == u.uy
- && distu(mtmp->mx, mtmp->my) <= 2 &&
+ && mtmp->mux == u.ux && mtmp->muy == u.uy
+ && distu(mtmp->mx, mtmp->my) <= 2
/* don't bother if it can't work (this doesn't
prevent cursed weapons from being targetted) */
- (canletgo(uwep, "") || (u.twoweap && canletgo(uswapwep, "")))) {
+ && (canletgo(uwep, "")
+ || (u.twoweap && canletgo(uswapwep, "")))) {
m.misc = obj;
m.has_misc = MUSE_BULLWHIP;
}
-/* NetHack 3.6 objnam.c $NHDT-Date: 1445126428 2015/10/18 00:00:28 $ $NHDT-Branch: master $:$NHDT-Revision: 1.148 $ */
+/* NetHack 3.6 objnam.c $NHDT-Date: 1445556878 2015/10/22 23:34:38 $ $NHDT-Branch: master $:$NHDT-Revision: 1.149 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
if (i > PREFIX) {
impossible("PREFIX too short (for %d).", i);
- return (s);
+ return s;
}
s -= i;
(void) strncpy(s, pref, i); /* do not copy trailing 0 */
- return (s);
+ return s;
}
/* manage a pool of BUFSZ buffers, so callers don't have to */
Sprintf(eos(buf), " called %s", un);
if (dn)
Sprintf(eos(buf), " (%s)", dn);
- return (buf);
+ return buf;
default:
if (nn) {
Strcpy(buf, actualn);
if (un)
Sprintf(eos(buf), " called %s", un);
}
- return (buf);
+ return buf;
}
/* here for ring/scroll/potion/wand */
if (nn) {
Sprintf(eos(buf), " called %s", un);
if (dn)
Sprintf(eos(buf), " (%s)", dn);
- return (buf);
+ return buf;
}
/* less verbose result than obj_typename(); either the actual name
if (!strncmpi(buf, "the ", 4))
buf += 4;
- return (buf);
+ return buf;
}
/* similar to simple_typename but minimal_xname operates on a particular
/* suppress known except for amulets (needed for fakes and real A-of-Y) */
bareobj.known = (obj->oclass == AMULET_CLASS)
? obj->known
- :
/* default is "on" for types which don't use it */
- !objects[otyp].oc_uses_known;
+ : !objects[otyp].oc_uses_known;
bareobj.quan = 1L; /* don't want plural */
bareobj.corpsenm = NON_PM; /* suppress statue and figurine details */
/* but suppressing fruit details leads to "bad fruit #0"
else if (obj->otyp == FAKE_AMULET_OF_YENDOR && !known)
return TRUE; /* lie */
else
- return (boolean)(objects[obj->otyp].oc_unique
- && (known || obj->otyp == AMULET_OF_YENDOR));
+ return (boolean) (objects[obj->otyp].oc_unique
+ && (known || obj->otyp == AMULET_OF_YENDOR));
}
/* should monster type be prefixed with "the"? (mostly used for corpses) */
Strcpy(prefix, "a ");
/* "empty" goes at the beginning, but item count goes at the end */
- if (cknown &&
+ if (cknown
/* bag of tricks: include "empty" prefix if it's known to
be empty but its precise number of charges isn't known
(when that is known, suffix of "(n:0)" will be appended,
making the prefix be redundant; note that 'known' flag
isn't set when emptiness gets discovered because then
charging magic would yield known number of new charges) */
- (obj->otyp == BAG_OF_TRICKS
+ && (obj->otyp == BAG_OF_TRICKS
? (obj->spe == 0 && !obj->known)
- :
/* not bag of tricks: empty if container which has no contents */
- (Is_container(obj) || obj->otyp == STATUE)
- && !Has_contents(obj)))
+ : (Is_container(obj) || obj->otyp == STATUE)
+ && !Has_contents(obj)))
Strcat(prefix, "empty ");
if (bknown && obj->oclass != COIN_CLASS
Sprintf(eos(bp), " (%d aum)", obj->owt);
}
bp = strprepend(bp, prefix);
- return (bp);
+ return bp;
}
char *
if (otmp->oclass == COIN_CLASS)
return FALSE; /* always fully ID'd */
/* check fundamental ID hallmarks first */
- if (!otmp->known || !otmp->dknown ||
+ if (!otmp->known || !otmp->dknown
#ifdef MAIL
- (!otmp->bknown && otmp->otyp != SCR_MAIL) ||
+ || (!otmp->bknown && otmp->otyp != SCR_MAIL)
#else
- !otmp->bknown ||
+ || !otmp->bknown
#endif
- !objects[otmp->otyp].oc_name_known)
+ || !objects[otmp->otyp].oc_name_known)
return TRUE;
if ((!otmp->cknown && (Is_container(otmp) || otmp->otyp == STATUE))
|| (!otmp->lknown && Is_box(otmp)))
return TRUE;
/* otmp->rknown is the only item of interest if we reach here */
/*
- * Note: if a revision ever allows scrolls to become fireproof or
- * rings to become shockproof, this checking will need to be revised.
- * `rknown' ID only matters if xname() will provide the info about it.
- */
+ * Note: if a revision ever allows scrolls to become fireproof or
+ * rings to become shockproof, this checking will need to be revised.
+ * `rknown' ID only matters if xname() will provide the info about it.
+ */
if (otmp->rknown
|| (otmp->oclass != ARMOR_CLASS && otmp->oclass != WEAPON_CLASS
- && !is_weptool(otmp) && /* (redundant) */
- otmp->oclass != BALL_CLASS)) /* (useless) */
+ && !is_weptool(otmp) /* (redundant) */
+ && otmp->oclass != BALL_CLASS)) /* (useless) */
return FALSE;
else /* lack of `rknown' only matters for vulnerable objects */
- return (boolean)(is_rustprone(otmp) || is_corrodeable(otmp)
- || is_flammable(otmp));
+ return (boolean) (is_rustprone(otmp) || is_corrodeable(otmp)
+ || is_flammable(otmp));
}
char *
Strcat(bp, " ");
Strcat(bp, otense(otmp, verb));
}
- return (bp);
+ return bp;
}
/* combine yname and aobjnam eg "your count cxname(otmp)" */
register char *s = yobjnam(obj, verb);
*s = highc(*s);
- return (s);
+ return s;
}
/* like aobjnam, but prepend "The", not count, and use xname */
Strcat(bp, " ");
Strcat(bp, otense(otmp, verb));
}
- return (bp);
+ return bp;
}
/* capitalized variant of doname() */
register char *s = doname(obj);
*s = highc(*s);
- return (s);
+ return s;
}
/* returns "[your ]xname(obj)" or "Foobar's xname(obj)" or "the xname(obj)" */
}
/* man/men ("Wiped out all cavemen.") */
- if (len >= 3 && !strcmpi(spot - 2, "man") &&
+ if (len >= 3 && !strcmpi(spot - 2, "man")
/* exclude shamans and humans */
- (len < 6 || strcmpi(spot - 5, "shaman"))
+ && (len < 6 || strcmpi(spot - 5, "shaman"))
&& (len < 5 || strcmpi(spot - 4, "human"))) {
Strcasecpy(spot - 1, "en");
goto bottom;
/* Ends in z, x, s, ch, sh; add an "es" */
if (index("zxs", lo_c)
- || (len >= 2 && lo_c == 'h' && index("cs", lowc(*(spot - 1)))) ||
+ || (len >= 2 && lo_c == 'h' && index("cs", lowc(*(spot - 1))))
/* Kludge to get "tomatoes" and "potatoes" right */
- (len >= 4 && !strcmpi(spot - 2, "ato"))
+ || (len >= 4 && !strcmpi(spot - 2, "ato"))
|| (len >= 5 && !strcmpi(spot - 4, "dingo"))) {
Strcasecpy(spot + 1, "es"); /* append es */
goto bottom;
(trap != MAGIC_PORTAL) ? "" : " to nowhere");
} else
pline("Creation of %s failed.", an(tname));
- return (&zeroobj);
+ return &zeroobj;
}
/* furniture and terrain */
lev->blessedftn = 1;
pline("A %sfountain.", lev->blessedftn ? "magic " : "");
newsym(x, y);
- return (&zeroobj);
+ return &zeroobj;
}
if (!BSTRCMPI(bp, p - 6, "throne")) {
lev->typ = THRONE;
pline("A throne.");
newsym(x, y);
- return (&zeroobj);
+ return &zeroobj;
}
if (!BSTRCMPI(bp, p - 4, "sink")) {
lev->typ = SINK;
lev->altarmask = Align2amask(al);
pline("%s altar.", An(align_str(al)));
newsym(x, y);
- return (&zeroobj);
+ return &zeroobj;
}
if (!BSTRCMPI(bp, p - 5, "grave")
pline("%s.", IS_GRAVE(lev->typ) ? "A grave"
: "Can't place a grave here");
newsym(x, y);
- return (&zeroobj);
+ return &zeroobj;
}
if (!BSTRCMPI(bp, p - 4, "tree")) {
default:
/* catch any other non-wishable objects (venom) */
if (objects[typ].oc_nowish)
- return ((struct obj *) 0);
+ return (struct obj *) 0;
break;
}
}
if (very && otmp->otyp == HEAVY_IRON_BALL)
otmp->owt += 160;
- return (otmp);
+ return otmp;
}
int
int i, x, sum = 0;
if (first == last)
- return (first);
+ return first;
for (i = first; i <= last; i++)
sum += objects[i].oc_prob;
if (!sum) /* all zero */
-/* NetHack 3.6 options.c $NHDT-Date: 1435002680 2015/06/22 19:51:20 $ $NHDT-Branch: master $:$NHDT-Revision: 1.222 $ */
+/* NetHack 3.6 options.c $NHDT-Date: 1445556879 2015/10/22 23:34:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.227 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
int len = (int) strlen(user_string);
if (val_allowed) {
- const char *p = index(user_string, ':'), *q = index(user_string, '=');
+ const char *p = index(user_string, ':'),
+ *q = index(user_string, '=');
if (!p || (q && q < p))
p = q;
len = (int) (p - user_string);
}
- return (len >= min_length) && !strncmpi(opt_name, user_string, len);
+ return (boolean) (len >= min_length
+ && !strncmpi(opt_name, user_string, len));
}
/* most environment variables will eventually be printed in an error
/* WINCAP
*
- map_mode:[tiles|ascii4x6|ascii6x8|ascii8x8|ascii16x8|ascii7x12|ascii8x12|
- ascii16x12|ascii12x16|ascii10x18|fit_to_screen] */
+ * map_mode:[tiles|ascii4x6|ascii6x8|ascii8x8|ascii16x8|ascii7x12|
+ * ascii8x12|ascii16x12|ascii12x16|ascii10x18|fit_to_screen]
+ */
fullname = "map_mode";
if (match_optname(opts, fullname, sizeof("map_mode") - 1, TRUE)) {
if (duplicate)
add_menu(tmpwin, NO_GLYPH, &any, action_titles[i].letr, 0, ATR_NONE,
tmpbuf,
#if 0 /* this ought to work but doesn't... */
- (action_titles[i].letr == 'x') ? MENU_SELECTED :
+ (action_titles[i].letr == 'x') ? MENU_SELECTED :
#endif
MENU_UNSELECTED);
}
{ "font_menu", WC_FONT_MENU },
{ "font_message", WC_FONT_MESSAGE },
#if 0
- {"perm_invent",WC_PERM_INVENT},
+ {"perm_invent", WC_PERM_INVENT},
#endif
{ "font_size_map", WC_FONTSIZ_MAP },
{ "font_size_menu", WC_FONTSIZ_MENU },
-/* NetHack 3.6 pager.c $NHDT-Date: 1436754893 2015/07/13 02:34:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.79 $ */
+/* NetHack 3.6 pager.c $NHDT-Date: 1445556880 2015/10/22 23:34:40 $ $NHDT-Branch: master $:$NHDT-Revision: 1.82 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
break;
}
tt = what_trap(tt);
- pline(
- "That is %s%s%s.",
- an(defsyms[trap_to_defsym(tt)].explanation),
- !trap->madeby_u
- ? ""
- : (tt == WEB) ? " woven" :
- /* trap doors & spiked pits can't be made by
- player, and should be considered at least
- as much "set" as "dug" anyway */
- (tt == HOLE || tt == PIT) ? " dug" : " set",
- !trap->madeby_u ? "" : " by you");
+ pline("That is %s%s%s.",
+ an(defsyms[trap_to_defsym(tt)].explanation),
+ !trap->madeby_u
+ ? ""
+ : (tt == WEB)
+ ? " woven"
+ /* trap doors & spiked pits can't be made by
+ player, and should be considered at least
+ as much "set" as "dug" anyway */
+ : (tt == HOLE || tt == PIT)
+ ? " dug"
+ : " set",
+ !trap->madeby_u ? "" : " by you");
return 0;
}
pline("I can't see a trap there.");
-/* NetHack 3.6 pickup.c $NHDT-Date: 1437877182 2015/07/26 02:19:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.160 $ */
+/* NetHack 3.6 pickup.c $NHDT-Date: 1445556881 2015/10/22 23:34:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.162 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
{
if (obj == uchain)
return FALSE;
- return (obj->quan >= val_for_n_or_more);
+ return (boolean) (obj->quan >= val_for_n_or_more);
}
/* list of valid menu classes for query_objlist() and allow_category callback
all_but_uchain(obj)
struct obj *obj;
{
- return (obj != uchain);
+ return (boolean) (obj != uchain);
}
/* query_objlist callback: return TRUE */
allow_cat_no_uchain(obj)
struct obj *obj;
{
- if ((obj != uchain) &&
- (((index(valid_menu_classes,'u') != (char *)0) && obj->unpaid) ||
- (index(valid_menu_classes, obj->oclass) != (char *)0)))
+ if (obj != uchain
+ && ((index(valid_menu_classes,'u') && obj->unpaid)
+ || index(valid_menu_classes, obj->oclass)))
return TRUE;
else
return FALSE;
|| (is_pool(u.ux, u.uy) && !Underwater)
|| is_lava(u.ux, u.uy))) {
read_engr_at(u.ux, u.uy);
- return (0);
+ return 0;
}
/* no pickup if levitating & not on air or water level */
if ((multi && !context.run) || (autopickup && !flags.pickup)
|| (ttmp && uteetering_at_seen_pit(ttmp)))
read_engr_at(u.ux, u.uy);
- return (0);
+ return 0;
}
/* multi && !context.run means they are in the middle of some other
* action, or possibly paralyzed, sleeping, etc.... and they just
*/
if ((multi && !context.run) || (autopickup && !flags.pickup)) {
check_here(FALSE);
- return (0);
+ return 0;
}
if (notake(youmonst.data)) {
if (!autopickup)
You("are physically incapable of picking anything up.");
else
check_here(FALSE);
- return (0);
+ return 0;
}
/* if there's anything here, stop running */
"pick up", objchain,
traverse_how == BY_NEXTHERE, &via_menu)) {
if (!via_menu)
- return (0);
+ return 0;
n = query_objlist(
"Pick up what?", objchain,
traverse_how | (selective ? 0 : INVORDER_SORT),
carry_count(obj, container, *cnt_p, telekinesis, &old_wt, &new_wt);
if (*cnt_p < 1L) {
result = -1; /* nothing lifted */
- } else if (obj->oclass != COIN_CLASS &&
+ } else if (obj->oclass != COIN_CLASS
/* [exception for gold coins will have to change
if silver/copper ones ever get implemented] */
- inv_cnt(FALSE) >= 52 && !merge_choice(invent, obj)) {
+ && inv_cnt(FALSE) >= 52 && !merge_choice(invent, obj)) {
Your("knapsack cannot accommodate any more items.");
result = -1; /* nothing lifted */
} else {
}
oldcap = newcap;
- return (newcap);
+ return newcap;
}
/* Is there a container at x,y. Optional: return count of containers at x,y */
cobj, doname, ansimpleoname,
"a container"));
if (c == 'q')
- return (timepassed);
+ return timepassed;
if (c == 'n')
continue;
anyfound = TRUE;
You("%s %s to loot.", dont_find_anything,
underfoot ? "here" : "there");
}
- return (timepassed);
+ return timepassed;
}
/* called when attempting to #loot while confused */
if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') {
if (nolimbs(youmonst.data)) {
You_cant("do that without limbs."); /* not body_part(HAND) */
- return (0);
+ return 0;
}
if (otmp->cursed) {
- You("can't. The saddle seems to be stuck to %s.",
+ You("can't. The saddle seems to be stuck to %s.",
x_monnam(mtmp, ARTICLE_THE, (char *) 0, SUPPRESS_SADDLE,
FALSE));
-
/* the attempt costs you time */
- return (1);
+ return 1;
}
obj_extract_self(otmp);
if ((unwornmask = otmp->owornmask) != 0L) {
if (prev_loot)
*prev_loot = TRUE;
} else if (c == 'q') {
- return (0);
+ return 0;
}
}
/* 3.4.0 introduced the ability to pick things up from within swallower's
-/* NetHack 3.6 potion.c $NHDT-Date: 1440120657 2015/08/21 01:30:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.117 $ */
+/* NetHack 3.6 potion.c $NHDT-Date: 1445556882 2015/10/22 23:34:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.119 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
return 0;
}
/* Is there a fountain to drink from here? */
- if (IS_FOUNTAIN(levl[u.ux][u.uy].typ) &&
+ if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)
/* not as low as floor level but similar restrictions apply */
- can_reach_floor(FALSE)) {
+ && can_reach_floor(FALSE)) {
if (yn("Drink from the fountain?") == 'y') {
drinkfountain();
return 1;
}
}
/* Or a kitchen sink? */
- if (IS_SINK(levl[u.ux][u.uy].typ) &&
+ if (IS_SINK(levl[u.ux][u.uy].typ)
/* not as low as floor level but similar restrictions apply */
- can_reach_floor(FALSE)) {
+ && can_reach_floor(FALSE)) {
if (yn("Drink from the sink?") == 'y') {
drinksink();
return 1;
otmp = getobj(beverages, "drink");
if (!otmp)
- return (0);
+ return 0;
/* quan > 1 used to be left to useup(), but we need to force
the current potion to be unworn, and don't want to do
&& !rn2(POTION_OCCUPANT_CHANCE(mvitals[PM_GHOST].born))) {
ghost_from_bottle();
useup(otmp);
- return (1);
+ return 1;
} else if (!strcmp(potion_descr, "smoky")
&& !(mvitals[PM_DJINNI].mvflags & G_GONE)
&& !rn2(POTION_OCCUPANT_CHANCE(mvitals[PM_DJINNI].born))) {
djinni_from_bottle(otmp);
useup(otmp);
- return (1);
+ return 1;
}
}
return dopotion(otmp);
otmp->in_use = TRUE;
nothing = unkn = 0;
if ((retval = peffects(otmp)) >= 0)
- return (retval);
+ return retval;
if (nothing) {
unkn++;
docall(otmp);
}
useup(otmp);
- return (1);
+ return 1;
}
int
break;
}
if (monster_detect(otmp, 0))
- return (1); /* nothing detected */
+ return 1; /* nothing detected */
exercise(A_WIS, TRUE);
break;
case POT_OBJECT_DETECTION:
case SPE_DETECT_TREASURE:
if (object_detect(otmp, 0))
- return (1); /* nothing detected */
+ return 1; /* nothing detected */
exercise(A_WIS, TRUE);
break;
case POT_SICKNESS:
break;
default:
impossible("What a funny potion! (%u)", otmp->otyp);
- return (0);
+ return 0;
}
- return (-1);
+ return -1;
}
void
case POT_POLYMORPH:
(void) bhitm(mon, obj);
break;
- /*
- case POT_GAIN_LEVEL:
- case POT_LEVITATION:
- case POT_FRUIT_JUICE:
- case POT_MONSTER_DETECTION:
- case POT_OBJECT_DETECTION:
- break;
- */
+ /*
+ case POT_GAIN_LEVEL:
+ case POT_LEVITATION:
+ case POT_FRUIT_JUICE:
+ case POT_MONSTER_DETECTION:
+ case POT_OBJECT_DETECTION:
+ break;
+ */
}
if (angermon)
wakeup(mon);
allowall[0] = ALL_CLASSES;
allowall[1] = '\0';
if (!(obj = getobj(allowall, "dip")))
- return (0);
+ return 0;
if (inaccessible_equipment(obj, "dip", FALSE))
return 0;
Sprintf(qtoo, "%s the fountain?", qbuf);
if (yn(upstart(qtoo)) == 'y') {
dipfountain(obj);
- return (1);
+ return 1;
}
} else if (is_pool(u.ux, u.uy)) {
const char *pooltype = waterbody_name(u.ux, u.uy);
}
}
potion->in_use = FALSE; /* didn't go poof */
- return (1);
+ return 1;
} else if (obj->oclass == POTION_CLASS && obj->otyp != potion->otyp) {
long amt = obj->quan;
obj->otyp = otmp->otyp;
obfree(otmp, (struct obj *) 0);
- } break;
+ break;
+ }
default:
useupall(obj);
useup(potion);
otense(obj, "turn"),
potion->odiluted ? hcolor(NH_ORANGE) : hcolor(NH_RED));
potion->in_use = FALSE; /* didn't go poof */
- return (1);
+ return 1;
}
if (potion->otyp == POT_WATER && obj->otyp == TOWEL) {
hold_another_object(singlepotion, "You juggle and drop %s!",
doname(singlepotion), (const char *) 0);
update_inventory();
- return (1);
+ return 1;
}
pline("Interesting...");
- return (1);
+ return 1;
poof:
if (!objects[potion->otyp].oc_name_known
-/* NetHack 3.6 pray.c $NHDT-Date: 1432512763 2015/05/25 00:12:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.81 $ */
+/* NetHack 3.6 pray.c $NHDT-Date: 1445556883 2015/10/22 23:34:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.85 $ */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
break; /* explvl 30+ */
}
/* 5 is a magic number in TROUBLE_HIT handling below */
- return (curhp <= 5 || curhp * divisor <= maxhp);
+ return (boolean) (curhp <= 5 || curhp * divisor <= maxhp);
}
STATIC_OVL int
* major troubles
*/
if (Stoned)
- return (TROUBLE_STONED);
+ return TROUBLE_STONED;
if (Slimed)
- return (TROUBLE_SLIMED);
+ return TROUBLE_SLIMED;
if (Strangled)
- return (TROUBLE_STRANGLED);
+ return TROUBLE_STRANGLED;
if (u.utrap && u.utraptype == TT_LAVA)
- return (TROUBLE_LAVA);
+ return TROUBLE_LAVA;
if (Sick)
- return (TROUBLE_SICK);
+ return TROUBLE_SICK;
if (u.uhs >= WEAK)
- return (TROUBLE_STARVING);
+ return TROUBLE_STARVING;
if (region_danger())
return TROUBLE_REGION;
if (critically_low_hp(FALSE))
return TROUBLE_HIT;
if (u.ulycn >= LOW_PM)
- return (TROUBLE_LYCANTHROPE);
+ return TROUBLE_LYCANTHROPE;
if (near_capacity() >= EXT_ENCUMBER && AMAX(A_STR) - ABASE(A_STR) > 3)
- return (TROUBLE_COLLAPSING);
+ return TROUBLE_COLLAPSING;
for (i = -1; i <= 1; i++)
for (j = -1; j <= 1; j++) {
count++;
}
if (count == 8 && !Passes_walls)
- return (TROUBLE_STUCK_IN_WALL);
+ return TROUBLE_STUCK_IN_WALL;
if (Cursed_obj(uarmf, LEVITATION_BOOTS)
|| stuck_ring(uleft, RIN_LEVITATION)
|| stuck_ring(uright, RIN_LEVITATION))
- return (TROUBLE_CURSED_LEVITATION);
+ return TROUBLE_CURSED_LEVITATION;
if (nohands(youmonst.data) || !freehand()) {
/* for bag/box access [cf use_container()]...
make sure it's a case that we know how to handle;
return TROUBLE_UNUSEABLE_HANDS;
}
if (Blindfolded && ublindf->cursed)
- return (TROUBLE_CURSED_BLINDFOLD);
+ return TROUBLE_CURSED_BLINDFOLD;
/*
* minor troubles
*/
if (Punished || (u.utrap && u.utraptype == TT_BURIEDBALL))
- return (TROUBLE_PUNISHED);
+ return TROUBLE_PUNISHED;
if (Cursed_obj(uarmg, GAUNTLETS_OF_FUMBLING)
|| Cursed_obj(uarmf, FUMBLE_BOOTS))
return TROUBLE_FUMBLING;
if (Blinded > 1 && haseyes(youmonst.data)
&& (!u.uswallow
|| !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND)))
- return (TROUBLE_BLIND);
+ return TROUBLE_BLIND;
for (i = 0; i < A_MAX; i++)
if (ABASE(i) < AMAX(i))
- return (TROUBLE_POISONED);
+ return TROUBLE_POISONED;
if (Wounded_legs && !u.usteed)
- return (TROUBLE_WOUNDED_LEGS);
+ return TROUBLE_WOUNDED_LEGS;
if (u.uhs >= HUNGRY)
return TROUBLE_HUNGRY;
if (HStun & TIMEOUT)
return TROUBLE_CONFUSED;
if (HHallucination & TIMEOUT)
return TROUBLE_HALLUCINATION;
- return (0);
+ return 0;
}
/* select an item for TROUBLE_CURSED_ITEMS */
((other || changed > 1L) ? "s" : ""), (changed > 1L ? "" : "s"),
(bless_water ? hcolor(NH_LIGHT_BLUE) : hcolor(NH_BLACK)));
}
- return ((boolean)(changed > 0L));
+ return (boolean) (changed > 0L);
}
STATIC_OVL void
useup(otmp);
else
useupf(otmp, 1L);
- return (1);
+ return 1;
} else if (has_omonst(otmp) && ((mtmp = get_mtraits(otmp, FALSE))
!= (struct monst *) 0)
&& mtmp->mtame) {
gods_upset(A_NONE);
else
You_feel("%s.",
- Hallucination ? "homesick" :
- /* headed towards celestial disgrace */
- (altaralign != u.ualign.type)
- ? "ashamed"
- :
- /* on track; give a big hint */
- "an urge to return to the surface");
+ Hallucination
+ ? "homesick"
+ /* if on track, give a big hint */
+ : (altaralign == u.ualign.type)
+ ? "an urge to return to the surface"
+ /* else headed towards celestial disgrace */
+ : "ashamed");
return 1;
} else {
/* The final Test. Did you win? */
if (value == 0) {
pline1(nothing_happens);
- return (1);
+ return 1;
}
if (altaralign != u.ualign.type && highaltar) {
if (!Inhell)
angrygods(u.ualign.type);
}
- return (1);
+ return 1;
} else {
consume_offering(otmp);
You("sense a conflict between %s and %s.", u_gname(),
&& rnd(u.ualign.record) > (7 * ALIGNLIM) / 8)
summon_minion(altaralign, TRUE);
}
- return (1);
+ return 1;
}
}
makeknown(otmp->otyp);
discover_artifact(otmp->oartifact);
}
- return (1);
+ return 1;
}
}
change_luck((value * LUCKMAX) / (MAXVALUE * 2));
}
}
}
- return (1);
+ return 1;
}
/* determine prayer results in advance; also used for enlightenment */
u.uinvulnerable = TRUE;
}
- return (1);
+ return 1;
}
STATIC_PTR int prayer_done() /* M. Stephenson (1.0.3b) */
/* no Half_physical_damage adjustment here */
losehp(rnd(20), "residual undead turning effect", KILLED_BY_AN);
exercise(A_CON, FALSE);
- return (1);
+ return 1;
}
if (Inhell) {
pline("Since you are in Gehennom, %s won't help you.",
/* haltingly aligned is least likely to anger */
if (u.ualign.record <= 0 || rnl(u.ualign.record))
angrygods(u.ualign.type);
- return (0);
+ return 0;
}
if (p_type == 0) {
(void) water_prayer(TRUE);
pleased(alignment); /* nice */
}
- return (1);
+ return 1;
}
int
}
You("don't know how to turn undead!");
- return (0);
+ return 0;
}
u.uconduct.gnostic++;
pline("For some reason, %s seems to ignore you.", u_gname());
aggravate();
exercise(A_WIS, FALSE);
- return (0);
+ return 0;
}
if (Inhell) {
pline("Since you are in Gehennom, %s won't help you.", u_gname());
aggravate();
- return (0);
+ return 0;
}
pline("Calling upon %s, you chant an arcane formula.", u_gname());
exercise(A_WIS, TRUE);
nomul(-5);
multi_reason = "trying to turn the monsters";
nomovemsg = You_can_move_again;
- return (1);
+ return 1;
}
const char *
a_gname()
{
- return (a_gname_at(u.ux, u.uy));
+ return a_gname_at(u.ux, u.uy);
}
const char *a_gname_at(x, y) /* returns the name of an altar's deity */
xchar x, y;
{
if (!IS_ALTAR(levl[x][y].typ))
- return ((char *) 0);
+ return (char *) 0;
return align_gname(a_align(x, y));
}
-/* NetHack 3.6 priest.c $NHDT-Date: 1432512764 2015/05/25 00:12:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.37 $ */
+/* NetHack 3.6 priest.c $NHDT-Date: 1445556883 2015/10/22 23:34:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.40 $ */
/* Copyright (c) Izchak Miller, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
struct obj *ib = (struct obj *) 0;
if (omx == gx && omy == gy)
- return (0);
+ return 0;
if (mtmp->mconf) {
avoid = FALSE;
appr = 0;
obj_extract_self(ib);
(void) mpickobj(mtmp, ib);
}
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
char
for (ptr = array; *ptr; ptr++)
if (rooms[*ptr - ROOMOFFSET].rtype == TEMPLE)
- return (*ptr);
- return ('\0');
+ return *ptr;
+ return '\0';
}
STATIC_OVL boolean
register struct monst *priest;
register xchar x, y;
{
- return ((boolean)(priest && priest->ispriest
+ return (boolean) (priest && priest->ispriest
&& (EPRI(priest)->shroom == *in_rooms(x, y, TEMPLE))
- && on_level(&(EPRI(priest)->shrlevel), &u.uz)));
+ && on_level(&(EPRI(priest)->shrlevel), &u.uz));
}
boolean
omy = priest->my;
if (!histemple_at(priest, omx, omy))
- return (-1);
+ return -1;
temple = EPRI(priest)->shroom;
if (Displaced)
Your("displaced image doesn't fool %s!", mon_nam(priest));
(void) mattacku(priest);
- return (0);
+ return 0;
} else if (index(u.urooms, temple)) {
/* chase player if inside temple & can see him */
if (priest->mcansee && m_canseeu(priest)) {
} else if (Invis)
avoid = FALSE;
- return (
- move_special(priest, FALSE, TRUE, FALSE, avoid, omx, omy, gx, gy));
+ return move_special(priest, FALSE, TRUE, FALSE, avoid, omx, omy, gx, gy);
}
/* exclusively for mktemple() */
p_coaligned(priest)
struct monst *priest;
{
- return ((boolean)(u.ualign.type == mon_aligntyp(priest)));
+ return (boolean) (u.ualign.type == mon_aligntyp(priest));
}
STATIC_OVL boolean
lev = &levl[epri_p->shrpos.x][epri_p->shrpos.y];
if (!IS_ALTAR(lev->typ) || !(lev->altarmask & AM_SHRINE))
return FALSE;
- return (boolean)(epri_p->shralign
- == (Amask2align(lev->altarmask & ~AM_SHRINE)));
+ return (boolean) (epri_p->shralign
+ == (Amask2align(lev->altarmask & ~AM_SHRINE)));
}
struct monst *
continue;
if (mtmp->ispriest && (EPRI(mtmp)->shroom == roomno)
&& histemple_at(mtmp, mtmp->mx, mtmp->my))
- return (mtmp);
+ return mtmp;
}
return (struct monst *) 0;
}
verbalize("I bestow upon thee a blessing.");
incr_itimeout(&HClairvoyant, rn1(500, 500));
}
- } else if (offer < (u.ulevel * 600) &&
+ } else if (offer < (u.ulevel * 600)
/* u.ublessed is only active when Protection is
enabled via something other than worn gear
(theft by gremlin clears the intrinsic but not
its former magnitude, making it recoverable) */
- (!(HProtection & INTRINSIC)
- || (u.ublessed < 20
- && (u.ublessed < 9 || !rn2(u.ublessed))))) {
+ && (!(HProtection & INTRINSIC)
+ || (u.ublessed < 20
+ && (u.ublessed < 9 || !rn2(u.ublessed))))) {
verbalize("Thy devotion has been rewarded.");
if (!(HProtection & INTRINSIC)) {
HProtection |= FROMOUTSIDE;
set_malign(roamer); /* peaceful may have changed */
/* MORE TO COME */
- return (roamer);
+ return roamer;
}
void
return FALSE;
if ((priest = findpriest(roomno)) == 0)
return FALSE;
- return (boolean)(has_shrine(priest) && p_coaligned(priest)
- && priest->mpeaceful);
+ return (boolean) (has_shrine(priest) && p_coaligned(priest)
+ && priest->mpeaceful);
}
void ghod_hitsu(priest) /* when attacking "priest" in his temple */