Allow monster level adjustments in special levels

Add a new parameter to des.monster, m_lev_adj, which is a level
adjustment for the monster.  This only applies to the monster's
level, so basically only affects the spellcasting, it does not
change the monster's hit die or inventory.

Change one of the shamans in Orctown to be 3 levels higher.
This commit is contained in:
Pasi Kallinen
2026-03-23 12:44:14 +02:00
parent 1ba9be09fa
commit c0f5d2dd92
5 changed files with 16 additions and 2 deletions

View File

@@ -130,8 +130,10 @@ for i=1,5 + math.random(1 - 1,1*10) do
end end
end end
-- shamans can be hanging out in/near the temple -- shamans can be hanging out in/near the temple
for i=1,math.random(2 - 1,2*3) do -- one of the shamans is higher level
des.monster({ id = "orc shaman", coord = near_temple:rndcoord(0), peaceful=0 }); for i=1,math.random(1,6) do
des.monster({ id = "orc shaman", coord = near_temple:rndcoord(0), peaceful=0,
m_lev_adj = (i == 1) and 3 or 0 });
end end
-- these are not such a big deal -- these are not such a big deal
-- to run into outside the bars -- to run into outside the bars

View File

@@ -1588,6 +1588,7 @@ priest donation amounts are explicitly stated, randomized slightly, based on
amulet of magical breathing increases power regeneration amulet of magical breathing increases power regeneration
change some command keys, 'v' is now chronicle, 'V' is versionshort, change some command keys, 'v' is now chronicle, 'V' is versionshort,
m-prefix 'V' is longer version, remove key binding of #history m-prefix 'V' is longer version, remove key binding of #history
one orc-town shaman has a higher level, affecting spellcasting
Fixes to 3.7.0-x General Problems Exposed Via git Repository Fixes to 3.7.0-x General Problems Exposed Via git Repository

View File

@@ -819,6 +819,7 @@ The hash parameter accepts the following keys:
| stunned | boolean | | stunned | boolean |
| confused | boolean | | confused | boolean |
| waiting | boolean | monster will wait until hero gets next to it | waiting | boolean | monster will wait until hero gets next to it
| m_lev_adj | integer | monster's level adjustment
| tail | boolean | generate worm without a tail? | tail | boolean | generate worm without a tail?
| group | boolean | generate a group of monsters? | group | boolean | generate a group of monsters?
| adjacentok | boolean | is adjacent location ok, if given one is not suitable? | adjacentok | boolean | is adjacent location ok, if given one is not suitable?

View File

@@ -145,6 +145,7 @@ typedef struct {
schar peaceful, asleep; schar peaceful, asleep;
short female, invis, cancelled, revived, avenge, fleeing, blinded, short female, invis, cancelled, revived, avenge, fleeing, blinded,
paralyzed, stunned, confused, waiting; paralyzed, stunned, confused, waiting;
short m_lev_adj;
long seentraps; long seentraps;
short has_invent; short has_invent;
mmflags_nht mm_flags; /* makemon flags */ mmflags_nht mm_flags; /* makemon flags */

View File

@@ -2165,6 +2165,14 @@ create_monster(monster *m, struct mkroom *croom)
if (vampshifted(mtmp) && m->appear != M_AP_MONSTER) if (vampshifted(mtmp) && m->appear != M_AP_MONSTER)
(void) newcham(mtmp, &mons[mtmp->cham], NO_NC_FLAGS); (void) newcham(mtmp, &mons[mtmp->cham], NO_NC_FLAGS);
} }
if (m->m_lev_adj) {
if (mtmp->m_lev + m->m_lev_adj > 49)
mtmp->m_lev = 49;
else if (mtmp->m_lev + m->m_lev_adj < 0)
mtmp->m_lev = 0;
else
mtmp->m_lev += m->m_lev_adj;
}
if (!(m->has_invent & DEFAULT_INVENT)) { if (!(m->has_invent & DEFAULT_INVENT)) {
/* guard against someone accidentally specifying e.g. quest nemesis /* guard against someone accidentally specifying e.g. quest nemesis
* with custom inventory that lacks Bell or quest artifact but * with custom inventory that lacks Bell or quest artifact but
@@ -3298,6 +3306,7 @@ lspo_monster(lua_State *L)
tmpmons.stunned = get_table_boolean_opt(L, "stunned", FALSE); tmpmons.stunned = get_table_boolean_opt(L, "stunned", FALSE);
tmpmons.confused = get_table_boolean_opt(L, "confused", FALSE); tmpmons.confused = get_table_boolean_opt(L, "confused", FALSE);
tmpmons.waiting = get_table_boolean_opt(L, "waiting", FALSE); tmpmons.waiting = get_table_boolean_opt(L, "waiting", FALSE);
tmpmons.m_lev_adj = get_table_int_opt(L, "m_lev_adj", 0);
tmpmons.seentraps = 0; /* TODO: list of trap names to bitfield */ tmpmons.seentraps = 0; /* TODO: list of trap names to bitfield */
keep_default_invent = keep_default_invent =
get_table_boolean_opt(L, "keep_default_invent", -1); get_table_boolean_opt(L, "keep_default_invent", -1);