fix: AoE ammo hits NPCs once instead of spreading damage across all bodyparts #5387
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.
Checklist
Required
main
so it won't cause conflict when updatingmain
branch later.Optional
Purpose of change
This aims to tinker with ranged AoE cones to be a bit less wonky against NPCs, fixing one of the many issues affecting it currently.
Fixes #2989
Describe the solution
In ranged_aoe.cpp, converted the hit behavior of
execute_shaped_attack
to depriciateranged::hit_with_aoe
in favor of usingdeal_projectile_attack
. The idea here is make NPCs caught in the AoE only take a single hit to a random bodypart, withmissed_by
weighted more in favor of center mass.This specifically fixes the issue of the function in question dividing the total damage by number of bodyparts, which would turn an amount of damage instantly lethal to a zombie to peppering an NPC with mild annoyance.
Finally, deleted the
hit_with_aoe
function from ranged.cpp and ranged.h, asexecute_ranged_attack
was the only function using it.Describe alternatives you've considered
hit_with_aoe
to randomize how many body parts it hits instead of dividing up across all of them. I'm not sure if that'd really be worth it though.missed_by
value instead of making it random.Testing
Additional context
This doesn't yet re-add AoE to buckshot, since there are other issues with the code not yet sorted out, like gun range not adding to AoE cone length and ammo effect stuff not working right.