Add a new line for one last missing status field:  gold.
Also add one for proficiency with current weapon.

Move a few lines from 'characteristics' to 'background' and a few
more from 'characteristics' to new 'basics', leaving characteristics
with the six original characteristics:  Str, Con, Dec, &c.
This commit is contained in:
PatR
2018-11-02 00:59:01 -07:00
parent 3e8f199a9f
commit 89a3f4a3fd
5 changed files with 154 additions and 65 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1535812936 2018/09/01 14:42:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.636 $ */
/* NetHack 3.6 extern.h $NHDT-Date: 1541145514 2018/11/02 07:58:34 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.645 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -721,6 +721,7 @@ E void FDECL(make_grave, (int, int, const char *));
/* ### exper.c ### */
E long FDECL(newuexp, (int));
E int NDECL(newpw);
E int FDECL(experience, (struct monst *, int));
E void FDECL(more_experienced, (int, int));
@@ -2724,6 +2725,9 @@ E int NDECL(abon);
E int NDECL(dbon);
E void FDECL(wet_a_towel, (struct obj *, int, BOOLEAN_P));
E void FDECL(dry_a_towel, (struct obj *, int, BOOLEAN_P));
E char *FDECL(skill_level_name, (int, char *));
E const char *FDECL(skill_name, (int));
E boolean FDECL(can_advance, (int, BOOLEAN_P));
E int NDECL(enhance_weapon_skill);
E void FDECL(unrestrict_weapon_skill, (int));
E void FDECL(use_skill, (int, int));

153
src/cmd.c
View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1523306904 2018/04/09 20:48:24 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.281 $ */
/* NetHack 3.6 cmd.c $NHDT-Date: 1541145515 2018/11/02 07:58:35 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.297 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -190,6 +190,7 @@ STATIC_DCL boolean NDECL(walking_on_water);
STATIC_DCL boolean FDECL(cause_known, (int));
STATIC_DCL char *FDECL(attrval, (int, int, char *));
STATIC_DCL void FDECL(background_enlightenment, (int, int));
STATIC_DCL void FDECL(basics_enlightenment, (int, int));
STATIC_DCL void FDECL(characteristics_enlightenment, (int, int));
STATIC_DCL void FDECL(one_characteristic, (int, int, int));
STATIC_DCL void FDECL(status_enlightenment, (int, int));
@@ -1693,8 +1694,10 @@ int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */
putstr(en_win, 0, buf); /* "Conan the Archeologist's attributes:" */
/* background and characteristics; ^X or end-of-game disclosure */
if (mode & BASICENLIGHTENMENT) {
/* role, race, alignment, deities */
/* role, race, alignment, deities, dungeon level, time, experience */
background_enlightenment(mode, final);
/* hit points, energy points, armor class, gold */
basics_enlightenment(mode, final);
/* strength, dexterity, &c */
characteristics_enlightenment(mode, final);
}
@@ -1868,36 +1871,78 @@ int final;
Sprintf(buf, "in %s, on %s", dgnbuf, tmpbuf);
}
you_are(buf, "");
/* this is shown even if the 'time' option is off */
if (moves == 1L) {
you_have("just started your adventure", "");
} else {
/* 'turns' grates on the nerves in this context... */
Sprintf(buf, "the dungeon %ld turn%s ago", moves, plur(moves));
/* same phrasing for current and final: "entered" is unconditional */
enlght_line(You_, "entered ", buf, "");
}
if (!Upolyd) {
/* flags.showexp does not matter */
/* experience level is already shown above */
Sprintf(buf, "%-1ld experience point%s", u.uexp, plur(u.uexp));
if (wizard) {
if (u.ulevel < 30) {
int ulvl = (int) u.ulevel;
long nxtlvl = newuexp(ulvl);
/* long oldlvl = (ulvl > 1) ? newuexp(ulvl - 1) : 0; */
Sprintf(eos(buf), ", %ld %s%sneeded to attain level %d",
(nxtlvl - u.uexp), (u.uexp > 0) ? "more " : "",
!final ? "" : "were ", (ulvl + 1));
}
}
you_have(buf, "");
}
#ifdef SCORE_ON_BOTL
if (flags.showscore) {
/* describes what's shown on status line, which is an approximation;
only show it here if player has the 'showscore' option enabled */
Sprintf(buf, "%ld%s", botl_score(),
!final ? "" : " before end-of-game adjustments");
enl_msg("Your score ", "is ", "was ", buf, "");
}
#endif
}
/* characteristics: expanded version of bottom line strength, dexterity, &c;
[3.6.1: now includes all status info (except things already shown in the
'background' section), primarily so that blind players can suppress the
status line(s) altogether and use ^X feedback on demand to view HP, &c] */
/* hit points, energy points, armor class -- essential information which
doesn't fit very well in other categories */
/*ARGSUSED*/
STATIC_OVL void
characteristics_enlightenment(mode, final)
int mode;
basics_enlightenment(mode, final)
int mode UNUSED;
int final;
{
static char Power[] = "energy points (spell power)";
char buf[BUFSZ];
int hp = Upolyd ? u.mh : u.uhp;
int hpmax = Upolyd ? u.mhmax : u.uhpmax;
int wtype, pw = u.uen, hp = (Upolyd ? u.mh : u.uhp),
pwmax = u.uenmax, hpmax = (Upolyd ? u.mhmax : u.uhpmax);
putstr(en_win, 0, ""); /* separator after background */
putstr(en_win, 0,
final ? "Final Characteristics:" : "Current Characteristics:");
putstr(en_win, 0, "Basics:");
if (hp < 0)
hp = 0;
Sprintf(buf, "%d hit points (max:%d)", hp, hpmax);
/* "1 out of 1" rather than "all" if max is only 1; should never happen */
if (hp == hpmax && hpmax > 1)
Sprintf(buf, "all %d hit points", hpmax);
else
Sprintf(buf, "%d out of %d hit point%s", hp, hpmax, plur(hpmax));
you_have(buf, "");
Sprintf(buf, "%d magic power (max:%d)", u.uen, u.uenmax);
/* low max energy is feasible, so handle couple of extra special cases */
if (pwmax == 0 || (pw == pwmax && pwmax == 2)) /* both: "all 2" is silly */
Sprintf(buf, "%s %s", !pwmax ? "no" : "both", Power);
else if (pw == pwmax && pwmax > 2)
Sprintf(buf, "all %d %s", pwmax, Power);
else
Sprintf(buf, "%d out of %d %s", pw, pwmax, Power);
you_have(buf, "");
Sprintf(buf, "%d", u.uac);
enl_msg("Your armor class ", "is ", "was ", buf, "");
if (Upolyd) {
switch (mons[u.umonnum].mlevel) {
case 0:
@@ -1911,28 +1956,66 @@ int final;
Sprintf(buf, "%d hit dice", mons[u.umonnum].mlevel);
break;
}
} else {
/* flags.showexp does not matter */
/* experience level is already shown in the Background section */
Sprintf(buf, "%-1ld experience point%s",
u.uexp, plur(u.uexp));
you_have(buf, "");
}
you_have(buf, "");
/* this is shown even if the 'time' option is off */
Sprintf(buf, "the dungeon %ld turn%s ago", moves, plur(moves));
/* same phrasing at end of game: "entered" is unconditional */
enlght_line(You_, "entered ", buf, "");
Sprintf(buf, "%d", u.uac);
enl_msg("Your armor class ", "is ", "was ", buf, "");
#ifdef SCORE_ON_BOTL
if (flags.showscore) {
/* describes what's shown on status line, which is an approximation;
only show it here if player has the 'showscore' option enabled */
Sprintf(buf, "%ld%s", botl_score(),
!final ? "" : " before end-of-game adjustments");
enl_msg("Your score ", "is ", "was ", buf, "");
/*
* Skill with current weapon. Might help players who've never
* noticed #enhance or decided that it was pointless.
*
* TODO? This should probably be merged with the "you are wielding ..."
* at the end of the status conditions.
*/
wtype = uwep_skill_type();
if (wtype != P_NONE) {
boolean hav; /* "you have" vs "you are" */
char skil[20];
if (P_SKILL(wtype) == P_ISRESTRICTED)
Strcpy(skil, "no");
else
(void) lcase(skill_level_name(wtype, skil));
/* "no/basic/expert/master skill with" or "unskilled/skilled in" */
hav = (P_SKILL(wtype) != P_UNSKILLED && P_SKILL(wtype) != P_SKILLED);
Sprintf(buf, "%s %s %s",
skil, hav ? "skill with" : "in", skill_name(wtype));
if (can_advance(wtype, FALSE))
Sprintf(eos(buf), " and %s that",
!final ? "can enhance" : "could have enhanced");
if (hav)
you_have(buf, "");
else
you_are(buf, "");
}
#endif
/* gold; similar to doprgold(#seegold) but without shop billing info;
same amount as shown on status line which ignores container contents */
{
static const char Your_wallet[] = "Your wallet ";
long umoney = money_cnt(invent);
if (!umoney) {
enl_msg(Your_wallet, "is ", "was ", "empty", "");
} else {
Sprintf(buf, "%ld %s", umoney, currency(umoney));
enl_msg(Your_wallet, "contains ", "contained ", buf, "");
}
}
}
/* characteristics: expanded version of bottom line strength, dexterity, &c */
STATIC_OVL void
characteristics_enlightenment(mode, final)
int mode;
int final;
{
char buf[BUFSZ];
putstr(en_win, 0, "");
Sprintf(buf, "%s Characteristics:", !final ? "Current" : "Final");
putstr(en_win, 0, buf);
/* bottom line order */
one_characteristic(mode, final, A_STR); /* strength */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 exper.c $NHDT-Date: 1446975467 2015/11/08 09:37:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */
/* NetHack 3.6 exper.c $NHDT-Date: 1541145516 2018/11/02 07:58:36 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2007. */
/* NetHack may be freely redistributed. See license for details. */
@@ -6,10 +6,9 @@
#include "hack.h"
#include <limits.h>
STATIC_DCL long FDECL(newuexp, (int));
STATIC_DCL int FDECL(enermod, (int));
STATIC_OVL long
long
newuexp(lev)
int lev;
{

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 invent.c $NHDT-Date: 1519672703 2018/02/26 19:18:23 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.225 $ */
/* NetHack 3.6 invent.c $NHDT-Date: 1541145517 2018/11/02 07:58:37 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.241 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3605,6 +3605,7 @@ doprgold()
/* the messages used to refer to "carrying gold", but that didn't
take containers into account */
long umoney = money_cnt(invent);
if (!umoney)
Your("wallet is empty.");
else

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 weapon.c $NHDT-Date: 1454660575 2016/02/05 08:22:55 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.57 $ */
/* NetHack 3.6 weapon.c $NHDT-Date: 1541145518 2018/11/02 07:58:38 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.60 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -10,6 +10,12 @@
*/
#include "hack.h"
STATIC_DCL void FDECL(give_may_advance_msg, (int));
STATIC_DCL boolean FDECL(could_advance, (int));
STATIC_DCL boolean FDECL(peaked_skill, (int));
STATIC_DCL int FDECL(slots_required, (int));
STATIC_DCL void FDECL(skill_advance, (int));
/* Categories whose names don't come from OBJ_NAME(objects[type])
*/
#define PN_BARE_HANDED (-1) /* includes martial arts */
@@ -27,8 +33,6 @@
#define PN_ESCAPE_SPELL (-13)
#define PN_MATTER_SPELL (-14)
STATIC_DCL void FDECL(give_may_advance_msg, (int));
STATIC_VAR NEARDATA const short skill_names_indices[P_NUM_SKILLS] = {
0, DAGGER, KNIFE, AXE, PICK_AXE, SHORT_SWORD, BROADSWORD, LONG_SWORD,
TWO_HANDED_SWORD, SCIMITAR, PN_SABER, CLUB, MACE, MORNING_STAR, FLAIL,
@@ -51,25 +55,6 @@ STATIC_VAR NEARDATA const char *const barehands_or_martial[] = {
"bare handed combat", "martial arts"
};
STATIC_OVL void
give_may_advance_msg(skill)
int skill;
{
You_feel("more confident in your %sskills.",
skill == P_NONE ? "" : skill <= P_LAST_WEAPON
? "weapon "
: skill <= P_LAST_SPELL
? "spell casting "
: "fighting ");
}
STATIC_DCL boolean FDECL(can_advance, (int, BOOLEAN_P));
STATIC_DCL boolean FDECL(could_advance, (int));
STATIC_DCL boolean FDECL(peaked_skill, (int));
STATIC_DCL int FDECL(slots_required, (int));
STATIC_DCL char *FDECL(skill_level_name, (int, char *));
STATIC_DCL void FDECL(skill_advance, (int));
#define P_NAME(type) \
((skill_names_indices[type] > 0) \
? OBJ_NAME(objects[skill_names_indices[type]]) \
@@ -80,6 +65,17 @@ STATIC_DCL void FDECL(skill_advance, (int));
static NEARDATA const char kebabable[] = { S_XORN, S_DRAGON, S_JABBERWOCK,
S_NAGA, S_GIANT, '\0' };
STATIC_OVL void
give_may_advance_msg(skill)
int skill;
{
You_feel("more confident in your %sskills.",
(skill == P_NONE) ? ""
: (skill <= P_LAST_WEAPON) ? "weapon "
: (skill <= P_LAST_SPELL) ? "spell casting "
: "fighting ");
}
/* weapon's skill category name for use as generalized description of weapon;
mostly used to shorten "you drop your <weapon>" messages when slippery
fingers or polymorph causes hero to involuntarily drop wielded weapon(s) */
@@ -871,7 +867,7 @@ boolean verbose;
}
/* copy the skill level name into the given buffer */
STATIC_OVL char *
char *
skill_level_name(skill, buf)
int skill;
char *buf;
@@ -906,6 +902,13 @@ char *buf;
return buf;
}
const char *
skill_name(skill)
int skill;
{
return P_NAME(skill);
}
/* return the # of slots required to advance the skill */
STATIC_OVL int
slots_required(skill)
@@ -932,8 +935,7 @@ int skill;
}
/* return true if this skill can be advanced */
/*ARGSUSED*/
STATIC_OVL boolean
boolean
can_advance(skill, speedy)
int skill;
boolean speedy;