This commit is contained in:
nhmall
2015-03-09 21:19:37 -04:00
9 changed files with 98 additions and 42 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ V Show long version and game history
w Wield (put in use) a weapon w Wield (put in use) a weapon
W Wear a piece of armor W Wear a piece of armor
x Swap wielded and secondary weapons x Swap wielded and secondary weapons
X Enter explore (discovery) mode (only if defined) X Toggle two-weapon combat
y Go northwest 1 space y Go northwest 1 space
Y Go northwest until you are on top of something Y Go northwest until you are on top of something
^Y Go northwest until you are near something ^Y Go northwest until you are near something
+1 -1
View File
@@ -147,7 +147,7 @@ Commands:
w Wield weapon. w- means wield nothing, use bare hands. w Wield weapon. w- means wield nothing, use bare hands.
W Wear armor. W Wear armor.
x Swap wielded and secondary weapons. x Swap wielded and secondary weapons.
X Switch the game to explore (discovery) mode. X Toggle two-weapon combat.
^X Show your attributes. ^X Show your attributes.
z Zap a wand. (Use y instead of z if number_pad is -1.) z Zap a wand. (Use y instead of z if number_pad is -1.)
Z Cast a spell. (Use Y instead of Z if number_pad is -1.) Z Cast a spell. (Use Y instead of Z if number_pad is -1.)
+1 -1
View File
@@ -32,7 +32,6 @@ O options set options
\ known display list of what's been discovered \ known display list of what's been discovered
v version display version number v version display version number
V history display game history V history display game history
X explore switch the game to explore (discovery) mode
^A again redo the previous command (^A denotes the keystroke CTRL-A) ^A again redo the previous command (^A denotes the keystroke CTRL-A)
^R redraw redraw the screen ^R redraw redraw the screen
^P prevmsg repeat previous message (subsequent ^P's repeat earlier ones) ^P prevmsg repeat previous message (subsequent ^P's repeat earlier ones)
@@ -70,6 +69,7 @@ T takeoff take off some armor
w wield wield a weapon (w- wield nothing) w wield wield a weapon (w- wield nothing)
W wear put on some armor W wear put on some armor
x xchange swap wielded and secondary weapons x xchange swap wielded and secondary weapons
X twoweapon toggle two-weapon combat
z zap zap a wand (use y instead of z if number_pad is -1) z zap zap a wand (use y instead of z if number_pad is -1)
Z Zap cast a spell (use Y instead of Z if number_pad is -1) Z Zap cast a spell (use Y instead of Z if number_pad is -1)
< up go up the stairs < up go up the stairs
+4 -3
View File
@@ -708,7 +708,8 @@ The latter is used as your secondary weapon when engaging in
two-weapon combat. Note that if one of these slots is empty, two-weapon combat. Note that if one of these slots is empty,
the exchange still takes place. the exchange still takes place.
.lp X .lp X
Enter explore (discovery) mode, explained in its own section later. Toggle two-weapon combat, if your character can do it. Also available
via the ``#twoweapon'' extended command
.lp "" .lp ""
Since using this command by accident would be troublesome, you are asked Since using this command by accident would be troublesome, you are asked
to confirm your intent before switching to explore mode. By default to confirm your intent before switching to explore mode. By default
@@ -2980,8 +2981,8 @@ with the
.op -X .op -X
command-line switch or with the command-line switch or with the
.op playmode:explore .op playmode:explore
option. The other is to issue the `X' command while already option. The other is to issue the ``#exploremode'' extended command while
playing the game. Starting a new game in explore mode provides your already playing the game. Starting a new game in explore mode provides your
character with a wand of wishing in initial inventory; switching via `X' character with a wand of wishing in initial inventory; switching via `X'
during play does not. The other benefits of explore mode are left for during play does not. The other benefits of explore mode are left for
the trepid reader to discover. the trepid reader to discover.
+5
View File
@@ -316,6 +316,11 @@
#endif /* CHDIR */ #endif /* CHDIR */
/* If GENERIC_USERNAMES is defined, and the user name is found
* in that list, prompt for username instead.
* A public server should probably disable this. */
#define GENERIC_USERNAMES "play player game games nethack nethacker"
/* /*
* Section 3: Definitions that may vary with system type. * Section 3: Definitions that may vary with system type.
+2 -1
View File
@@ -2411,7 +2411,7 @@ static const struct func_tab cmdlist[] = {
{'W', FALSE, dowear}, {'W', FALSE, dowear},
{M('w'), FALSE, dowipe}, {M('w'), FALSE, dowipe},
{'x', FALSE, doswapweapon}, {'x', FALSE, doswapweapon},
{'X', TRUE, enter_explore_mode}, {'X', FALSE, dotwoweapon},
/* 'y', 'Y' : go nw */ /* 'y', 'Y' : go nw */
{'z', FALSE, dozap}, {'z', FALSE, dozap},
{'Z', TRUE, docast}, {'Z', TRUE, docast},
@@ -2456,6 +2456,7 @@ struct ext_func_tab extcmdlist[] = {
{"dip", "dip an object into something", dodip, FALSE}, {"dip", "dip an object into something", dodip, FALSE},
{"enhance", "advance or check weapon and spell skills", {"enhance", "advance or check weapon and spell skills",
enhance_weapon_skill, TRUE}, enhance_weapon_skill, TRUE},
{"exploremode", "enter explore mode", enter_explore_mode, TRUE},
{"force", "force a lock", doforce, FALSE}, {"force", "force a lock", doforce, FALSE},
{"invoke", "invoke an object's powers", doinvoke, TRUE}, {"invoke", "invoke an object's powers", doinvoke, TRUE},
{"jump", "jump to a location", dojump, FALSE}, {"jump", "jump to a location", dojump, FALSE},
+1 -1
View File
@@ -456,7 +456,7 @@ register struct obj *obj;
long money = money_cnt(invent); long money = money_cnt(invent);
struct obj *otmp; struct obj *otmp;
if (money > 10) { if (money > 10) {
/* Amount to loose. Might get rounded up as fountains don't pay change... */ /* Amount to lose. Might get rounded up as fountains don't pay change... */
money = somegold(money) / 10; money = somegold(money) / 10;
for (otmp = invent; otmp && money > 0; otmp = otmp->nobj) if (otmp->oclass == COIN_CLASS) { for (otmp = invent; otmp && money > 0; otmp = otmp->nobj) if (otmp->oclass == COIN_CLASS) {
int denomination = objects[otmp->otyp].oc_cost; int denomination = objects[otmp->otyp].oc_cost;
+77 -31
View File
@@ -1451,6 +1451,36 @@ int x, y;
return FALSE; return FALSE;
} }
int
do_loot_cont(cobjp)
struct obj **cobjp;
{
struct obj *cobj = *cobjp;
if (!cobj) return 0;
if (cobj->olocked) {
pline("%s locked.", cobj->lknown ? "It is" :
"Hmmm, it turns out to be");
cobj->lknown = 1;
return 0;
}
cobj->lknown = 1;
if (cobj->otyp == BAG_OF_TRICKS) {
int tmp;
You("carefully open the bag...");
pline("It develops a huge set of teeth and bites you!");
tmp = rnd(10);
losehp(Maybe_Half_Phys(tmp), "carnivorous bag", KILLED_BY_AN);
makeknown(BAG_OF_TRICKS);
return 1;
}
You("%sopen %s...",
(!cobj->cknown || !cobj->lknown) ? "carefully " : "",
the(xname(cobj)));
return use_container(cobjp, 0);
}
int int
doloot() /* loot a container on the floor or loot saddle from mon. */ doloot() /* loot a container on the floor or loot saddle from mon. */
{ {
@@ -1486,46 +1516,62 @@ lootcont:
if (container_at(cc.x, cc.y, FALSE)) { if (container_at(cc.x, cc.y, FALSE)) {
boolean any = FALSE; boolean any = FALSE;
int num_conts = 0;
if (!able_to_loot(cc.x, cc.y, TRUE)) return 0; if (!able_to_loot(cc.x, cc.y, TRUE)) return 0;
for (cobj = level.objects[cc.x][cc.y]; cobj; cobj = nobj) {
nobj = cobj->nexthere;
if (Is_container(cobj)) { for (cobj = level.objects[cc.x][cc.y]; cobj; cobj = cobj->nexthere)
c = ynq(safe_qbuf(qbuf, "There is ", " here, loot it?", if (Is_container(cobj)) num_conts++;
cobj, doname, ansimpleoname, "a container"));
if (c == 'q') return (timepassed);
if (c == 'n') continue;
any = TRUE;
if (cobj->olocked) { if (num_conts > 1) {
pline("%s locked.", cobj->lknown ? "It is" : /* use a menu to loot many containers */
"Hmmm, it turns out to be"); int n, i;
cobj->lknown = 1; winid win;
continue; anything any;
menu_item *pick_list = NULL;
any.a_void = 0;
win = create_nhwindow(NHW_MENU);
start_menu(win);
for (cobj = level.objects[cc.x][cc.y]; cobj; cobj = cobj->nexthere)
if (Is_container(cobj)) {
any.a_obj = cobj;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, doname(cobj), MENU_UNSELECTED);
} }
cobj->lknown = 1; end_menu(win, "Loot which containers?");
n = select_menu(win, PICK_ANY, &pick_list);
destroy_nhwindow(win);
if (cobj->otyp == BAG_OF_TRICKS) { if (n > 0) {
int tmp; for (i = 0; i < n; i++) {
You("carefully open the bag..."); timepassed |= do_loot_cont(&pick_list[i].item.a_obj);
pline("It develops a huge set of teeth and bites you!"); if (multi < 0 || !pick_list[i].item.a_obj) {
tmp = rnd(10); free((genericptr_t) pick_list);
losehp(Maybe_Half_Phys(tmp), "carnivorous bag", KILLED_BY_AN); return 1;
makeknown(BAG_OF_TRICKS); }
timepassed = 1;
continue;
} }
You("%sopen %s...",
(!cobj->cknown || !cobj->lknown) ? "carefully " : "",
the(xname(cobj)));
timepassed |= use_container(&cobj, 0);
/* might have triggered chest trap or magic bag explosion */
if (multi < 0 || !cobj) return 1;
} }
if (pick_list) free((genericptr_t) pick_list);
if (n != 0) c = 'y';
} else {
for (cobj = level.objects[cc.x][cc.y]; cobj; cobj = nobj) {
nobj = cobj->nexthere;
if (Is_container(cobj)) {
c = ynq(safe_qbuf(qbuf, "There is ", " here, loot it?",
cobj, doname, ansimpleoname, "a container"));
if (c == 'q') return (timepassed);
if (c == 'n') continue;
any = TRUE;
timepassed |= do_loot_cont(&cobj);
/* might have triggered chest trap or magic bag explosion */
if (multi < 0 || !cobj) return 1;
}
}
if (any) c = 'y';
} }
if (any) c = 'y';
} else if (IS_GRAVE(levl[cc.x][cc.y].typ)) { } else if (IS_GRAVE(levl[cc.x][cc.y].typ)) {
You("need to dig up the grave to effectively loot it..."); You("need to dig up the grave to effectively loot it...");
} }
+6 -3
View File
@@ -1332,12 +1332,15 @@ plnamesuffix()
char *sptr, *eptr; char *sptr, *eptr;
int i; int i;
#ifdef GENERIC_USERNAMES
/* some generic user names will be ignored in favor of prompting */ /* some generic user names will be ignored in favor of prompting */
i = (int)strlen(plname); i = (int)strlen(plname);
if ((i >= 4 && !strncmpi(plname, "player", i)) || /* play[er] */ eptr = GENERIC_USERNAMES;
(i >= 4 && !strncmpi(plname, "games", i)) || /* game[s] */ sptr = strstri(eptr, plname);
(i >= 7 && !strncmpi(plname, "nethacker", i))) /* nethack[er] */ if (sptr && ((sptr == eptr && (sptr[i] == ' ' || sptr[i] == '\0'))
|| sptr[i] == ' ' || sptr[i] == '\0'))
*plname = '\0'; /* call askname() */ *plname = '\0'; /* call askname() */
#endif
do { do {
if (!*plname) askname(); /* fill plname[] if necessary */ if (!*plname) askname(); /* fill plname[] if necessary */