Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More appropriate non-artifact sacrifice gifts #13

Merged
merged 2 commits into from
Jan 29, 2020
Merged

More appropriate non-artifact sacrifice gifts #13

merged 2 commits into from
Jan 29, 2020

Conversation

RikerW
Copy link
Contributor

@RikerW RikerW commented Jan 29, 2020

Ideally this will fix the following issues:

  • Giants and centaurs shouldn't be able to get armor they can't wear (should have been already fixed, cleaner now though)
  • Elves and orcs shouldn't get items whose material they hate (mainly elves with iron)
  • (minor issue) racial gear should only be given to that race (so a dwarf won't get an elven dagger), and if possible convert standard gear into racial (dagger -> elven dagger if you're an elf, spear -> orcish spear for orcs, etc.)

Does NOT touch the spellbook giving code at all, except maybe some whitespace. Tested as best I could, no crashes and it seems to work as intended.

Rarely, elf PCs with awful weapon skills (mainly rangers, seems like) can get REALLY unlucky rolls on weapons (and not get any). This is because the code just clears racial gear that doesn't match the race (so if they get an orcish one it won't convert to elven, just reroll completely), and if you happen to not land on a weapon you can use then you're out of luck. To compensate, the rolls has been upped to 1000 (and a debug message added if it bypasses that). This should only really be a problem with maybe rangers and rogues, anybody who doesn't get too many weapon skills (of weapons possible to get gifted, spear through katana).

Ideally this will fix the following issues:
 - Giants and centaurs shouldn't be able to get armor they can't wear (should have been already fixed, cleaner now though)
 - Elves and orcs shouldn't get items whose material they hate (mainly elves with iron)
 - (minor issue) racial gear should only be given to that race (so a dwarf won't get an elven dagger), and if possible convert standard gear into racial (dagger -> elven dagger if you're an elf, spear -> orcish spear for orcs, etc.)

Does NOT touch the spellbook giving code at all, except maybe some whitespace. Tested as best I could, no crashes and it seems to work as intended.

Rarely, elf PCs with awful weapon skills (mainly rangers, seems like) can get REALLY unlucky rolls on weapons (and not get any). This is because the code just clears racial gear that doesn't match the race (so if they get an orcish one it won't convert to elven, just reroll completely), and if you happen to not land on a weapon you can use then you're out of luck. To compensate, the rolls has been upped to 1000 (and a debug message added if it bypasses that). This should only really be a problem with maybe rangers and rogues, anybody who doesn't get too many weapon skills (of weapons possible to get gifted, spear through katana).
@k21971
Copy link
Owner

k21971 commented Jan 29, 2020

Thank you RikerW, this looks good!

@k21971 k21971 merged commit 6534ebe into k21971:master Jan 29, 2020
k21971 pushed a commit that referenced this pull request Sep 1, 2023
On GitHub issue 1090, Rhialto wrote:
Hi! I am currently in the process of adapting the pkgsrc packaging of NetHack 3.6.7 to include the curses window option. A bit late perhaps...

While working on that, I ran into a case of a NULL pointer being used. Apparently when linking with ncurses, this doesn't cause problems, but NetBSD's own curses doesn't like it, and crashes the game.

Here is the stack trace. It happens when #quitting, I think just before the high scores are about to be shown (but I guess it should show in the stack trace if I'm totally correct with that):

(gdb) bt
 #0  redrawwin (win=0x0) at /usr/src/lib/libcurses/touchwin.c:149
 #1  0x0000000017e104b4 in curses_refresh_nethack_windows () at ../win/curses/curswins.c:176
 #2  0x0000000017e1054a in curses_destroy_win (win=win@entry=0x7ad219520540) at ../win/curses/curswins.c:155
 #3  0x0000000017e1512c in curses_display_nhmenu (wid=<optimized out>, how=<optimized out>, _selected=0x7f7fff65d850) at ../win/curses/cursdial.c:771
 #4  0x0000000017e0ff81 in curses_select_menu (wid=wid@entry=21, how=how@entry=0, selected=selected@entry=0x7f7fff65d850) at ../win/curses/cursmain.c:607
 #5  0x0000000017e10257 in curses_display_nhwindow (wid=21, block=1) at ../win/curses/cursmain.c:385
 #6  0x0000000017ca8075 in really_done (how=<optimized out>, how@entry=13) at end.c:1609
 #7  0x0000000017ca993f in done (how=how@entry=13) at end.c:1201
 #8  0x0000000017ca9c85 in done2 () at end.c:381
 #9  done2 () at end.c:337
 #10 0x0000000017c489da in doextcmd () at cmd.c:363
 #11 0x0000000017c57e94 in rhack (cmd=<optimized out>, cmd@entry=0x0) at cmd.c:4909
 #12 0x0000000017c265da in moveloop (resuming=<optimized out>) at allmain.c:435
 #13 0x0000000017e1b862 in main (argc=<optimized out>, argv=<optimized out>) at ../sys/unix/unixmain.c:351
status_window is NULL here. Simply checking for NULL avoids the problem. I added checks for the other windows as well, while I was there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants