Commit Graph

16339 Commits

Author SHA1 Message Date
nhkeni
bacfa6ef40 More lua setup cleanup
Stop (poorly) tracking the amount of memory in use and get
 it from Lua instead.
Simplify nhl_alloc.
2024-01-17 15:04:40 -05:00
nhmall
a82317e364 update tested versions of Visual Studio 2024-01-17 2024-01-17 12:28:33 -05:00
Pasi Kallinen
5d28e24477 Some lua state allocator fixes
Run GC on the themeroom lua states, as they're not freed
until end of game.

Allocate the exact amount of data we use instead of padding it.

Free our state data after closing the lua state; doing it
the other way is the way to madness, which was kept at bay
by the padded allocation amount.
2024-01-17 17:41:44 +02:00
PatR
6b8079a16f secondary damage for monster spell attacks
Have monster spells
| "shower of missiles" (AT_MAGC+AD_MAGM: Angels, Yeenoghu)
scuff an engraving at the hero's spot if there is one,
| "frost" (AT_MAGC+AD_COLD: only Asmodeus)
freeze water and lava terrain,
| "flames" (AT_MAGC+AD_FIRE: moot, no monster has this attack)
burn items on the floor at the hero's spot and melt ice terrain,
| "pillar of flame" (AT_MAGC+AD_CLRC+randomly chosen clerical spell)
which already burns floor items, melt ice too, and
| "lightning" (same casters as pillar of flame)
give a tiny chance of destroying iron bars.  The chance to hit bars
is low and the hero has to be targeted while located on an iron bars
spot so probably won't happen before the sun burns out, but only
needed one extra line of code.

Only the first two have been thoroughly tested.
2024-01-16 14:01:38 -08:00
PatR
a5c7fede99 mcastu()'s monst->mspec_used usage
Replace some suspicious mixing of signed and unsigned.
2024-01-16 10:19:00 -08:00
nhmall
c134a128ac rephrase rotten metal
Resolves #1202
2024-01-15 17:58:11 -05:00
PatR
8111a7aff2 covetous monster tactics on completely full level
If a covetous monster tried to teleport adjacent to the hero but the
level was too full to move it from its current spot, it would be
sent off level to wait for the hero to leave and return instead just
staying put.
2024-01-15 14:25:06 -08:00
Pasi Kallinen
1c16ef68eb Fix spot_monsters giving a segfault in some cases 2024-01-15 20:53:24 +02:00
PatR
40e919dbf9 github issue #1200 - erronenous engraving feedback
Issue reported by chappg:  if a monster or object covered an engraving,
examining that monster or object with farlook would include the text
of the engraving even though it wasn't the thing being examined.

The report was for a bones level but that only mattered because it was
a ghost on top of a grave (and the engraving on its headstone) that was
being examined; bones data itself wasn't pertinent.  It would happen
with any engraving once the spot was mapped as an engraving or a grave
provided that something else was currently displayed at the location.

Bug was introduced by commit 389f03e90e
two months ago.  Mea culpa.

Closes #1200
2024-01-15 02:56:26 -08:00
Pasi Kallinen
9745121137 fixes entry for the accessibility options 2024-01-15 11:00:21 +02:00
PatR
e4534d60e3 more Forcefighting webs
Hero attempting to cut an adjacent web can so with secondary weapon
if dual wielding and primary isn't a blade.

Mostly message handling for the 'neither weapon is a blade' situation.
2024-01-14 16:58:43 -08:00
Pasi Kallinen
ccfcc32843 Message location for monster wielding an item 2024-01-14 17:43:27 +02:00
Pasi Kallinen
679c312d4d Message location for monster hurling a potion 2024-01-14 17:21:48 +02:00
nhmall
bbb7523a04 vestiges of C(color) 2024-01-14 08:57:28 -05:00
Pasi Kallinen
3160112ece Accessibility: Show a message when monster is spotted
Adds a new boolean option, spot_monsters.  If on, every time
the hero notices a monster which was out of sight before,
a message is given.  Combine with accessiblemsg to get the
monster location:

(3north): You see a newt.

Breaks saves and bones.
2024-01-14 13:33:02 +02:00
PatR
627b40fb57 redo monsters.h
Change MON(name, ...) to MON(NAM(name), ...) and get rid of MON3(),
replacing it with MON(NAMS(malename,femalename,neutername), ...).
That eliminates the macro which uses 16 parameters.  Standard C
allows compilers to impose a limit of 15, rejecting 16 or more while
still being in compliance.

That necessitated some reformatting since it made the first line of
each entry longer.  Shorten that by having all entries start with
name(s) and symbol on the first line, then LVL() and generation flags
on the second line, then attacks start on the third.

