Repository navigation
Fall damage handling moved to FormulaHelper - #2803
RedRoryOTheGlen wants to merge 2 commits into
Conversation
… use the same formula as players for calculating fall damage.
|
Current formula for player that uses threshold and damage per falling height unit is the result of my experimentation, falling from different heights, carrying more or less loot, etc. But it assumes you start with no vertical velocity, so that the energy of the impact is only potential energy basically, so proportional to height difference between where you left ground and where you landed; Which may be inaccurate at times (say if you jumped, or were somehow thrown), and cannot replicate correctly some classic behavior, like player taking damage if (s)he stops moving abruptly, like teleporting or, I think, casting levitation. |
|
I think having access to the Entity should be sufficient. For enemies, there's already a formula to get their "weight" and we can pass the DaggerfallEntity as EnemyEntity if needed. A similar formula for PlayerEntity could help. |
Unified the disparate ways that fall damage is calculated between PlayerHealth and EnemyMotor into an overridable formula.
For players, the formula by default can now directly reflect the value of fallingDamageThreshold set in AcrobatMotor instead of using its own const variable.
For enemies, EnemyMotor now has a public fallingDamageThreshold property that can be set by mods if necessary.
The intention is to maintain the current behavior but open up fall damage mechanics to modding, making it possible to have skills or spell effects be able to reduce fall damage or increase the distance to fall before taking damage, or even have enemies that can be resistant to fall damage (eg, Acrobats, spiders, etc).
Example used to test overriding the formula:
This example also showcases the formula allowing for different handling of fall damage between players and NPCs (or even specific NPCs) if required.