-
Notifications
You must be signed in to change notification settings - Fork 8
[WIP] Add RTP monster #75
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
base: master
Are you sure you want to change the base?
[WIP] Add RTP monster #75
Conversation
libnethack/include/rtp.h
Outdated
|
||
#define RTP_NAME_COUNT 16 | ||
|
||
// These are added in order of when I got permission |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nobody in the future will care. Just alphabetically sort these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, just to note that also adds complexity if any more female RTP names are added because the macro below will need to be updated instead of just adding a new check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please detail in your commit message how you tested these changes.
libnethack/include/rtp.h
Outdated
void player_killed_rtp(struct level *lev); | ||
|
||
struct obj *create_rtp_corpse(struct level *lev, int x, int y, enum rng rng); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a comment to demarcate which if statement this endif goes to. E.g.
#endif // RTP_H
libnethack/include/rtp.h
Outdated
// future | ||
|
||
// The expanded format for this should be something like ((i == 1) || (i == 17)) | ||
#define FEMALE_RTPS(i) ((i == 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ew. Gross. Please don't hard-code the indexes of female RTPs, especially not using a macro.
This is easy to fix by declaring the array I mentioned above with a struct. E.g.
#include <stdbool.h>
...
const struct {
const char * const name;
const bool female;
} rtps[] = {
{ "Liam Middlebrook", /*female=*/false },
{ "Stephanie Miller", /*female=*/true },
...
};
libnethack/src/mon.c
Outdated
pline("You murderer!"); | ||
if (Blind && !Blind_telepat) | ||
see_monsters(FALSE); /* Can't sense monsters any more. */ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrectly aligned closing bracket
libnethack/src/rtp.c
Outdated
struct monst * | ||
name_rtp(struct monst *mtmp) | ||
{ | ||
const char* rtpNames[RTP_NAME_COUNT] = RTP_NAMES; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a local static array as discussed for rtp.h
libnethack/include/rtp.h
Outdated
#define RTP_NAME_COUNT 16 | ||
|
||
// These are added in order of when I got permission | ||
#define RTP_NAMES { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turn this into a local static array in the only place you use it.
struct monst *name_rtp(...) {
static const char * const rtp_names[] = {
"Liam Middlebrook",
"Stephanie Miller",
"McSaucy",
"Russ Harmon",
"Jordan Rodgers",
"Ethan House",
"Rob Glossop",
"Grant Cohoe",
"Steve Greene",
"William Dignazio",
"Chris Lockfort",
"Will Orr",
"Derek Gonyeo",
"Kevin Thompson",
"Angelo DiNardi",
"Dan Willemsen"
};
static const size_t num_rtp_names = sizeof(rtp_names);
...
}
|
||
// In the future this should be a random selection from a slew of different | ||
// items ranging in usefulness. | ||
obj = mksobj_at(MAGIC_MARKER, lev, x, y, TRUE, FALSE, rng); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the Potter level the only place an RTP will spawn? Otherwise this seems potentially game-breakingly powerful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm willing to discuss different item options. Perhaps we could make the magic marker have a very low drop chance?
libnethack/src/sounds.c
Outdated
@@ -810,6 +810,26 @@ domonnoise(struct monst *mtmp) | |||
else | |||
verbl_msg = "Who do you think you are, War?"; | |||
break; | |||
case MS_RTP: | |||
{ | |||
static const char *const rtp_foe_msg[3] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't specify array size when initializing with {}
. It is inferred automatically.
libnethack/src/sounds.c
Outdated
"What about our imagine subscription?", | ||
"I can ensure everything is down...", | ||
"See if you can go to sleep now.", | ||
}, *const rtp_pax_msg[8] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This declaration is already long enough without needing to declare multiple arrays. Do this on a separate line.
libnethack/src/sounds.c
Outdated
"I wasn't saturating the upload on 49net...", | ||
"I can't remember how I fixed it.", | ||
}; | ||
verbl_msg = mtmp->mpeaceful ? rtp_pax_msg[rn2(8)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use rn2(sizeof(rtp_pax_msg) - 1)
to infer the size of the array automatically. Also create separate variables for the size of the two arrays so it's clear to the reader what's going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed this behavior to use sizeof
as you recommend, but it's important to note that the input value to rn2
is max_plus_1
so rn2(10)
can only return results within the range 0-9.
Creates a new level 10 monster resembling a Computer Science House Root Type Person. RTPs will cause bad fate to fall upon the player when they are killed byt the player. However unless the player does something to anger them, RTPs are peaceful. Add 1 RTP spawn on Potter Level RTP names are automatically chosen from a list of RTPs. Inspired-by: ComputerScienceHouse/bingehack#66
228f247
to
7bc17a3
Compare
I'll amend the commit (hopefully) soon to include my testing methods. I'll also likely change around how the random selection of consequences happens. I'm hesitant to make each individual consequence a separate rng call, because I don't want to risk things getting called extremely rarely because of how the rng-engine works. So I'd appreciate if you have any thoughts on the matter. I was thinking having 2 or 3 rng values and then doing calculations from those on whether or not a consequence would be activates. |
I'd appreciate some feedback on balancing out the effects of killing an RTP.