Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix z-level melee attack difference problems (with testing code) (#48245
) * added sees check and debugmsg (cherry picked from commit 752f0c4) * Update src/monster.cpp Co-authored-by: anothersimulacrum <[email protected]> (cherry picked from commit da7c760) * excempt stairs&ramps from vision check (cherry picked from commit 152980e) * monster::melee_attack returns false for zlvl violations (cherry picked from commit cc7b3b7) * Require daytime for sees in monster_attack test. Make sure there should be enough light for things to be visible; weather might also need checking. (cherry picked from commit 6d253c9) * Set time to daytime. It wasn't previously (see results of REQUIRE). (cherry picked from commit 321404f) * Move forward by 2 hours. It gets set to daytime, but isn't? (cherry picked from commit 592d0c1) * See if can get info on hour of day. (cherry picked from commit ea65b7e) * Try again on checking hour of day. (cherry picked from commit 874bccf) * Blasted parenthesis. In case you're wondering why I don't seem to be compiling locally before sending things - even with everything else already present as an object file, the version+ar+compiling the test+putting together the test executable still takes something like 5-10 minutes... (cherry picked from commit 23e1394) * Template problem I'm still learning my way around C++ where it differs from C. (cherry picked from commit 1282f44) * Set weather, update sight limits If this doesn't work, I'll try the steps in vision_test.cpp. (cherry picked from commit 2062bbc) * Wipe visibility, map caches in monster_attack This is in case something is left over in one of these caches that's causing problems. (cherry picked from commit ce394e2) * Set WEATHER_NULL for weather_override in tests This sets weather_override to WEATHER_NULL in two places, namely after (if no exceptions occur!) the monster_attack test and before the weather realism test. The former should be replaced by scoped_weather_override (#48227) after that's been merged. (cherry picked from commit dcacb3d) * Use scoped_weather_override in monster_attack test Simply doing get_weather().weather_override = WEATHER_NULL at the end is not sufficient, since it will not be run in the event of an exception, such as from Catch2. (cherry picked from commit 49d5f24) * Wrong syntax for scoped_weather_override. As mentioned before, I'm still learning regarding C++ differences from C. (cherry picked from commit c90ae42) * Start on unifying sees requirement with testing This is a unification of most of #47993 with most of #48202, in an attempt to remove problems (seen in #42845, which this hopefully will fix) with players unable to see monsters on different z-levels (and, as it turns out, the other way around) but they are still able to attack the player. This is additionally complicated by that, when fov_3d is enabled, the player can see the monsters and vice-versa, and they should be able to attack each other (when at an appropriate distance). * Use is_adjacent with fov_3d for melee attacks This changes the melee_attack code in melee.cpp for Character::melee_attack to consider non-adjacent anything across z-levels when fov_3d is false. (It is possible that an actual sees check will be needed, but let's see how this does - no pun intended.) reach_attack may be a problem still. Co-authored-by: Jamuro-g <[email protected]> Co-authored-by: Jamuro-g <[email protected]> Co-authored-by: actual-nh <[email protected]>
- Loading branch information