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

@@ -1014,6 +1014,7 @@ when breaking a wand of sleep hits the hero with the explosion, don't describe
expose fuzz tester to wizard-mode as #debugfuzzer extended command
monsters which cannot move due to boulders or walls try to escape
intelligent monsters see and remember when others trigger traps
random figurines are of harder monsters
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -1275,6 +1275,7 @@ extern void dealloc_mextra(struct monst *);
extern struct monst *makemon(struct permonst *, coordxy, coordxy, mmflags_nht);
extern struct monst *unmakemon(struct monst *, mmflags_nht);
extern boolean create_critters(int, struct permonst *, boolean);
extern struct permonst *rndmonst_adj(int, int);
extern struct permonst *rndmonst(void);
extern struct permonst *mkclass(char, int);
extern struct permonst *mkclass_aligned(char, int, aligntyp);
@@ -1433,6 +1434,7 @@ extern struct obj *mkobj_at(char, coordxy, coordxy, boolean);
extern struct obj *mksobj_at(int, coordxy, coordxy, boolean, boolean);
extern struct obj *mksobj_migr_to_species(int, unsigned, boolean, boolean);
extern struct obj *mkobj(int, boolean);
extern int rndmonnum_adj(int, int);
extern int rndmonnum(void);
extern boolean bogon_is_pname(char);
extern struct obj *splitobj(struct obj *, long);

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;