Fix Missile obstruction checks #8351
Open
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.
Fixes: #6693
LineClearMissile()Monsters ask:
"Can I shoot the player?"
LineClear(PosOkMissile, start, end)PosOkMissile(tile)= true if the tile is notBlockMissile.CheckMissileCol()Missiles ask:
"Can I move through this tile?"
!IsMissileBlockedByTile(tile)BlockMissile_oMissFlag== falseTo remedy this, this PR adds a variant function called
LineClearMovingMissile(), which is exclusively used when we need to check if a missile would be able to make it between 2 points without hitting an obstruction according toCheckMissileCol().LineClearMissile()continues to be used for missiles that do not need to travel, such as Leoric summoning a minion at a position, or the player casting a Guardian at a position.This fix has edge cases due to differing logic between
LineClear()and how a missile moves along a path withMoveMissile(). This is the 2nd of the 4 needed fixes for the the problems with ranged monsters/ranged spells (like Guardian), and the 1st already has been merged back in 2023.1. Missile Space Distortion fix2. Same checks for missile path success and confirming missile path has no obstructions (This PR)
3. Same logic for missile path and confirming missile path has no obstructions
4. Ranged monster AI tweaks to prevent standing still with no valid line of sight for missiles