Random figurines are of harder monsters

This commit is contained in:
Pasi Kallinen
2022-08-21 13:23:16 +03:00
parent 2b163d89b0
commit a9ca23e8f9
4 changed files with 22 additions and 4 deletions

View File

@@ -1598,6 +1598,13 @@ align_shift(register struct permonst *ptr)
/* select a random monster type */
struct permonst *
rndmonst(void)
{
return rndmonst_adj(0, 0);
}
/* select a random monster type, with adjusted difficulty */
struct permonst *
rndmonst_adj(int minadj, int maxadj)
{
register struct permonst *ptr;
register int mndx;
@@ -1608,8 +1615,8 @@ rndmonst(void)
return ptr;
zlevel = level_difficulty();
minmlev = monmin_difficulty(zlevel);
maxmlev = monmax_difficulty(zlevel);
minmlev = monmin_difficulty(zlevel) + minadj;
maxmlev = monmax_difficulty(zlevel) + maxadj;
upper = Is_rogue_level(&u.uz); /* prefer uppercase only on rogue level */
elemlevel = In_endgame(&u.uz) && !Is_astralevel(&u.uz); /* elmntl plane */

View File

@@ -323,13 +323,20 @@ mkbox_cnts(struct obj *box)
/* select a random, common monster type */
int
rndmonnum(void)
{
return rndmonnum_adj(0, 0);
}
/* select a random, common monster type, with adjusted difficulty */
int
rndmonnum_adj(int minadj, int maxadj)
{
register struct permonst *ptr;
register int i;
unsigned short excludeflags;
/* Plan A: get a level-appropriate common monster */
ptr = rndmonst();
ptr = rndmonst_adj(minadj, maxadj);
if (ptr)
return monsndx(ptr);
@@ -965,8 +972,9 @@ mksobj(int otyp, boolean init, boolean artif)
break;
case FIGURINE:
tryct = 0;
/* figurines are slightly harder monsters */
do
otmp->corpsenm = rndmonnum();
otmp->corpsenm = rndmonnum_adj(5, 10);
while (is_human(&mons[otmp->corpsenm]) && tryct++ < 30);
blessorcurse(otmp, 4);
break;