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
Exploit: Undead orc priest can die from fall damage #224
Conversation
Was there already some suggestion on how that can be ensured? I heard about this "trick". You can somehow make him walk off the cliff. But I don't know how to trigger it. The circumstances might be important to understand the problem. |
you can see it in the video. |
I wasn't able to reproduce the test case yet, because I lose focus before the undead orc hits the ground. |
I think the trick of this exploit is to hold CTRL or LMB before the NPC falls, to maintain the focus. |
I did that, but after a few moments of him falling, I lose focus nonetheless. I can give you a savegame if you want to test it yourself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AmProsius some thoughts on exiting-early for this particular case and fix functions in general.
}; | ||
|
||
npc.fallDownDamage = 0; | ||
return TRUE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I understand the argument of avoiding too deeply nested if-blocks, I really feel that it is, on the one hand not necessary (it's just one nested if-block), and on the other hand creates three exit points of the function. Most importantly it creates much more code than necessary (and writing such a fix more work), and makes a concise and easily readable function much more complex and more difficult to follow at first glance.
The previous flow of reading was "Set fallDownDamage to zero if all conditions are met", i.e. only do something if certain conditions are true. Now it is "If the Npc is invalid, return. If the fallDownDamage is not zero, return. Set the fallDownDamage to zero." The logical and semantic flow is lost and it takes a few moments to put these separated if-blocks together. By the multiple exit points of the functions it is harder to spot when there is actually something happening.
Semantically, I agree that "exiting early, when expected conditions are not met" makes a lot of sense for test functions (as they are currently mostly implemented). But for fix functions, it makes more sense the other way around: "fix something if all conditions are met". Only in the off-chance of stacking very, very many conditions or checking something general, e.g. if symbols exist, then it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more important aspect for me is that the primary action is at the top level of the function, not "hidden" inside nested conditions. But I will most certainly think about this.
Describe the bug
Grash-Varrag-Arushat (the last undead orc priest) can die by fall damage rather than by Uriziel damage only.
Expected behavior
Grash-Varrag-Arushat (the last undead orc priest) can now only be killed with Uriziel.
Additional context
Bug provided by Blubbler.