-/* NetHack 3.6 role.c $NHDT-Date: 1463561393 2016/05/18 08:49:53 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.38 $ */
+/* NetHack 3.6 role.c $NHDT-Date: 1547086250 2019/01/10 02:10:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.56 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
/* JNetHack Copyright */
/* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
-/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016 */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2020 */
/* JNetHack may be freely redistributed. See license for details. */
#include "hack.h"
* God names use a leading underscore to flag goddesses.
*/
const struct Role roles[] = {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Archeologist", 0 },
{ { "Digger", 0 },
{ "Field Worker", 0 },
"\83P\83c\83A\83\8b\83J\83g\83\8b", "\83J\83}\83L\83V\83g\83\8a", "\83t\83w\83g\83g\83\8b", /* Central American */
#endif
"Arc",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the College of Archeology",
"the Tomb of the Toltec Kings",
#else
A_INT,
SPE_MAGIC_MAPPING,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Barbarian", 0 },
{ { "Plunderer", "Plunderess" },
{ "Pillager", 0 },
"\83~\83g\83\89", "\83N\83\8d\83\80", "\83Z\83g", /* Hyborian */
#endif
"Bar",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Camp of the Duali Tribe",
"the Duali Oasis",
#else
A_INT,
SPE_HASTE_SELF,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Caveman", "Cavewoman" },
{ { "Troglodyte", 0 },
{ "Aborigine", 0 },
"\83A\83k", "_\83C\83V\83\85\83^\83\8b", "\83A\83\93\83V\83\83\83\8b", /* Babylonian */
#endif
"Cav",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Caves of the Ancestors",
"the Dragon's Lair",
#else
A_INT,
SPE_DIG,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Healer", 0 },
{ { "Rhizotomist", 0 },
{ "Empiric", 0 },
"_\83A\83e\83i", "\83w\83\8b\83\81\83X", "\83|\83Z\83C\83h\83\93", /* Greek */
#endif
"Hea",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Temple of Epidaurus",
"the Temple of Coeus",
#else
A_WIS,
SPE_CURE_SICKNESS,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Knight", 0 },
{ { "Gallant", 0 },
{ "Esquire", 0 },
"\83\8b\81[\83t", "_\83u\83\8a\83W\83b\83g", "\83}\83i\83\93\83i\83\93\81E\83}\83N\83\8a\81[\83\8b", /* Celtic */
#endif
"Kni",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"Camelot Castle",
"the Isle of Glass",
#else
A_WIS,
SPE_TURN_UNDEAD,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Monk", 0 },
{ { "Candidate", 0 },
{ "Novice", 0 },
"\8eR\97\8b\90¸", "\90Ô\8f¼\8eq", "\89©\92é", /* Chinese */
#endif
"Mon",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Monastery of Chan-Sune",
"the Monastery of the Earth-Lord",
#else
A_WIS,
SPE_RESTORE_ABILITY,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Priest", "Priestess" },
{ { "Aspirant", 0 },
{ "Acolyte", 0 },
0, 0, 0, /* deities from a randomly chosen other role will be used */
#endif
"Pri",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Great Temple",
"the Temple of Nalzok",
#else
-4 },
/* Note: Rogue precedes Ranger so that use of `-R' on the command line
retains its traditional meaning. */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Rogue", 0 },
{ { "Footpad", 0 },
{ "Cutpurse", 0 },
"\83C\83Z\83b\83N", "\83\82\83O", "\83R\83X", /* Nehwon */
#endif
"Rog",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Thieves' Guild Hall",
"the Assassins' Guild Hall",
#else
A_INT,
SPE_DETECT_TREASURE,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Ranger", 0 },
{
#if 0 /* OBSOLETE */
"\83}\81[\83L\83\85\83\8a\81[", "_\83r\81[\83i\83X", "\83}\81[\83Y", /* Roman/planets */
#endif
"Ran",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"Orion's camp",
"the cave of the wumpus",
#else
A_INT,
SPE_INVISIBILITY,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Samurai", 0 },
{ { "Hatamoto", 0 }, /* Banner Knight */
{ "Ronin", 0 }, /* no allegiance */
"_\93V\8fÆ\91å\90_", "\97\8b\90_", "\90{\8d²\94V\92j", /* Japanese */
#endif
"Sam",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Castle of the Taro Clan",
"the Shogun's Castle",
#else
A_INT,
SPE_CLAIRVOYANCE,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Tourist", 0 },
{ { "Rambler", 0 },
{ "Sightseer", 0 },
"\96Ó\96Ú\82Ì\83C\83I", "_\81\83\8f\97\90_\81\84", "\83I\83t\83\89\81[", /* Discworld */
#endif
"Tou",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"Ankh-Morpork",
"the Thieves' Guild Hall",
#else
A_INT,
SPE_CHARM_MONSTER,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Valkyrie", 0 },
{ { "Stripling", 0 },
{ "Skirmisher", 0 },
"\83`\83\85\81[\83\8b", "\83I\81[\83f\83B\83\93", "\83\8d\83L", /* Norse */
#endif
"Val",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Shrine of Destiny",
"the cave of Surtur",
#else
A_WIS,
SPE_CONE_OF_COLD,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Wizard", 0 },
{ { "Evoker", 0 },
{ "Conjurer", 0 },
"\83v\83^\83n", "\83g\81[\83g", "\83A\83\93\83t\83\8b", /* Egyptian */
#endif
"Wiz",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Lonely Tower",
"the Tower of Darkness",
#else
/* Table of all races */
const struct Race races[] = {
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"human",
"human",
"humanity",
"\90l\8aÔ",
#endif
"Hum",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ "man", "woman" },
#else
{ "\92j", "\8f\97" },
{ 1, 0, 2, 0, 2, 0 } /* Energy */
},
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"elf",
"elven",
"elvenkind",
{ 2, 0, 3, 0, 3, 0 } /* Energy */
},
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"dwarf",
"dwarven",
"dwarvenkind",
{ 0, 0, 0, 0, 0, 0 } /* Energy */
},
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"gnome",
"gnomish",
"gnomehood",
{ 2, 0, 2, 0, 2, 0 } /* Energy */
},
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"orc",
"orcish",
"orcdom",
\8aY\93\96\95\94\82à\97v\8fC\90³\81B
*/
const struct Gender genders[] = {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ "male", "he", "him", "his", "Mal", ROLE_MALE },
{ "female", "she", "her", "her", "Fem", ROLE_FEMALE },
{ "neuter", "it", "it", "its", "Ntr", ROLE_NEUTER }
/* Table of all alignments */
const struct Align aligns[] = {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ "law", "lawful", "Law", ROLE_LAWFUL, A_LAWFUL },
{ "balance", "neutral", "Neu", ROLE_NEUTRAL, A_NEUTRAL },
{ "chaos", "chaotic", "Cha", ROLE_CHAOTIC, A_CHAOTIC },
}
int
-randrole()
+randrole(for_display)
+boolean for_display;
{
- return rn2(SIZE(roles) - 1);
+ int res = SIZE(roles) - 1;
+
+ if (for_display)
+ res = rn2_on_display_rng(res);
+ else
+ res = rn2(res);
+ return res;
}
STATIC_OVL int
&& ok_gend(i, ROLE_NONE, ROLE_RANDOM, ROLE_NONE)
&& ok_align(i, ROLE_NONE, ROLE_NONE, ROLE_RANDOM))
set[n++] = i;
- return n ? set[rn2(n)] : randrole();
+ return n ? set[rn2(n)] : randrole(FALSE);
}
int
static char err_ret[] = " character's";
*/
static char err_ret[] = "\83L\83\83\83\89\83N\83^\81[\82Ì";
+#if 0 /*JP*/
boolean donefirst = FALSE;
+#endif
if (!suppliedbuf || buflen < 1)
return err_ret;
Strcat(buf, " ");
#endif
Strcat(buf, aligns[alignnum].adj);
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
} else {
#if 0 /*JP*/
if (donefirst)
Strcat(buf, " ");
#endif
Strcat(buf, aligns[alignnum].adj);
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
}
} else {
/* in case we got here by failing the ok_align() test */
Strcat(buf, " ");
#endif
Strcat(buf, genders[gendnum].adj);
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
}
} else {
#if 0 /*JP*/
Strcat(buf, " ");
#endif
Strcat(buf, genders[gendnum].adj);
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
}
} else {
/* if gender not specified, but role is specified
#endif
Strcat(buf, (rolenum == ROLE_NONE) ? races[racenum].noun
: races[racenum].adj);
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
} else if (!validrole(rolenum)) {
#if 0 /*JP*/
if (donefirst)
Strcat(buf, " ");
#endif
Strcat(buf, races[racenum].noun);
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
} else {
pa[BP_RACE] = 1;
post_attribs++;
} else
Strcat(buf, roles[rolenum].name.m);
}
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
} else if (rolenum == ROLE_NONE) {
pa[BP_ROLE] = 1;
post_attribs++;
Strcat(buf, "character");
*/
Strcat(buf, "\83L\83\83\83\89\83N\83^\81[");
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
}
/* <your lawful female gnomish cavewoman> || <your lawful female gnome>
* || <your lawful female character>
Strcpy(tmpbuf, "Shall I pick ");
if (racenum != ROLE_NONE || validrole(rolenum))
Strcat(tmpbuf, "your ");
- else {
+ else
Strcat(tmpbuf, "a ");
- }
#else
Strcpy(tmpbuf, "");
#endif
(void) root_plselection_prompt(eos(tmpbuf), buflen - strlen(tmpbuf),
rolenum, racenum, gendnum, alignnum);
+#if 0 /*JP*//*\93ú\96{\8cê\82Å\82Í\95s\97v*/
+ /* "Shall I pick a character's role, race, gender, and alignment for you?"
+ plus " [ynaq] (y)" is a little too long for a conventional 80 columns;
+ also, "pick a character's <anything>" sounds a bit stilted */
+ strsubst(tmpbuf, "pick a character", "pick character");
+#endif
#if 0 /*JP*/
Sprintf(buf, "%s", s_suffix(tmpbuf));
#else
if (num_post_attribs) {
if (pa[BP_RACE]) {
(void) promptsep(eos(buf), num_post_attribs);
-/*
+/*JP
Strcat(buf, "race");
*/
- Strcat(buf, "\8eí\91°");
+ Strcat(buf, "\8eí\91°");
}
if (pa[BP_ROLE]) {
(void) promptsep(eos(buf), num_post_attribs);
-/*
+/*JP
Strcat(buf, "role");
*/
- Strcat(buf, "\90E\8bÆ");
+ Strcat(buf, "\90E\8bÆ");
}
if (pa[BP_GEND]) {
(void) promptsep(eos(buf), num_post_attribs);
/*JP
Strcat(buf, "gender");
*/
- Strcat(buf, "\90«\95Ê");
+ Strcat(buf, "\90«\95Ê");
}
if (pa[BP_ALIGN]) {
(void) promptsep(eos(buf), num_post_attribs);
/*JP
Strcat(buf, "alignment");
*/
- Strcat(buf, "\91®\90«");
+ Strcat(buf, "\91®\90«");
}
}
/*JP
/* some generic user names will be ignored in favor of prompting */
if (sysopt.genericusers) {
- if (*sysopt.genericusers == '*') *plname = '\0';
- else {
- i = (int)strlen(plname);
- if ((sptr = strstri(sysopt.genericusers, plname)) != 0
- && (sptr == sysopt.genericusers || sptr[-1] == ' ')
- && (sptr[i] == ' ' || sptr[i] == '\0'))
- *plname = '\0'; /* call askname() */
- }
+ if (*sysopt.genericusers == '*') {
+ *plname = '\0';
+ } else {
+ i = (int) strlen(plname);
+ if ((sptr = strstri(sysopt.genericusers, plname)) != 0
+ && (sptr == sysopt.genericusers || sptr[-1] == ' ')
+ && (sptr[i] == ' ' || sptr[i] == '\0'))
+ *plname = '\0'; /* call askname() */
+ }
}
do {
Sprintf(buf, "%12s ", "alignment:");
*/
Sprintf(buf, "%12s ", "\91®\90«:");
+#if 0 /*JP:\93ú\96{\8cê\82Å\82Í\96¼\8e\8c\82ª\8e©\91R*/
Strcat(buf, (which == RS_ALGNMNT) ? choosing : (a == ROLE_NONE)
? not_yet
: (a == ROLE_RANDOM)
? rand_choice
-#if 0 /*JP:\93ú\96{\8cê\82Å\82Í\96¼\8e\8c\82ª\8e©\91R*/
: aligns[a].adj);
#else
+ Strcat(buf, (which == RS_ALGNMNT) ? choosing : (a == ROLE_NONE)
+ ? not_yet
+ : (a == ROLE_RANDOM)
+ ? rand_choice
: aligns[a].noun);
#endif
putstr(where, 0, buf);
if (flags.pantheon == -1) { /* new game */
flags.pantheon = flags.initrole; /* use own gods */
while (!roles[flags.pantheon].lgod) /* unless they're missing */
- flags.pantheon = randrole();
+ flags.pantheon = randrole(FALSE);
}
if (!urole.lgod) {
urole.lgod = roles[flags.pantheon].lgod;
*/
quest_status.godgend = !strcmpi(align_gtitle(alignmnt), "\8f\97\90_");
+#if 0
+/*
+ * Disable this fixup so that mons[] can be const. The only
+ * place where it actually matters for the hero is in set_uasmon()
+ * and that can use mons[race] rather than mons[role] for this
+ * particular property. Despite the comment, it is checked--where
+ * needed--via instrinsic 'Infravision' which set_uasmon() manages.
+ */
/* Fix up infravision */
if (mons[urace.malenum].mflags3 & M3_INFRAVISION) {
/* although an infravision intrinsic is possible, infravision
if (urole.femalenum != NON_PM)
mons[urole.femalenum].mflags3 |= M3_INFRAVISION;
}
+#endif /*0*/
/* Artifacts are fixed in hack_artifacts() */