-/* NetHack 3.6 read.c $NHDT-Date: 1444352700 2015/10/09 01:05:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.116 $ */
+/* NetHack 3.6 read.c $NHDT-Date: 1446713638 2015/11/05 08:53:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.119 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
known = FALSE;
if (check_capacity((char *) 0))
- return (0);
+ return 0;
scroll = getobj(readable, "read");
if (!scroll)
- return (0);
+ return 0;
/* outrumor has its own blindness check */
if (scroll->otyp == FORTUNE_COOKIE) {
if (!Blind)
u.uconduct.literate++;
useup(scroll);
- return (1);
+ return 1;
} else if (scroll->otyp == T_SHIRT || scroll->otyp == ALCHEMY_SMOCK) {
char buf[BUFSZ];
if (Blind) {
} else if (scroll->oclass != SCROLL_CLASS
&& scroll->oclass != SPBOOK_CLASS) {
pline(silly_thing_to, "read");
- return (0);
+ return 0;
} else if (Blind && (scroll->otyp != SPE_BOOK_OF_THE_DEAD)) {
const char *what = 0;
if (scroll->oclass == SPBOOK_CLASS)
what = "formula on the scroll";
if (what) {
pline("Being blind, you cannot read the %s.", what);
- return (0);
+ return 0;
}
}
u.uconduct.literate++;
if (scroll->oclass == SPBOOK_CLASS) {
- return (study_book(scroll));
+ return study_book(scroll);
}
scroll->in_use = TRUE; /* scroll, not spellbook, now being read */
if (scroll->otyp != SCR_BLANK_PAPER) {
/*
* Forget some things (e.g. after reading a scroll of amnesia). When called,
* the following are always forgotten:
- * - felt ball & chain
- * - traps
- * - part (6 out of 7) of the map
+ * - felt ball & chain
+ * - traps
+ * - part (6 out of 7) of the map
*
* Other things are subject to flags:
- * howmuch & ALL_MAP = forget whole map
- * howmuch & ALL_SPELLS = forget all spells
+ * howmuch & ALL_MAP = forget whole map
+ * howmuch & ALL_SPELLS = forget all spells
*/
STATIC_OVL void
forget(howmuch)
if (objects[otyp].oc_magic)
exercise(A_WIS, TRUE); /* just for trying */
- already_known = (sobj->oclass == SPBOOK_CLASS || /* spell */
- objects[otyp].oc_name_known);
+ already_known = (sobj->oclass == SPBOOK_CLASS /* spell */
+ || objects[otyp].oc_name_known);
switch (otyp) {
#ifdef MAIL
pline("This is an identify scroll.");
if (!already_known)
(void) learnscrolltyp(SCR_IDENTIFY);
- /*FALLTHRU*/
+ /*FALLTHRU*/
case SPE_IDENTIFY:
cval = 1;
if (sblessed || (!scursed && !rn2(5))) {
u.uen = 0;
} else {
You_feel("charged up!");
- if (u.uen < u.uenmax)
- u.uen = u.uenmax;
- else
- u.uen = (u.uenmax += d(5, 4));
+ u.uen += d(sblessed ? 6 : 4, 4);
+ if (u.uen > u.uenmax)
+ u.uenmax = u.uen;
}
context.botl = 1;
break;
|| quest_info(MS_GUARDIAN) == i)
/* non-leader/nemesis/guardian role-specific monster
*/
- && (i != PM_NINJA || /* nuisance */
- Role_if(PM_SAMURAI))) {
+ && (i != PM_NINJA /* nuisance */
+ || Role_if(PM_SAMURAI))) {
boolean named, uniq;
named = type_is_pname(&mons[i]) ? TRUE : FALSE;
void
punish(sobj)
-register struct obj *sobj;
+struct obj *sobj;
{
struct obj *reuse_ball = (sobj && sobj->otyp == HEAVY_IRON_BALL)
? sobj : (struct obj *) 0;
}
}
+/* remove the ball and chain */
void
unpunish()
-{ /* remove the ball and chain */
+{
struct obj *savechain = uchain;
obj_extract_self(uchain);
-/* NetHack 3.6 rumors.c $NHDT-Date: 1432512762 2015/05/25 00:12:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */
+/* NetHack 3.6 rumors.c $NHDT-Date: 1446713640 2015/11/05 08:54:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.27 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#include "lev.h"
#include "dlb.h"
-/* [note: this comment is fairly old, but still accurate for 3.1]
+/* [note: this comment is fairly old, but still accurate for 3.1]
* Rumors have been entirely rewritten to speed up the access. This is
* essential when working from floppies. Using fseek() the way that's done
* here means rumors following longer rumors are output more often than those
* this also happens with real fortune cookies. -dgk
*/
-/* 3.5
+/* 3.5
* The rumors file consists of a "do not edit" line, then a line containing
* three sets of three counts (first two in decimal, third in hexadecimal).
* The first set has the number of true rumors, the count in bytes for all
* plus the size of the false rumors matches the offset for end-of-file.
*/
-/* 3.1 [now obsolete for rumors but still accurate for oracles]
+/* 3.1 [now obsolete for rumors but still accurate for oracles]
* The rumors file consists of a "do not edit" line, a hexadecimal number
* giving the number of bytes of useful/true rumors, followed by those
* true rumors (one per line), followed by the useless/false/misleading/cute
}
}
/*
- * input: 1 0 -1
- * rn2 \ +1 2=T 1=T 0=F
- * adj./ +0 1=T 0=F -1=F
+ * input: 1 0 -1
+ * rn2 \ +1 2=T 1=T 0=F
+ * adj./ +0 1=T 0=F -1=F
*/
switch (adjtruth = truth + rn2(2)) {
case 2: /*(might let a bogus input arg sneak thru)*/
int oracle_idx;
char xbuf[BUFSZ];
- if (oracle_flg < 0 || /* couldn't open ORACLEFILE */
- (oracle_flg > 0 && oracle_cnt == 0)) /* oracles already exhausted */
+ /* early return if we couldn't open ORACLEFILE on previous attempt,
+ or if all the oracularities are already exhausted */
+ if (oracle_flg < 0 || (oracle_flg > 0 && oracle_cnt == 0))
return;
oracles = dlb_fopen(ORACLEFILE, "r");
if (oracle_cnt == 0)
return;
}
- /* oracle_loc[0] is the special oracle; */
- /* oracle_loc[1..oracle_cnt-1] are normal ones */
+ /* oracle_loc[0] is the special oracle;
+ oracle_loc[1..oracle_cnt-1] are normal ones */
if (oracle_cnt <= 1 && !special)
return; /*(shouldn't happen)*/
oracle_idx = special ? 0 : rnd((int) oracle_cnt - 1);
tmpwin = create_nhwindow(NHW_TEXT);
if (delphi)
- putstr(
- tmpwin, 0,
- special
- ? "The Oracle scornfully takes all your money and says:"
- : "The Oracle meditates for a moment and then intones:");
+ putstr(tmpwin, 0,
+ special
+ ? "The Oracle scornfully takes all your money and says:"
+ : "The Oracle meditates for a moment and then intones:");
else
putstr(tmpwin, 0, "The message reads:");
putstr(tmpwin, 0, "");
int
doconsult(oracl)
-register struct monst *oracl;
+struct monst *oracl;
{
long umoney;
int u_pay, minor_cost = 50, major_cost = 500 + 50 * u.ulevel;
u_pay = minor_cost;
break;
case 'n':
- if (umoney <= (long) minor_cost || /* don't even ask */
- (oracle_cnt == 1 || oracle_flg < 0))
+ if (umoney <= (long) minor_cost /* don't even ask */
+ || (oracle_cnt == 1 || oracle_flg < 0))
return 0;
Sprintf(qbuf, "\"Then dost thou desire a major one?\" (%d %s)",
major_cost, currency((long) major_cost));
u.uevent.minor_oracle = TRUE;
} else {
boolean cheapskate = u_pay < major_cost;
+
outoracle(cheapskate, TRUE);
if (!cheapskate && !u.uevent.major_oracle)
add_xpts = u_pay / (u.uevent.minor_oracle ? 25 : 10);
-/* NetHack 3.6 shk.c $NHDT-Date: 1445906862 2015/10/27 00:47:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.114 $ */
+/* NetHack 3.6 shk.c $NHDT-Date: 1446713640 2015/11/05 08:54:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.115 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
STATIC_DCL void FDECL(setpaid, (struct monst *));
STATIC_DCL long FDECL(addupbill, (struct monst *));
STATIC_DCL void FDECL(pacify_shk, (struct monst *));
-STATIC_DCL struct bill_x *FDECL(onbill,
- (struct obj *, struct monst *, BOOLEAN_P));
+STATIC_DCL struct bill_x *FDECL(onbill, (struct obj *, struct monst *,
+ BOOLEAN_P));
STATIC_DCL struct monst *FDECL(next_shkp, (struct monst *, BOOLEAN_P));
STATIC_DCL long FDECL(shop_debt, (struct eshk *));
STATIC_DCL char *FDECL(shk_owns, (char *, struct obj *));
STATIC_DCL long FDECL(get_cost, (struct obj *, struct monst *));
STATIC_DCL long FDECL(set_cost, (struct obj *, struct monst *));
STATIC_DCL const char *FDECL(shk_embellish, (struct obj *, long));
-STATIC_DCL long FDECL(cost_per_charge,
- (struct monst *, struct obj *, BOOLEAN_P));
+STATIC_DCL long FDECL(cost_per_charge, (struct monst *, struct obj *,
+ BOOLEAN_P));
STATIC_DCL long FDECL(cheapest_item, (struct monst *));
STATIC_DCL int FDECL(dopayobj, (struct monst *, struct bill_x *,
struct obj **, int, BOOLEAN_P));
-STATIC_DCL long FDECL(stolen_container,
- (struct obj *, struct monst *, long, BOOLEAN_P));
+STATIC_DCL long FDECL(stolen_container, (struct obj *, struct monst *,
+ long, BOOLEAN_P));
STATIC_DCL long FDECL(getprice, (struct obj *, BOOLEAN_P));
STATIC_DCL void FDECL(shk_names_obj, (struct monst *, struct obj *,
const char *, long, const char *));
STATIC_DCL void FDECL(rouse_shk, (struct monst *, BOOLEAN_P));
STATIC_DCL void FDECL(remove_damage, (struct monst *, BOOLEAN_P));
STATIC_DCL void FDECL(sub_one_frombill, (struct obj *, struct monst *));
-STATIC_DCL void FDECL(add_one_tobill,
- (struct obj *, BOOLEAN_P, struct monst *));
-STATIC_DCL void FDECL(dropped_container,
- (struct obj *, struct monst *, BOOLEAN_P));
+STATIC_DCL void FDECL(add_one_tobill, (struct obj *, BOOLEAN_P,
+ struct monst *));
+STATIC_DCL void FDECL(dropped_container, (struct obj *, struct monst *,
+ BOOLEAN_P));
STATIC_DCL void FDECL(add_to_billobjs, (struct obj *));
-STATIC_DCL void FDECL(bill_box_content,
- (struct obj *, BOOLEAN_P, BOOLEAN_P, struct monst *));
+STATIC_DCL void FDECL(bill_box_content, (struct obj *, BOOLEAN_P, BOOLEAN_P,
+ struct monst *));
STATIC_DCL boolean FDECL(rob_shop, (struct monst *));
STATIC_DCL void FDECL(deserted_shop, (char *));
-STATIC_DCL boolean
-FDECL(special_stock, (struct obj *, struct monst *, BOOLEAN_P));
+STATIC_DCL boolean FDECL(special_stock, (struct obj *, struct monst *,
+ BOOLEAN_P));
STATIC_DCL const char *FDECL(cad, (BOOLEAN_P));
/*
invariants: obj->unpaid iff onbill(obj) [unless bp->useup]
- obj->quan <= bp->bquan
+ obj->quan <= bp->bquan
*/
/*
- Transfer money from inventory to monster when paying
- shopkeepers, priests, oracle, succubus, & other demons.
- Simple with only gold coins.
- This routine will handle money changing when multiple
- coin types is implemented, only appropriate
- monsters will pay change. (Peaceful shopkeepers, priests
- & the oracle try to maintain goodwill while selling
- their wares or services. Angry monsters and all demons
- will keep anything they get their hands on.
- Returns the amount actually paid, so we can know
- if the monster kept the change.
+ * Transfer money from inventory to monster when paying
+ * shopkeepers, priests, oracle, succubus, and other demons.
+ * Simple with only gold coins.
+ * This routine will handle money changing when multiple
+ * coin types is implemented, only appropriate
+ * monsters will pay change. (Peaceful shopkeepers, priests
+ * and the oracle try to maintain goodwill while selling
+ * their wares or services. Angry monsters and all demons
+ * will keep anything they get their hands on.
+ * Returns the amount actually paid, so we can know
+ * if the monster kept the change.
*/
long
money2mon(mon, amount)
}
/*
- Transfer money from monster to inventory.
- Used when the shopkeeper pay for items, and when
- the priest gives you money for an ale.
+ * Transfer money from monster to inventory.
+ * Used when the shopkeeper pay for items, and when
+ * the priest gives you money for an ale.
*/
void
money2u(mon, amount)
return shkp;
}
-void shkgone(mtmp) /* called in mon.c */
+/* called in mon.c */
+void
+shkgone(mtmp)
struct monst *mtmp;
{
struct eshk *eshk = ESHK(mtmp);
struct obj *obj1, *obj2;
{
register struct monst *shkp1, *shkp2;
- register struct bill_x *bp1 = 0, *bp2 = 0;
- register boolean are_mergable = FALSE;
+ struct bill_x *bp1 = 0, *bp2 = 0;
+ boolean are_mergable = FALSE;
/* look up the first object by finding shk whose bill it's on */
for (shkp1 = next_shkp(fmon, TRUE); shkp1;
shkp = shop_keeper(*u.ushops);
/*
* Note: `shkp = shop_keeper(*u.ushops)' used to be
- * unconditional. But obfree() is used all over
- * the place, so making its behavior be dependent
- * upon player location doesn't make much sense.
+ * unconditional. But obfree() is used all over
+ * the place, so making its behavior be dependent
+ * upon player location doesn't make much sense.
*/
if ((bp = onbill(obj, shkp, FALSE)) != 0) {
{
/* DRS/NS 2.2.6 messes up -- Peter Kendell */
int indx = ESHK(shkp)->billct;
+
*bp = ESHK(shkp)->bill_p[indx];
}
#else
multi = 0;
- /* find how many shk's there are, how many are in */
- /* sight, and are you in a shop room with one. */
+ /* Find how many shk's there are, how many are in
+ * sight, and are you in a shop room with one.
+ */
nxtm = resident = 0;
for (shkp = next_shkp(fmon, FALSE); shkp;
shkp = next_shkp(shkp->nmon, FALSE)) {
return 0;
}
- /* the usual case. allow paying at a distance when */
- /* inside a tended shop. should we change that? */
+ /* The usual case. Allow paying at a distance when
+ * inside a tended shop. Should we change that?
+ */
if (sk == 1 && resident) {
shkp = resident;
goto proceed;
return 1;
}
-/* return 2 if used-up portion paid */
-/* 1 if paid successfully */
-/* 0 if not enough money */
-/* -1 if skip this object */
-/* -2 if no money/credit left */
+/* return 2 if used-up portion paid
+ * 1 if paid successfully
+ * 0 if not enough money
+ * -1 if skip this object
+ * -2 if no money/credit left
+ */
STATIC_OVL int
dopayobj(shkp, bp, obj_p, which, itemize)
register struct monst *shkp;
}
/* give highest priority shopkeeper first crack */
- firstshk = resident ? resident : creditor ? creditor : hostile ? hostile
- : localshk;
+ firstshk = resident ? resident
+ : creditor ? creditor
+ : hostile ? hostile
+ : localshk;
if (firstshk) {
numsk++;
taken = inherits(firstshk, numsk, croaked);
char takes[BUFSZ];
shkp->minvis = 0;
- /* the simplifying principle is that first-come */
- /* already took everything you had. */
+ /* The simplifying principle is that first-come
+ already took everything you had. */
if (numsk > 1) {
if (cansee(shkp->mx, shkp->my) && croaked) {
takes[0] = '\0';
int ox = repo.location.x, oy = repo.location.y;
#if 0 /* don't bother */
- if (ox == 0 && oy == 0) impossible("finish_paybill: no location");
+ if (ox == 0 && oy == 0)
+ impossible("finish_paybill: no location");
#endif
/* normally done by savebones(), but that's too late in this case */
unleash_all();
}
/* Returns the price of an arbitrary item in the shop.
- * Returns 0 if the item doesn't belong to a shopkeeper. */
+ Returns 0 if the item doesn't belong to a shopkeeper. */
long
get_cost_of_shop_item(obj)
register struct obj *obj;
price = contained_cost(otmp, shkp, price, usell, unpaid_only);
}
- return (price);
+ return price;
}
long
verbalize("No thanks, I'd hang onto that if I were you.");
if (obj->spe < 7)
verbalize(
- "You'll need %d%s candle%s to go along with it.",
- (7 - obj->spe), (obj->spe > 0) ? " more" : "",
- plur(7 - obj->spe));
+ "You'll need %d%s candle%s to go along with it.",
+ (7 - obj->spe), (obj->spe > 0) ? " more" : "",
+ plur(7 - obj->spe));
/* [what if hero is already carrying enough candles?
should Izchak explain how to attach them instead] */
} else {
{
/* DRS/NS 2.2.6 messes up -- Peter Kendell */
int indx = ESHK(shkp)->billct;
+
*bp = ESHK(shkp)->bill_p[indx];
}
#else
levl[x][y].doormask = D_CLOSED; /* arbitrary */
newsym(x, y);
} else {
- /* don't set doormask - it is (hopefully) the same as it was */
- /* if not, perhaps save it with the damage array... */
+ /* don't set doormask - it is (hopefully) the same as it was
+ if not, perhaps save it with the damage array... */
if (IS_WALL(tmp_dam->typ) && cansee(x, y)) {
/* Player sees actual repair process, so they KNOW it's a wall */
levl[x][y].seenv = SVALL;
newsym(x, y);
}
- /* Mark this wall as "repaired". There currently is no code */
- /* to do anything about repaired walls, so don't do it. */
+ /* Mark this wall as "repaired". There currently is no code
+ to do anything about repaired walls, so don't do it. */
}
for (i = 0; i < 9; i++)
if (litter[i] & NEED_UPDATE)
return z;
}
-/* called after shopkeeper moves, in case the move causes re-entry into shop
- */
+/* called after shopkeeper moves, in case themove causes re-entry into shop */
void
after_shk_move(shkp)
struct monst *shkp;
You_feel("like a common thief.");
adjalign(-sgn(u.ualign.type));
}
- } else if (!um_dist(shkp->mx, shkp->my, 5) && !shkp->msleeping
- && shkp->mcanmove
+ } else if (!um_dist(shkp->mx, shkp->my, 5)
+ && !shkp->msleeping && shkp->mcanmove
&& (ESHK(shkp)->billct || ESHK(shkp)->debit)) {
register struct obj *obj, *obj2;
+
if (nolimbs(shkp->data)) {
grabs = "knocks off";
#if 0
- /* This is what should happen, but for balance
- * reasons, it isn't currently.
- */
- if (lang == 2)
- pline("%s curses %s inability to grab your backpack!",
- shkname(shkp), mhim(shkp));
- rile_shk(shkp);
- return;
+ /* This is what should happen, but for balance
+ * reasons, it isn't currently.
+ */
+ if (lang == 2)
+ pline("%s curses %s inability to grab your backpack!",
+ shkname(shkp), mhim(shkp));
+ rile_shk(shkp);
+ return;
#endif
}
if (distu(shkp->mx, shkp->my) > 2) {
register boolean uinshp = (*u.ushops != '\0');
char qbuf[80];
register xchar x, y;
- boolean dugwall = !strcmp(dmgstr, "dig into") || /* wand */
- !strcmp(dmgstr, "damage"); /* pick-axe */
+ boolean dugwall = (!strcmp(dmgstr, "dig into") /* wand */
+ || !strcmp(dmgstr, "damage")); /* pick-axe */
boolean animal, pursue;
struct damage *tmp_dam, *appear_here = 0;
/* any number >= (80*80)+(24*24) would do, actually */
}
eshk = ESHK(shkp);
- if (ANGRY(shkp))
- pline("%s mentions how much %s dislikes %s customers.", shkname(shkp),
- mhe(shkp), eshk->robbed ? "non-paying" : "rude");
- else if (eshk->following) {
+ if (ANGRY(shkp)) {
+ pline("%s mentions how much %s dislikes %s customers.",
+ shkname(shkp), mhe(shkp), eshk->robbed ? "non-paying" : "rude");
+ } else if (eshk->following) {
if (strncmp(eshk->customer, plname, PL_NSIZ)) {
- verbalize("%s %s! I was looking for %s.", Hello(shkp), plname,
- eshk->customer);
+ verbalize("%s %s! I was looking for %s.",
+ Hello(shkp), plname, eshk->customer);
eshk->following = 0;
} else {
- verbalize("%s %s! Didn't you forget to pay?", Hello(shkp),
- plname);
+ verbalize("%s %s! Didn't you forget to pay?",
+ Hello(shkp), plname);
}
} else if (eshk->billct) {
register long total = addupbill(shkp) + eshk->debit;
- pline("%s says that your bill comes to %ld %s.", shkname(shkp), total,
- currency(total));
- } else if (eshk->debit)
- pline("%s reminds you that you owe %s %ld %s.", shkname(shkp),
- mhim(shkp), eshk->debit, currency(eshk->debit));
- else if (eshk->credit)
+
+ pline("%s says that your bill comes to %ld %s.",
+ shkname(shkp), total, currency(total));
+ } else if (eshk->debit) {
+ pline("%s reminds you that you owe %s %ld %s.",
+ shkname(shkp), mhim(shkp), eshk->debit, currency(eshk->debit));
+ } else if (eshk->credit) {
pline("%s encourages you to use your %ld %s of credit.",
shkname(shkp), eshk->credit, currency(eshk->credit));
- else if (eshk->robbed)
+ } else if (eshk->robbed) {
pline("%s complains about a recent robbery.", shkname(shkp));
- else if ((shkmoney = money_cnt(shkp->minvent)) < 50)
+ } else if ((shkmoney = money_cnt(shkp->minvent)) < 50) {
pline("%s complains that business is bad.", shkname(shkp));
- else if (shkmoney > 4000)
+ } else if (shkmoney > 4000) {
pline("%s says that business is good.", shkname(shkp));
- else if (is_izchak(shkp, FALSE))
+ } else if (is_izchak(shkp, FALSE)) {
pline(Izchak_speaks[rn2(SIZE(Izchak_speaks))], shkname(shkp));
- else
+ } else {
pline("%s talks about the problem of shoplifters.", shkname(shkp));
+ }
}
STATIC_OVL void
kops_gone(silent)
-register boolean silent;
+boolean silent;
{
register int cnt = 0;
register struct monst *mtmp, *mtmp2;
}
}
if (cnt && !silent)
- pline_The("Kop%s (disappointed) vanish%s into thin air.", plur(cnt),
- cnt == 1 ? "es" : "");
+ pline_The("Kop%s (disappointed) vanish%s into thin air.",
+ plur(cnt), (cnt == 1) ? "es" : "");
}
STATIC_OVL long
return 0L; /* insurance */
tmp = get_cost(otmp, shkp);
- /* The idea is to make the exhaustive use of */
- /* an unpaid item more expensive than buying */
- /* it outright. */
+ /* The idea is to make the exhaustive use of an unpaid item
+ * more expensive than buying it outright.
+ */
if (otmp->otyp == MAGIC_LAMP) { /* 1 */
/* normal use (ie, as light source) of a magic lamp never
degrades its value, but not charging anything would make
else
tmp += tmp / 3L; /* djinni is being released */
} else if (otmp->otyp == MAGIC_MARKER) { /* 70 - 100 */
- /* no way to determine in advance */
- /* how many charges will be wasted. */
- /* so, arbitrarily, one half of the */
- /* price per use. */
+ /* No way to determine in advance how many charges will be
+ * wasted. So, arbitrarily, one half of the price per use.
+ */
tmp /= 2L;
- } else if (otmp->otyp == BAG_OF_TRICKS || /* 1 - 20 */
- otmp->otyp == HORN_OF_PLENTY) {
+ } else if (otmp->otyp == BAG_OF_TRICKS /* 1 - 20 */
+ || otmp->otyp == HORN_OF_PLENTY) {
/* altusage: emptying of all the contents at once */
if (!altusage)
tmp /= 5L;
- } else if (otmp->otyp == CRYSTAL_BALL || /* 1 - 5 */
- otmp->otyp == OIL_LAMP || /* 1 - 10 */
- otmp->otyp == BRASS_LANTERN
+ } else if (otmp->otyp == CRYSTAL_BALL /* 1 - 5 */
+ || otmp->otyp == OIL_LAMP /* 1 - 10 */
+ || otmp->otyp == BRASS_LANTERN
|| (otmp->otyp >= MAGIC_FLUTE
- && otmp->otyp <= DRUM_OF_EARTHQUAKE) || /* 5 - 9 */
- otmp->oclass == WAND_CLASS) { /* 3 - 11 */
+ && otmp->otyp <= DRUM_OF_EARTHQUAKE) /* 5 - 9 */
+ || otmp->oclass == WAND_CLASS) { /* 3 - 11 */
if (otmp->spe > 1)
tmp /= 4L;
} else if (otmp->oclass == SPBOOK_CLASS) {
return FALSE;
}
-/* used in domove to block diagonal shop-entry */
-/* u.ux, u.uy should always be a door */
+/* used in domove to block diagonal shop-entry;
+ u.ux, u.uy should always be a door */
boolean
block_entry(x, y)
register xchar x, y;
-/* NetHack 3.6 sounds.c $NHDT-Date: 1445906863 2015/10/27 00:47:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.72 $ */
-/* Copyright (c) 1989 Janet Walz, Mike Threepoint */
+/* NetHack 3.6 sounds.c $NHDT-Date: 1446713641 2015/11/05 08:54:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.74 $ */
+/* Copyright (c) 1989 Janet Walz, Mike Threepoint */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
continue;
if (is_mercenary(mtmp->data)
#if 0 /* don't bother excluding these */
- && !strstri(mtmp->data->mname, "watch")
- && !strstri(mtmp->data->mname, "guard")
+ && !strstri(mtmp->data->mname, "watch")
+ && !strstri(mtmp->data->mname, "guard")
#endif
&& mon_in_room(mtmp, BARRACKS)
/* sleeping implies not-yet-disturbed (usually) */
else if (msound == MS_GUARDIAN && ptr != &mons[urole.guardnum])
msound = mons[genus(monsndx(ptr), 1)].msound;
/* some normally non-speaking types can/will speak if hero is similar */
- else if (msound == MS_ORC && /* note: MS_ORC is same as MS_GRUNT */
- (same_race(ptr, youmonst.data) || /* current form, */
- same_race(ptr, &mons[Race_switch]))) /* unpoly'd form */
+ else if (msound == MS_ORC /* note: MS_ORC is same as MS_GRUNT */
+ && (same_race(ptr, youmonst.data) /* current form, */
+ || same_race(ptr, &mons[Race_switch]))) /* unpoly'd form */
msound = MS_HUMANOID;
/* silliness, with slight chance to interfere with shopping */
else if (Hallucination && mon_is_gecko(mtmp))
if (ptr != &mons[PM_PRISONER])
verbl_msg = "This will teach you not to disturb me!";
#if 0
- else
- verbl_msg = "??????????";
+ else
+ verbl_msg = "??????????";
#endif
}
break;
-/* NetHack 3.6 sp_lev.c $NHDT-Date: 1445906864 2015/10/27 00:47:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.63 $ */
-/* Copyright (c) 1989 by Jean-Christophe Collet */
+/* NetHack 3.6 sp_lev.c $NHDT-Date: 1446713642 2015/11/05 08:54:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */
+/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
/*
if (st) {
int i;
- if (st->stackdata && st->depth)
+ if (st->stackdata && st->depth) {
for (i = 0; i < st->depth; i++) {
switch (st->stackdata[i]->spovartyp) {
default:
case SPOVAR_VARIABLE:
case SPOVAR_STRING:
case SPOVAR_SEL:
- if (st->stackdata[i]->vardata.str)
- Free(st->stackdata[i]->vardata.str);
+ Free(st->stackdata[i]->vardata.str);
st->stackdata[i]->vardata.str = NULL;
break;
}
Free(st->stackdata[i]);
st->stackdata[i] = NULL;
}
-
+ }
Free(st->stackdata);
st->stackdata = NULL;
st->depth = st->depth_alloc = 0;
/*
* Coordinates in special level files are handled specially:
*
- * if x or y is < 0, we generate a random coordinate.
- * The "humidity" flag is used to insure that engravings aren't
- * created underwater, or eels on dry land.
+ * if x or y is < 0, we generate a random coordinate.
+ * The "humidity" flag is used to insure that engravings aren't
+ * created underwater, or eels on dry land.
*/
STATIC_DCL boolean FDECL(is_ok_location, (SCHAR_P, SCHAR_P, int));
* with what mkobj gave us! */
}
- /* corpsenm is "empty" if -1, random if -2, otherwise specific */
+ /* corpsenm is "empty" if -1, random if -2, otherwise specific */
if (o->corpsenm != NON_PM) {
if (o->corpsenm == NON_PM - 1)
set_corpsenm(otmp, rndmonnum());
selection_setpoint(xc + x, yc - y, ov, 1);
selection_setpoint(xc - x, yc + y, ov, 1);
}
- if (t + b2 * x <= crit1 || /* e(x+1,y-1/2) <= 0 */
- t + a2 * y <= crit3) { /* e(x+1/2,y) <= 0 */
+ if (t + b2 * x <= crit1 /* e(x+1,y-1/2) <= 0 */
+ || t + a2 * y <= crit3) { /* e(x+1/2,y) <= 0 */
x++;
dxt += d2xt;
t += dxt;
}
} else {
while (y >= 0 && x <= a) {
- if (t + b2 * x <= crit1 || /* e(x+1,y-1/2) <= 0 */
- t + a2 * y <= crit3) { /* e(x+1/2,y) <= 0 */
+ if (t + b2 * x <= crit1 /* e(x+1,y-1/2) <= 0 */
+ || t + a2 * y <= crit3) { /* e(x+1/2,y) <= 0 */
x++;
dxt += d2xt;
t += dxt;
coder->frame = tmpframe;
} while (coder->frame);
}
- free(coder);
+ Free(coder);
return TRUE;
}
-/* NetHack 3.6 steal.c $NHDT-Date: 1445906866 2015/10/27 00:47:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.64 $ */
+/* NetHack 3.6 steal.c $NHDT-Date: 1446713643 2015/11/05 08:54:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.65 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
}
/*
-Find the first (and hopefully only) gold object in a chain.
-Used when leprechaun (or you as leprechaun) looks for
-someone else's gold. Returns a pointer so the gold may
-be seized without further searching.
-May search containers too.
-Deals in gold only, as leprechauns don't care for lesser coins.
+ * Find the first (and hopefully only) gold object in a chain.
+ * Used when leprechaun (or you as leprechaun) looks for
+ * someone else's gold. Returns a pointer so the gold may
+ * be seized without further searching.
+ * May search containers too.
+ * Deals in gold only, as leprechauns don't care for lesser coins.
*/
struct obj *
findgold(chain)
}
/*
-Steal gold coins only. Leprechauns don't care for lesser coins.
+ * Steal gold coins only. Leprechauns don't care for lesser coins.
*/
void
stealgold(mtmp)
}
} else if (ygold) {
const int gold_price = objects[GOLD_PIECE].oc_cost;
+
tmp = (somegold(money_cnt(invent)) + gold_price - 1) / gold_price;
tmp = min(tmp, ygold->quan);
if (tmp < ygold->quan)
/* don't want hidden light source inside the monster; assumes that
engulfers won't have external inventories; whirly monsters cause
the light to be extinguished rather than letting it shine thru */
- if (otmp->lamplit && /* hack to avoid function calls for most objs */
- obj_sheds_light(otmp) && attacktype(mtmp->data, AT_ENGL)) {
+ if (obj_sheds_light(otmp) && attacktype(mtmp->data, AT_ENGL)) {
/* this is probably a burning object that you dropped or threw */
if (u.uswallow && mtmp == u.ustuck && !Blind)
pline("%s out.", Tobjnam(otmp, "go"));
-/* NetHack 3.6 trap.c $NHDT-Date: 1446604119 2015/11/04 02:28:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.243 $ */
+/* NetHack 3.6 trap.c $NHDT-Date: 1446713644 2015/11/05 08:54:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.244 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* fall though */
default:
if (mptr->mlet == S_GIANT
+ /* exclude baby dragons and relatively short worms */
|| (mptr->mlet == S_DRAGON && extra_nasty(mptr))
- || /* excl. babies */
- (mtmp->wormno && count_wsegs(mtmp) > 5)) {
+ || (mtmp->wormno && count_wsegs(mtmp) > 5)) {
tear_web = TRUE;
} else if (in_sight) {
pline("%s is caught in %s spider web.", Monnam(mtmp),
-/* NetHack 3.6 uhitm.c $NHDT-Date: 1446078766 2015/10/29 00:32:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.149 $ */
+/* NetHack 3.6 uhitm.c $NHDT-Date: 1446713645 2015/11/05 08:54:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.150 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
STATIC_DCL boolean FDECL(hmon_hitmon, (struct monst *, struct obj *, int));
STATIC_DCL int FDECL(joust, (struct monst *, struct obj *));
STATIC_DCL void NDECL(demonpet);
-STATIC_DCL boolean
-FDECL(m_slips_free, (struct monst * mtmp, struct attack *mattk));
+STATIC_DCL boolean FDECL(m_slips_free, (struct monst * mtmp,
+ struct attack *mattk));
STATIC_DCL int FDECL(explum, (struct monst *, struct attack *));
STATIC_DCL void FDECL(start_engulf, (struct monst *));
STATIC_DCL void NDECL(end_engulf);
return tmp;
}
-/* try to attack; return FALSE if monster evaded */
-/* u.dx and u.dy must be set */
+/* try to attack; return False if monster evaded;
+ u.dx and u.dy must be set */
boolean
attack(mtmp)
register struct monst *mtmp;
/* Is the "it died" check actually correct? */
if (mdat->mlet == S_LEPRECHAUN && !mtmp->mfrozen && !mtmp->msleeping
&& !mtmp->mconf && mtmp->mcansee && !rn2(7)
- && (m_move(mtmp, 0) == 2 || /* it died */
- mtmp->mx != u.ux + u.dx
+ && (m_move(mtmp, 0) == 2 /* it died */
+ || mtmp->mx != u.ux + u.dx
|| mtmp->my != u.uy + u.dy)) /* it moved */
return FALSE;
return malive;
}
-boolean /* general "damage monster" routine */
- hmon(mon, obj, thrown) /* return TRUE if mon still alive */
+/* general "damage monster" routine; return True if mon still alive */
+boolean
+hmon(mon, obj, thrown)
struct monst *mon;
struct obj *obj;
int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
} else {
char *whom = mon_nam(mon);
char *what = The(xname(obj));
+
if (!thrown && obj->quan > 1L)
what = An(singular(obj, xname));
/* note: s_suffix returns a modifiable buffer */
if (ispoisoned) {
int nopoison = (10 - (obj->owt / 10));
+
if (nopoison < 2)
nopoison = 2;
- if
- Role_if(PM_SAMURAI)
- {
- You("dishonorably use a poisoned weapon!");
- adjalign(-sgn(u.ualign.type));
- }
- else if ((u.ualign.type == A_LAWFUL) && (u.ualign.record > -10)) {
+ if (Role_if(PM_SAMURAI)) {
+ You("dishonorably use a poisoned weapon!");
+ adjalign(-sgn(u.ualign.type));
+ } else if (u.ualign.type == A_LAWFUL && u.ualign.record > -10) {
You_feel("like an evil coward for using a poisoned weapon.");
adjalign(-1);
}
tmp = 0;
if (mdat == &mons[PM_SHADE]) {
if (!hittxt) {
- const char *what =
- unconventional[0] ? unconventional : "attack";
+ const char *what = *unconventional ? unconventional : "attack";
+
Your("%s %s harmlessly through %s.", what,
vtense(what, "pass"), mon_nam(mon));
hittxt = TRUE;
}
}
- if (!hittxt && /*( thrown => obj exists )*/
- (!destroyed || (thrown && m_shot.n > 1 && m_shot.o == obj->otyp))) {
+ if (!hittxt /*( thrown => obj exists )*/
+ && (!destroyed
+ || (thrown && m_shot.n > 1 && m_shot.o == obj->otyp))) {
if (thrown)
hit(mshot_xname(obj), mon, exclam(tmp));
else if (!flags.verbose)
* 2) are dealt with properly by other routines
* when it comes to shades.
*/
- if (obj->otyp == BOULDER || obj->otyp == HEAVY_IRON_BALL
+ if (obj->otyp == BOULDER
+ || obj->otyp == HEAVY_IRON_BALL
|| obj->otyp == IRON_CHAIN /* dmgval handles those first three */
|| obj->otyp == MIRROR /* silver in the reflective surface */
|| obj->otyp == CLOVE_OF_GARLIC /* causes shades to flee */
return FALSE;
}
-/* used when hitting a monster with a lance while mounted */
-STATIC_OVL int /* 1: joust hit; 0: ordinary hit; -1: joust but break lance */
- joust(mon, obj)
+/* used when hitting a monster with a lance while mounted;
+ 1: joust hit; 0: ordinary hit; -1: joust but break lance */
+STATIC_OVL int
+joust(mon, obj)
struct monst *mon; /* target */
struct obj *obj; /* weapon */
{
|| !touch_petrifies(&mons[otmp->corpsenm]) || Stone_resistance)
return FALSE;
-/* no poly_when_stoned() critter has theft capability */
-#if 0
+#if 0 /* no poly_when_stoned() critter has theft capability */
if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) {
- display_nhwindow(WIN_MESSAGE, FALSE); /* --More-- */
- return TRUE;
+ display_nhwindow(WIN_MESSAGE, FALSE); /* --More-- */
+ return TRUE;
}
#endif
mdef->mstun = 1;
goto physical;
case AD_LEGS:
- /* if (u.ucancelled) { */
- /* tmp = 0; */
- /* break; */
- /* } */
+#if 0
+ if (u.ucancelled) {
+ tmp = 0;
+ break;
+ }
+#endif
goto physical;
case AD_WERE: /* no special effect on monsters */
case AD_HEAL: /* likewise */
wakeup(mdef);
}
-STATIC_OVL boolean hmonas(mon) /* attack monster as a monster. */
+/* attack monster as a monster. */
+STATIC_OVL boolean
+hmonas(mon)
register struct monst *mon;
{
struct attack *mattk, alt_attk;
use_weapon:
/* Certain monsters don't use weapons when encountered as enemies,
* but players who polymorph into them have hands or claws and
- * thus
- * should be able to use weapons. This shouldn't prohibit the use
- * of most special abilities, either.
- * If a monster has multiple claw attacks, only one can use
- * weapon.
+ * thus should be able to use weapons. This shouldn't prohibit
+ * the use of most special abilities, either.
+ * If monster has multiple claw attacks, only one can use weapon.
*/
weapon_used = TRUE;
/* Potential problem: if the monster gets multiple weapon attacks,
case AT_CLAW:
if (uwep && !cantwield(youmonst.data) && !weapon_used)
goto use_weapon;
- /*FALLTHRU*/
+ /*FALLTHRU*/
case AT_TUCH:
if (uwep && youmonst.data->mlet == S_LICH && !weapon_used)
goto use_weapon;
- /*FALLTHRU*/
+ /*FALLTHRU*/
case AT_KICK:
case AT_BITE:
case AT_STNG:
return (boolean) (nsum != 0);
}
-/* Special (passive) attacks on you by monsters done here. */
-
+/* Special (passive) attacks on you by monsters done here.
+ */
int
passive(mon, mhit, malive, aatyp, wep_was_destroyed)
register struct monst *mon;
else
tmp = 0;
- /* These affect you even if they just died */
-
+ /* These affect you even if they just died.
+ */
switch (ptr->mattk[i].adtyp) {
case AD_FIRE:
if (mhit && !mon->mcan) {
passive_obj(mon, (struct obj *) 0, &(ptr->mattk[i]));
}
break;
-
case AD_ACID:
if (mhit && rn2(2)) {
if (Blind || !flags.verbose)
if (aatyp == AT_MAGC)
protector = W_ARMG;
- if (protector == 0L || /* no protection */
- (protector == W_ARMG && !uarmg && !uwep && !wep_was_destroyed)
+ if (protector == 0L /* no protection */
+ || (protector == W_ARMG && !uarmg
+ && !uwep && !wep_was_destroyed)
|| (protector == W_ARMF && !uarmf)
|| (protector == W_ARMH && !uarmh)
|| (protector == (W_ARMC | W_ARMG) && (!uarmc || !uarmg))) {
break;
}
- /* These only affect you if they still live */
-
+ /* These only affect you if they still live.
+ */
if (malive && !mon->mcan && rn2(3)) {
switch (ptr->mattk[i].adtyp) {
case AD_PLYS:
}
if (mon->mcansee) {
if (ureflects("%s gaze is reflected by your %s.",
- s_suffix(Monnam(mon))))
+ s_suffix(Monnam(mon)))) {
;
- else if (Free_action)
+ } else if (Free_action) {
You("momentarily stiffen under %s gaze!",
s_suffix(mon_nam(mon)));
- else if (Hallucination && rn2(4))
+ } else if (Hallucination && rn2(4)) {
pline("%s looks %s%s.", Monnam(mon),
!rn2(2) ? "" : "rather ",
!rn2(2) ? "numb" : "stupified");
- else {
+ } else {
You("are frozen by %s gaze!", s_suffix(mon_nam(mon)));
nomul((ACURR(A_WIS) > 12 || rn2(4)) ? -tmp : -127);
multi_reason = "frozen by a monster's gaze";
register struct obj *obj; /* null means pick uwep, uswapwep or uarmg */
struct attack *mattk; /* null means we find one internally */
{
- register struct permonst *ptr = mon->data;
+ struct permonst *ptr = mon->data;
register int i;
/* if caller hasn't specified an object, use uwep, uswapwep or uarmg */
-/* NetHack 3.6 zap.c $NHDT-Date: 1446078771 2015/10/29 00:32:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.230 $ */
+/* NetHack 3.6 zap.c $NHDT-Date: 1446713647 2015/11/05 08:54:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.231 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
|| otyp == POT_SICKNESS
|| (otyp == POT_WATER && (obj->blessed || obj->cursed))) {
if (obj->spe != ((obj->oclass == WAND_CLASS) ? -1 : 0)
- && otyp != WAN_CANCELLATION && /* can't cancel cancellation */
- otyp != MAGIC_LAMP && /* cancelling doesn't remove djinni */
- otyp != CANDELABRUM_OF_INVOCATION) {
+ && otyp != WAN_CANCELLATION /* can't cancel cancellation */
+ && otyp != MAGIC_LAMP /* cancelling doesn't remove djinni */
+ && otyp != CANDELABRUM_OF_INVOCATION) {
costly_alteration(obj, COST_CANCEL);
obj->spe = (obj->oclass == WAND_CLASS) ? -1 : 0;
}
/* Actually more things use corpsenm but they polymorph differently */
#define USES_CORPSENM(typ) \
((typ) == CORPSE || (typ) == STATUE || (typ) == FIGURINE)
+
if (USES_CORPSENM(obj->otyp) && USES_CORPSENM(id))
set_corpsenm(otmp, obj->corpsenm);
#undef USES_CORPSENM
case WAN_STRIKING:
case SPE_FORCE_BOLT:
striking = TRUE;
- /*FALLTHRU*/
+ /*FALLTHRU*/
case WAN_LOCKING:
case SPE_WIZARD_LOCK:
/* down at open bridge or up or down at open portcullis */
xkilled(mon, 2);
}
-/* type == 0 to 9 : you shooting a wand */
-/* type == 10 to 19 : you casting a spell */
-/* type == 20 to 29 : you breathing as a monster */
-/* type == -10 to -19 : monster casting spell */
-/* type == -20 to -29 : monster breathing at you */
-/* type == -30 to -39 : monster shooting a wand */
-/* called with dx = dy = 0 with vertical bolts */
+/*
+ * type == 0 to 9 : you shooting a wand
+ * type == 10 to 19 : you casting a spell
+ * type == 20 to 29 : you breathing as a monster
+ * type == -10 to -19 : monster casting spell
+ * type == -20 to -29 : monster breathing at you
+ * type == -30 to -39 : monster shooting a wand
+ * called with dx = dy = 0 with vertical bolts
+ */
void
buzz(type, nd, sx, sy, dx, dy)
register int type, nd;
struct monst *mon;
coord save_bhitpos;
boolean shopdamage = FALSE;
- register const char *fltxt;
+ const char *fltxt;
struct obj *otmp;
int spell_type;
if (!msg)
msg = "The ice crackles and melts.";
- if (lev->typ == DRAWBRIDGE_UP)
+ if (lev->typ == DRAWBRIDGE_UP) {
lev->drawbridgemask &= ~DB_ICE; /* revert to DB_MOAT */
- else { /* lev->typ == ICE */
+ } else { /* lev->typ == ICE */
#ifdef STUPID
if (lev->icedpool == ICED_POOL)
lev->typ = POOL;
melt_ice(x, y, "Some ice melts away.");
}
-/* Burn floor scrolls, evaporate pools, etc... in a single square. Used
- * both for normal bolts of fire, cold, etc... and for fireballs.
+/* Burn floor scrolls, evaporate pools, etc... in a single square.
+ * Used both for normal bolts of fire, cold, etc... and for fireballs.
* Sets shopdamage to TRUE if a shop door is destroyed, and returns the
* amount by which range is reduced (the latter is just ignored by fireballs)
*/
melt_ice(x, y, (char *) 0);
} else if (is_pool(x, y)) {
const char *msgtxt = "You hear hissing gas.";
+
if (lev->typ != POOL) { /* MOAT or DRAWBRIDGE_UP */
if (see_it)
msgtxt = "Some water evaporates.";
(except on rogue level) */
newsym(x, y);
if (see_it)
- pline("%s %s reveals a secret door.", yourzap ? "Your" : "The",
- zapverb);
+ pline("%s %s reveals a secret door.",
+ yourzap ? "Your" : "The", zapverb);
else if (Is_rogue_level(&u.uz))
draft_message(FALSE); /* "You feel a draft." (open doorway) */
}
if (closed_door(x, y)) {
int new_doormask = -1;
const char *see_txt = 0, *sense_txt = 0, *hear_txt = 0;
+
rangemod = -1000;
switch (abstype) {
case ZT_FIRE:
register int osym, dmgtyp;
{
register struct obj *obj, *obj2;
- register int dmg, xresist, skip;
- register long i, cnt, quan;
- register int dindx;
+ int dmg, xresist, skip;
+ long i, cnt, quan;
+ int dindx;
const char *mult;
boolean physical_damage;
u.uconduct.wishes++;
if (otmp != &zeroobj) {
+ const char
+ *verb = ((Is_airlevel(&u.uz) || u.uinwater) ? "slip" : "drop"),
+ *oops_msg = (u.uswallow
+ ? "Oops! %s out of your reach!"
+ : (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)
+ || levl[u.ux][u.uy].typ < IRONBARS
+ || levl[u.ux][u.uy].typ >= ICE)
+ ? "Oops! %s away from you!"
+ : "Oops! %s to the floor!");
+
/* The(aobjnam()) is safe since otmp is unidentified -dlc */
- (void) hold_another_object(
- otmp, u.uswallow ? "Oops! %s out of your reach!"
- : (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)
- || levl[u.ux][u.uy].typ < IRONBARS
- || levl[u.ux][u.uy].typ >= ICE)
- ? "Oops! %s away from you!"
- : "Oops! %s to the floor!",
- The(aobjnam(otmp,
- Is_airlevel(&u.uz) || u.uinwater ? "slip" : "drop")),
- (const char *) 0);
+ (void) hold_another_object(otmp, oops_msg,
+ The(aobjnam(otmp, verb)),
+ (const char *) 0);
u.ublesscnt += rn1(100, 50); /* the gods take notice */
}
}