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

Fix: pets inherited the hero's ability to zombify #176

Closed
wants to merge 4 commits into from

Conversation

entrez
Copy link
Collaborator

@entrez entrez commented May 24, 2024

Since pets can grant the hero XP by going through mon_xkilled ->
xkilled, which assessed possible zombification of the killed monster
based on youmonst, etc, a pet dog could end up creating zombies if its
owner was in a state to create zombies herself (due to polymorph, race,
etc). Add a bit to xkill_flags to prevent this and assess zombification
based on the value of the 'zombify' global set in mhitm.c, as happens
with non-pet mon vs mon control flow that goes through monkilled().

entrez added 4 commits May 24, 2024 18:07
Since pets can grant the hero XP by going through mon_xkilled ->
xkilled, which assessed possible zombification of the killed monster
based on youmonst, etc, a pet dog could end up creating zombies if its
owner was in a state to create zombies herself (due to polymorph, race,
etc).  Add a bit to xkill_flags to prevent this and assess zombification
based on the value of the 'zombify' global set in mhitm.c, as happens
with non-pet mon vs mon control flow that goes through monkilled().
Add XKILL_FROMPET, and there was no need to give the specific values of
the macros anyway compared to their names.  I don't really remember if
this is the proper "K&R era NetHack style" way to format a multiline
comment on a function parameter, but hopefully it makes sense.
The mon_xkilled -> xkilled flow was not including XKILL_NOCONDUCT, so
would count against pacifist.  Since there's now a dedicated flag to
indicate xkilled was called via mon_xkilled, just consider that to be a
secondary way to prevent xkilled from breaking pacifist.
@entrez
Copy link
Collaborator Author

entrez commented May 24, 2024

Beyond the original scope of the PR, but I also added that additional commit re: mon_xkilled->xkilled breaking pacifist -- I assume that wasn't deliberate (and that I am understanding the code right, that it would break pacifist, because I didn't actually test it). Commenting to highlight it just to make sure about those assumptions.

@k21971
Copy link
Owner

k21971 commented May 24, 2024

Beyond the original scope of the PR, but I also added that additional commit re: mon_xkilled->xkilled breaking pacifist -- I assume that wasn't deliberate (and that I am understanding the code right, that it would break pacifist, because I didn't actually test it). Commenting to highlight it just to make sure about those assumptions.

You assume correctly. Good catch.

@entrez
Copy link
Collaborator Author

entrez commented May 25, 2024

I'm closing this after IRC discussion because there were some assumptions made here that were wrong (e.g. that mon_xkilled applied to more than just summoned spheres), and I think it'd be better to reapproach it from scratch rather than try to rebase and force-push this. Consequence of shooting first and asking questions later, which seems to surprisingly be a bad dev practice!

@entrez entrez closed this May 25, 2024
@entrez entrez deleted the fix_pet_inheriting_hero_zombifying branch May 26, 2024 16:13
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