-
Notifications
You must be signed in to change notification settings - Fork 290
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 several pets AI bugs, add player homeostatic effect on pets #2177
Merged
Coolthulhu
merged 10 commits into
cataclysmbnteam:upload
from
leoCottret:fix-pets-AI-bugs
Nov 26, 2022
Merged
Fix several pets AI bugs, add player homeostatic effect on pets #2177
Coolthulhu
merged 10 commits into
cataclysmbnteam:upload
from
leoCottret:fix-pets-AI-bugs
Nov 26, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Maleclypse
added a commit
to Maleclypse/Cataclysm-DDA
that referenced
this pull request
Nov 12, 2022
Co-Authored-By: leoCottret <71428793+leoCottret@users.noreply.github.com>
Coolthulhu
reviewed
Nov 21, 2022
I-am-Erk
pushed a commit
to CleverRaven/Cataclysm-DDA
that referenced
this pull request
Nov 24, 2022
* Portions of cataclysmbnteam/Cataclysm-BN#2177 Co-Authored-By: leoCottret <71428793+leoCottret@users.noreply.github.com> * Update src/monster.cpp * Update src/monster.cpp * Update src/monster.cpp * Update src/monster.cpp Co-authored-by: David Seguin <davidseguin@live.ca> Co-authored-by: leoCottret <71428793+leoCottret@users.noreply.github.com> Co-authored-by: David Seguin <davidseguin@live.ca>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY; Bugfixes "Fix several pets AI bugs, add player homeostatic effect on pets"
Purpose of change
Fix some bugs linked to pets AI.
1 - monsters that are not angry flee if they took a single point of damage.
Example where it's annoying: a dog pet fight a bit with a zombie that barely scratched it, after the fight his anger goes down, and then for the next few hours it will run from everything since he's not at full health (and they heal slowly)
2 - the horse is afraid of litterally all the sounds (friendly animals, friendly player/NPCs, his own footsteps when mounted etc.)
3 - when angry or fleeing, but with no hostile targets in sight, pet animals will follow the player smell
4 - a tied horse that was mounted didn't get his tied state removed properly, which made it buggy when dismounted
Describe the solution
1 - reduce the fleeing threshold to 60% of max health
2 - horses are not afraid of sounds anymore (cf detailled explanation in "Describe alternatives you've considered")
3 - I found several solutions to fix the bug, but the most elegant solution I found was to transform this bug to make a feature out of it
4 - Remove the tied state when mounting the horse
Describe alternatives you've considered
I did thought of adding a feature that would allow monsters to have some kind of self preservation, but this will be in an other PR (...maybe).
About 2, my previous solution was "add a check to avoid processing the "sound fear" if it's a friendly monster and the sound comes from the player (barking sounds from friendly dogs could be added too)"
The big problem with this solution was the complexity behind it.
The horse was afraid of:
And on top of that, sometimes the horse can't see the sound origin, and in that case it's very hard to say if it should know if it comes from a friendly creature or not.
So at this complexe solution a simple fix, remove "SOUND" from fear_triggers, so that horses can stop being almost all the time at -100 morale (because yes, that's what happened...). It just doesn't work for pets.
Testing
I added a add_msg line with the moral and anger values of the PETS on the map, to see if the different fix worked (I'll remove it in the last commit).
Everything seemed to work perfectly (I tested it a lot while fixing the bugs).