more github issue #679 - orc strength

Handle alternate values for hero poly'd into a 'strongmonst' form
more thoroughly by propagating max values other than 18/100 to the
attribute manipulation routines.

ATTRMAX(A_STR), which used to be a relatively simple expression, now
contains a function call.

Along the way, change the races[] terminator's value for 'mnum' from
0 (giant ant) to NON_PM.
This commit is contained in:
PatR
2022-10-12 02:05:32 -07:00
parent b01fd1b849
commit 02cfdfee30
4 changed files with 90 additions and 50 deletions

View File

@@ -676,7 +676,7 @@ const struct Race races[] = {
{ 1, 0, 1, 0, 1, 0 } /* Energy */
},
/* Array terminator */
{ 0, 0, 0, 0 }
{ 0, 0, 0, 0, { 0, 0 }, NON_PM }
};
/* Table of all genders */
@@ -1697,11 +1697,10 @@ role_selection_prolog(int which, winid where)
: !*g.plname ? not_yet : g.plname);
putstr(where, 0, buf);
Sprintf(buf, "%12s ", "role:");
Strcat(buf, (which == RS_ROLE) ? choosing : (r == ROLE_NONE)
? not_yet
: (r == ROLE_RANDOM)
? rand_choice
: roles[r].name.m);
Strcat(buf, (which == RS_ROLE) ? choosing
: (r == ROLE_NONE) ? not_yet
: (r == ROLE_RANDOM) ? rand_choice
: roles[r].name.m);
if (r >= 0 && roles[r].name.f) {
/* distinct female name [caveman/cavewoman, priest/priestess] */
if (gend == 1)
@@ -1713,25 +1712,22 @@ role_selection_prolog(int which, winid where)
}
putstr(where, 0, buf);
Sprintf(buf, "%12s ", "race:");
Strcat(buf, (which == RS_RACE) ? choosing : (c == ROLE_NONE)
? not_yet
: (c == ROLE_RANDOM)
? rand_choice
: races[c].noun);
Strcat(buf, (which == RS_RACE) ? choosing
: (c == ROLE_NONE) ? not_yet
: (c == ROLE_RANDOM) ? rand_choice
: races[c].noun);
putstr(where, 0, buf);
Sprintf(buf, "%12s ", "gender:");
Strcat(buf, (which == RS_GENDER) ? choosing : (gend == ROLE_NONE)
? not_yet
: (gend == ROLE_RANDOM)
? rand_choice
: genders[gend].adj);
Strcat(buf, (which == RS_GENDER) ? choosing
: (gend == ROLE_NONE) ? not_yet
: (gend == ROLE_RANDOM) ? rand_choice
: genders[gend].adj);
putstr(where, 0, buf);
Sprintf(buf, "%12s ", "alignment:");
Strcat(buf, (which == RS_ALGNMNT) ? choosing : (a == ROLE_NONE)
? not_yet
: (a == ROLE_RANDOM)
? rand_choice
: aligns[a].adj);
Strcat(buf, (which == RS_ALGNMNT) ? choosing
: (a == ROLE_NONE) ? not_yet
: (a == ROLE_RANDOM) ? rand_choice
: aligns[a].adj);
putstr(where, 0, buf);
}
@@ -2078,4 +2074,17 @@ Goodbye(void)
}
}
/* if pmindex is any player race (not necessarily the hero's),
return a pointer to the races[] entry for it */
const struct Race *
character_race(short pmindex)
{
const struct Race *r;
for (r = races; r->mnum >= LOW_PM; ++r)
if (r->mnum == pmindex)
return r;
return (const struct Race *) NULL;
}
/* role.c */