Skip to content
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

Compute monster toHit on the fly #7567

Merged
merged 1 commit into from
Nov 28, 2024

Conversation

StephenCWills
Copy link
Member

For context, refer to #7433 (reply in thread) and the comments that follow.

Because monster order has changed between vanilla and the current version of DevilutionX, we can't rely on the fact that monster toHit was already initialized. Otherwise, we will end up using the wrong monster's toHit value if we load a vanilla savegame.

It seems the reason we don't use the value from the save file is because we don't want to inherit erroneous values from vanilla due to the bug that applies difficulty bonuses twice. In that case, it's better to compute the value on the fly, like with Monster::level().

However, we can't entirely do away with the toHit variable because a Golem's hit chance depends on the player character's stats at the time the spell was cast. I had to keep the variable but renamed it to golemToHit to avoid naming conflicts. The toHit() function simply returns the golemToHit value if the monster is a golem.

@AJenbo AJenbo merged commit 6215de6 into diasurgical:master Nov 28, 2024
22 checks passed
@StephenCWills StephenCWills deleted the compute-to-hit branch November 28, 2024 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants