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

[WIP] Add RTP monster #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

liam-middlebrook
Copy link
Member

I'd appreciate some feedback on balancing out the effects of killing an RTP.


#define RTP_NAME_COUNT 16

// These are added in order of when I got permission
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

@eatnumber1 eatnumber1 left a 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.

void player_killed_rtp(struct level *lev);

struct obj *create_rtp_corpse(struct level *lev, int x, int y, enum rng rng);
#endif
Copy link
Member

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

// future

// The expanded format for this should be something like ((i == 1) || (i == 17))
#define FEMALE_RTPS(i) ((i == 1))
Copy link
Member

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 },
  ...
};

pline("You murderer!");
if (Blind && !Blind_telepat)
see_monsters(FALSE); /* Can't sense monsters any more. */
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrectly aligned closing bracket

struct monst *
name_rtp(struct monst *mtmp)
{
const char* rtpNames[RTP_NAME_COUNT] = RTP_NAMES;
Copy link
Member

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

#define RTP_NAME_COUNT 16

// These are added in order of when I got permission
#define RTP_NAMES { \
Copy link
Member

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);
Copy link
Member

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.

Copy link
Member Author

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?

@@ -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] = {
Copy link
Member

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.

"What about our imagine subscription?",
"I can ensure everything is down...",
"See if you can go to sleep now.",
}, *const rtp_pax_msg[8] = {
Copy link
Member

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.

"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)]
Copy link
Member

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.

Copy link
Member Author

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
@liam-middlebrook
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants