Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2019-02-22 08:47:37 -05:00
7 changed files with 1176 additions and 1037 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dothrow.c $NHDT-Date: 1545597420 2018/12/23 20:37:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.155 $ */
/* NetHack 3.6 dothrow.c $NHDT-Date: 1550784489 2019/02/21 21:28:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.157 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -382,6 +382,8 @@ dofire()
/* if autoquiver is disabled or has failed, prompt for missile;
fill quiver with it if it's not wielded */
if (!obj) {
/* direction of previous throw is not suitable answer here */
in_doagain = FALSE;
obj = getobj(uslinging() ? bullets : toss_objs, "throw");
/* Q command doesn't allow gold in quiver */
if (obj && !obj->owornmask && obj->oclass != COIN_CLASS)
@@ -725,12 +727,11 @@ int x, y;
}
/* FIXME:
* Each trap should really trigger on the recoil if
* it would trigger during normal movement. However,
* not all the possible side-effects of this are
* tested [as of 3.4.0] so we trigger those that
* we have tested, and offer a message for the
* ones that we have not yet tested.
* Each trap should really trigger on the recoil if it would
* trigger during normal movement. However, not all the possible
* side-effects of this are tested [as of 3.4.0] so we trigger
* those that we have tested, and offer a message for the ones
* that we have not yet tested.
*/
if ((ttmp = t_at(x, y)) != 0) {
if (stopping_short) {
@@ -1035,7 +1036,7 @@ boolean hitsroof;
} else if (petrifier && !Stone_resistance
&& !(poly_when_stoned(g.youmonst.data)
&& polymon(PM_STONE_GOLEM))) {
petrify:
petrify:
g.killer.format = KILLED_BY;
Strcpy(g.killer.name, "elementary physics"); /* "what goes up..." */
You("turn to stone.");
@@ -1102,9 +1103,9 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
if ((obj->cursed || obj->greased) && (u.dx || u.dy) && !rn2(7)) {
boolean slipok = TRUE;
if (ammo_and_launcher(obj, uwep))
if (ammo_and_launcher(obj, uwep)) {
pline("%s!", Tobjnam(obj, "misfire"));
else {
} else {
/* only slip if it's greased or meant to be thrown */
if (obj->greased || throwing_weapon(obj))
/* BUG: this message is grammatically incorrect if obj has
@@ -1148,7 +1149,8 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
if (u.dz < 0
/* Mjollnir must we wielded to be thrown--caller verifies this;
aklys must we wielded as primary to return when thrown */
&& ((Role_if(PM_VALKYRIE) && obj->oartifact == ART_MJOLLNIR) || tethered_weapon)
&& ((Role_if(PM_VALKYRIE) && obj->oartifact == ART_MJOLLNIR)
|| tethered_weapon)
&& !impaired) {
pline("%s the %s and returns to your hand!", Tobjnam(obj, "hit"),
ceiling(u.ux, u.uy));
@@ -1188,8 +1190,8 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
}
} else {
/* crossbow range is independent of strength */
crossbowing =
(ammo_and_launcher(obj, uwep) && weapon_type(uwep) == P_CROSSBOW);
crossbowing = (ammo_and_launcher(obj, uwep)
&& weapon_type(uwep) == P_CROSSBOW);
urange = (crossbowing ? 18 : (int) ACURRSTR) / 2;
/* balls are easy to throw or at least roll;
* also, this insures the maximum range of a ball is greater
@@ -1358,7 +1360,8 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
g.thrownobj = (struct obj *) 0;
return;
} else {
if (tethered_weapon) tmp_at(DISP_END, 0);
if (tethered_weapon)
tmp_at(DISP_END, 0);
/* when this location is stepped on, the weapon will be
auto-picked up due to 'obj->was_thrown' of 1;
addinv() prevents thrown Mjollnir from being placed
@@ -1423,8 +1426,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
}
}
/* an object may hit a monster; various factors adjust the chance of hitting
*/
/* an object may hit a monster; various factors adjust chance of hitting */
int
omon_adj(mon, obj, mon_notices)
struct monst *mon;
@@ -1523,7 +1525,7 @@ register struct obj *obj; /* g.thrownobj or g.kickedobj or uwep */
* No bonuses for fleeing or stunned targets (they don't dodge
* melee blows as readily, but dodging arrows is hard anyway).
* Not affected by traps, etc.
* Certain items which don't in themselves do damage ignore tmp.
* Certain items which don't in themselves do damage ignore 'tmp'.
* Distance and monster size affect chance to hit.
*/
tmp = -1 + Luck + find_mac(mon) + u.uhitinc
@@ -1846,7 +1848,7 @@ register struct obj *obj;
(void) mpickobj(mon, obj); /* may merge and free obj */
ret = 1;
nopick:
nopick:
if (!Blind)
pline1(buf);
if (!tele_restrict(mon))

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mklev.c $NHDT-Date: 1511681724 2017/11/26 07:35:24 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.47 $ */
/* NetHack 3.6 mklev.c $NHDT-Date: 1550800390 2019/02/22 01:53:10 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Alex Smith, 2017. */
/* NetHack may be freely redistributed. See license for details. */
@@ -87,7 +87,7 @@ xchar xl, yl, xh, yh;
/* cannot find something reasonable -- strange */
x = xl;
y = yh;
gotit:
gotit:
cc->x = x;
cc->y = y;
return;
@@ -97,11 +97,12 @@ void
sort_rooms()
{
#if defined(SYSV) || defined(DGUX)
qsort((genericptr_t) g.rooms, (unsigned) g.nroom, sizeof(struct mkroom),
do_comp);
#define CAST_nroom (unsigned) g.nroom
#else
qsort((genericptr_t) g.rooms, g.nroom, sizeof(struct mkroom), do_comp);
#define CAST_nroom g.nroom /*as-is*/
#endif
qsort((genericptr_t) rooms, CAST_nroom, sizeof (struct mkroom), do_comp);
#undef CAST_nroom
}
STATIC_OVL void
@@ -726,11 +727,12 @@ makelevel()
/* make a secret treasure vault, not connected to the rest */
if (do_vault()) {
xchar w, h;
debugpline0("trying to make a vault...");
w = 1;
h = 1;
if (check_room(&g.vault_x, &w, &g.vault_y, &h, TRUE)) {
fill_vault:
fill_vault:
add_room(g.vault_x, g.vault_y, g.vault_x + w, g.vault_y + h, TRUE, VAULT,
FALSE);
g.level.flags.has_vault = 1;
@@ -783,7 +785,7 @@ makelevel()
mkroom(COCKNEST);
}
skip0:
skip0:
/* Place multi-dungeon branch. */
place_branch(branchp, 0, 0);
@@ -846,6 +848,7 @@ skip0:
if (!rn2(27 + 3 * abs(depth(&u.uz)))) {
char buf[BUFSZ];
const char *mesg = random_engraving(buf);
if (mesg) {
do {
x = somex(croom);
@@ -857,7 +860,7 @@ skip0:
}
}
skip_nonrogue:
skip_nonrogue:
if (!rn2(3)) {
(void) mkobj_at(0, somex(croom), somey(croom), TRUE);
tryct = 0;
@@ -1257,6 +1260,7 @@ struct mkroom *croom;
coord *tm;
{
register int kind;
struct trap *t;
unsigned lvl = level_difficulty();
coord m;
@@ -1365,7 +1369,11 @@ coord *tm;
|| (avoid_boulder && sobj_at(BOULDER, m.x, m.y)));
}
(void) maketrap(m.x, m.y, kind);
t = maketrap(m.x, m.y, kind);
/* we should always get type of trap we're asking for (occupied() test
should prevent cases where that might not happen) but be paranoid */
kind = t ? t->ttyp : NO_TRAP;
if (kind == WEB)
(void) makemon(&mons[PM_GIANT_SPIDER], m.x, m.y, NO_MM_FLAGS);
@@ -1390,8 +1398,13 @@ coord *tm;
lethal, and tend not to generate on shallower levels anyway.
Finally, pits are excluded because it's weird to see an item
in a pit and yet not be able to identify that the pit is there. */
if (lvl <= (unsigned) rnd(4)
if (kind != NO_TRAP && lvl <= (unsigned) rnd(4)
&& kind != SQKY_BOARD && kind != RUST_TRAP
/* rolling bounder trap might not have a boulder if there was no
viable path (such as when placed in the corner of a room), in
which case tx,ty==launch.x,y; no boulder => no dead predecessor */
&& !(kind == ROLLING_BOULDER_TRAP
&& t->launch.x == t->tx && t->launch.y == t->ty)
&& !is_pit(kind) && kind < HOLE) {
/* Object generated by the trap; initially NULL, stays NULL if
we fail to generate an object or if the trap doesn't