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

show possible monsters per level (feature)? #9

Open
runlow opened this issue Apr 14, 2021 · 1 comment
Open

show possible monsters per level (feature)? #9

runlow opened this issue Apr 14, 2021 · 1 comment

Comments

@runlow
Copy link

runlow commented Apr 14, 2021

Years ago I wrote a patch which upon a keypress would show all the possible monsters on the level. Similar to how pressing = shows you your rings - E (for "enemies") showed what monsters you could expect on the level. It was a bit more convenient than looking it up. Lost the code since unfortunately. Of course one could just memorise the monsters. While this would change how the game works - it's not changing core gameplay, I think it's still in the same spirit.

m or M (for "monsters") could work too but they seem to be already used - not quite sure for what but can look it up.

Let me know if you plan on adding stuff like this - if this is interesting/useful and within scope of the project - or if preferring to keep the game the way it was as long as it runs.

@runlow
Copy link
Author

runlow commented Apr 16, 2021

This seems to work well enough:

diff --git a/include/extern.h b/include/extern.h
index c2b6f4e..2b21125 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -131,0 +132 @@ void mv_aquatars();
+void mon_list();
diff --git a/src/monster.c b/src/monster.c
index 18c42b5..55acc30 100644
--- a/src/monster.c
+++ b/src/monster.c
@@ -764,0 +765,15 @@ void mv_aquatars() {
+
+void mon_list() {
+       char buf[30];
+       char list[11];
+       int c=0;
+       for (int i=0;i<MONSTERS;i++) {
+               if ((cur_level >= mon_tab[i].first_level) &&
+                       (cur_level <= mon_tab[i].last_level)) {
+                        list[c++]=mon_tab[i].m_char;
+               }
+               list[c] = 0;
+       }
+       sprintf(buf, "expect monsters: %s", list);
+       message(buf, 0);
+}
diff --git a/src/play.c b/src/play.c
index 4ce3bf7..94a26e8 100644
--- a/src/play.c
+++ b/src/play.c
@@ -98,0 +99,3 @@ CH:
+                       case 'M':
+                               mon_list();
+                               break;

Only small complaint is that with this the monsters aren't listed in the order that they appear and disappear from the pool, which is:
KEBSHIROZLCQANYFTWPXUMVGJD

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

No branches or pull requests

1 participant