Check for damage invulnerability when simulating overcast #854
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.
Normally since overcast bypasses invuln this should never trigger, but weird interactions with mods can happen, like FAPI FakePlayers being invulnerable to all damage.
This checks for the sole exception of isInvulnerableTo checked by trulyHurt, so it should close the loophole as trulyHurt will forcibly set target's HP if it's invulnerable using another method.
This still has a possible TOCTTOU for free overcast, but it should be rare enough that it's not practically feasible to exploit.
Should replace #850, as create deployers, at least on fabric, should be denied simulated-overcast via this check.