Reformat attacks to change ATTK(one) + 4 * NO_ATTK on one line plus
an orphaned NO_ATTK on the next line to always use ATTK(one) on first
line and all 5 NO_ATTKs on the next line.  Similarly, change ATTK(1of2)
ATTK(2of2) NO_ATTK on one line followed by 3 * NO_ATTK on the next line
into ATTK(1of2) ATTK(2of2) followed by 4 NO_ATTKS.  For three attacks,
list two on the first line then the third and 3 * NO_ATTK on the next.
Four or more attacks use a third line; ATTK(1of4+) ATTK(2of4+) on the
first, ATTK(3of4+) ATTK(4of4+) on the second, and whatever's left on
the third.  SIZ() follows on its own line for each of the cases.

Split the final line of each entry so that the difficulty value is the
first thing on that line, followed by color and enum tag.  This may or
may not make moving the difficulty into LVL() easier someday (which
would have been an alternate way to reduce the 16 args that MON3 had).

The file gets stretched out by many lines but entries should be easier
to read (matter of taste, I suppose).

I didn't attempt to clean up M1_foo, M2_bar, M3_quux; too hard....
I also didn't touch SIZ() or resistances which are less cluttered than
the other stuff.
2024-01-12 17:06:47 -08:00
PatR
7b204b72bb fix comment typo 2024-01-12 14:17:50 -08:00
PatR
df6e67f178 mons[NUMMONS] tweak
Add a couple of non-zero permonst flags to the terminator at the end
of mons[] in case some code using a pointer to mons[NUMMONS] for "not
a monster" unexpectedly references them.

Also, eliminate some obsolete handling for conditional color support
from monst.c.
2024-01-12 12:42:44 -08:00
PatR
4609f23332 lua timer fix
Commit 7a533a911c about three weeks
ago reordered a couple of timers.  The list of timers in nhlua.c was
overlooked at the time.

The theme room "Ice room" was affected.  I'm surprised that sanity
checking while running the fuzzer didn't notice and complain.
2024-01-12 11:31:48 -08:00
nhmall
6274ad3259 whitespace adjustment src/nhlua.c
I noticed some tabs had crept into the file, so adjust the whitespace.
2024-01-12 12:33:26 -05:00
nhkeni
aebc666efa clean up lua error message, catch failed lua_newstate call 2024-01-12 11:06:25 -05:00
Pasi Kallinen
32adc3a092 Split #turn undead monster iteration function 2024-01-12 14:43:50 +02:00
nhmall
213302d973 check def_monsyms[], def_oc_syms[] index
Resolves #1179
2024-01-11 20:13:02 -05:00
nhmall
9a0f9b37cb Merge branch 'fix-windows' of https://github.com/argrath/NetHack into NetHack-3.7 2024-01-11 19:50:12 -05:00
nhmall
97e4c0f34a another comment bit 2024-01-11 14:44:58 -05:00
nhmall
2fa996eb19 comment update/clarification 2024-01-11 14:19:28 -05:00
nhmall
25a8c258e6 replace x >= LOW_PM with ismnum(x) shorthand macro 2024-01-11 14:01:10 -05:00
Pasi Kallinen
58031920dc Fix monsters using escape items unnecessarily
Monsters were using escape items when they couldn't move due to
being surrounded by other monsters.  This was most evident in
Fort Ludios, where the alarm woke up all the monsters and they
would then read all the teleport scrolls.

Usually this doesn't matter, as special rooms full of monsters
are asleep.

Hardcode this fix for the Ludios only, otherwise you could trap
two monsters next to each other in a boulder fort, and they
would be happy to stay in there...
2024-01-11 19:31:37 +02:00
nhmall
f4055c5bc5 Merge branch 'toss_up_fix' of https://github.com/mkuoppal/NetHack into NetHack-3.7 2024-01-11 12:04:38 -05:00
PatR
02c675078b PR #1150 - rework erinyes into avenging Furies
Pull request from entrez:  change erinyes from lame devils named
after the Furies of Greek myth into those Furies.

Bumps EDITLEVEL because of changes to saved data.  I augmented the
new data.base entry.

Closes #1150
2024-01-10 23:22:56 -08:00
Michael Meyer
ef80549c70 Add true rumor about erinyes and alignment abuse
I don't think this entirely gives the game away, but strongly suggests a
connection between bad deeds and how dangerous erinyes are (especially
combined with the new erinys encyclopedia entry).
2024-01-10 23:01:53 -08:00
Michael Meyer
f42250eb9d Eliminate magic numbers from uchangealign() 2024-01-10 22:59:18 -08:00
Michael Meyer
cd04780907 Add randomness to HoOA erinyes summoning
When not on Astral, make it a roll based on alignment abuse whether an
erinys is summoned.  Also make helm of opposite alignment use contribute
to alignment abuse, so that repeated uses to attempt to clear erinyes
before astral will make them stronger.
2024-01-10 22:57:12 -08:00
Michael Meyer
69b2523cfb Add new erinys encyclopedia entry 2024-01-10 22:57:12 -08:00
Michael Meyer
10a1befcf9 Teleport-control monsters resist being teleported
This makes sense to me, and further increases the challenge of erinyes
being summoned on astral after donning a helm of opposite alignment (if
the player has abused his alignment to the extent that erinyes have
teleport control), since they wouldn't be able to be banished across the
map simply by breaking a wand of teleport control.
2024-01-10 22:57:11 -08:00
Michael Meyer
6d29efcf04 Require a clear head to #offer
This will increase the potential challenge involved in donning a helm of
opposite alignment on Astral, now that it confuses the hero -- it means
that you must spend at least a turn after putting on the helm clearing
the confusion.  Since putting on the helm of opposite alignment may also
summon erinyes, this hopefully turns it from a situation where it's a
no-brainer to immediately ditch them by #offering the Amulet of Yendor
into one where the player must actually stop and think a little bit.
2024-01-10 22:57:11 -08:00
Michael Meyer
0c9e34832c Make HoOA confuse the hero, summon erinyes
A helmet psychically reaching inside your head and twiddling knobs in
your brain must be a confusing experience.  And the instant rejection of
your god (not to mention the vow that you made to find the amulet for
them), perhaps on the very cusp of their ascendance over the other gods,
is sort of the ultimate oathbreaking, so it interests the erinyes.
2024-01-10 22:57:10 -08:00
Michael Meyer
f930a12fba Make erinyes scale with alignment abuse
Consistent with their mythological role of punishing those who had
violated societal taboos -- oathbreakers, hosts who attacked their
guests, etc -- erinyes scale with the cumulative amount of alignment
abuse the hero has committed over the course of the game.  This is
tracked separately from the alignment record, and cannot be cleared by
the hero improving her favor with her god via "good deeds" as the normal
alignment record can.  Erinyes will gain abilities, levels, and attacks
as the hero's alignment abuse worsens.  They will also aggravate
monsters when near the hero.
2024-01-10 22:57:10 -08:00
PatR
32f3f7cf46 Forcefighting webs (when adjacent, not trapped)
ACURR(A_STR) can yield a value as high as 125.  Switch to acurrstr()-2
for a value of 1..19.

P_SKILL(skilltype) shouldn't be used unconditionally.  It yields a
different value for restricted than for unskilled and those two skill
levels only differ for training, not effectiveness.

Allow weaponless forcefight againsta webs.  The chance for success may
need to be tweaked.
2024-01-10 12:24:05 -08:00
Pasi Kallinen
9ab4d65431 Make force-fighting a web train the weapon
... and the skill matter a little bit for actually cutting the web.
2024-01-10 17:44:56 +02:00
Mika Kuoppala
91781ef0a6 dothrow: Check for LOW_PM before accessing mon array
on toss_up() when checking for touch_petrifies, add
a check for corpsenm >= LOW_PM as EGG can be without
corpse reference.

This prevents:
dothrow.c:1266:29: runtime error: index -1 out of bounds for type 'permonst [384]'
2024-01-10 17:26:38 +02:00
PatR
3f3d5b7bda mktrap() flags
This started out as a fix for a comment typo, then morphed a bit....
2024-01-09 17:17:19 -08:00
PatR
d672ea3051 remove redundant mktrap() tests
The 'tm' and 'croom' ?: tests introduced to this sprintf() a couple
of days ago will both always yield their else clause because execution
will only get into the block when they're Null (due to
  if (!tm && !croom && ...) {}
that isn't visible in the diff's context).
2024-01-09 16:36:50 -08:00
PatR
3a8971cc17 more invocation handling
While testing the wall crumbling message TODO yesterday, I saw a
case where the top line of the moat around the invocation area was
truncated even through there were 3 lines of map (on a cavernous
level rather than maze one) above where it cut off.  This improves
things although it may not be 100% correct.

Picking the invocation position is unchanged, so there should be no
risk of it now being positioned too close to the map edge.  It's
possible that it has been farther away from the edge than necessary
though; if so, it will still be.
2024-01-09 12:07:24 -08:00
PatR
0333495b8b DO mkinvokearea() TODO
When performing the invocation, you would get
|The floor shakes violently under you!
|The walls around you begin to bend and crumble!
even if all the nearby walls had been dug away or the level's maze was
made of lava pools instead of walls.  Suppress the second message when
it isn't applicable.
2024-01-09 00:41:35 -08:00
PatR
9cb270d4ca mktrap() sanity-adjacent
Log an error if the argument combination passed to mktrap() will never
place a trap.  Based on the code being used in the latter part of the
routine.
2024-01-09 00:24:51 -08:00
PatR
86f4afa780 sp_lev.c lava tweaks
Some bits I noticed while looking for something else.
2024-01-09 00:04:43 -08:00
nhmall
52940a4620 inappropriate null sobj check - pull request 1173 2024-01-08 23:59:41 -05:00
nhmall
a764d4fd61 Merge branch 'fix-detect' of https://github.com/argrath/NetHack into NetHack-3.7 2024-01-08 23:45:53 -05:00
Mika Kuoppala
0ca1a1ca8e src/trap: Fix isclearpath out of bound access on levl array
Do isok check apriori to accessing the levl array to filter
out dx/dy that have grown too large.

This fixes:
trap.c:3455:19: runtime error: index 80 out of bounds for type 'rm [80][21]'
2024-01-09 01:18:17 +02:00