- Home /
How to Calc Armor ?
Which mathf function can be used for damage reduction calculation ?
for example i want the following:
100 Armor = 10% DMG Reduce 1000 Armor = 50% DMG Reduce 10k Armor = 75% DMG Reduce & CAP.
I was thinging about using log(2) on the values and do some basic maths after that to fit.
Any other suggestions ?
Answer by Bunny83 · Jun 04, 2013 at 12:47 PM
Since your progressing isn't really described very detailed (only 3 sample points) it's impossible what progression you actually want. It might be a solution to just use an AnimationCurve and define your desired curve there. Just add a public variable of type AnimationCurve to your script and you should be able to edit the curve in the inspector.
Keep in mind that the "input value" is the x axis and the "output value" the y axis.
If you really need a math formula you have to be more precise on your progression / asymptotes of your desired curve.
I didnt understand how this work. I added a AnimationCurve as public into my script. How can i now obtain any values from this ?
Of course with Evaluate ;)
The value you pass in is the x-position and the value returned will be the y-position at the given x-position.
Answer by Tarlius · Jun 04, 2013 at 12:25 PM
I'm not sure this question is directly related to unity, but since you're asking about Mathf I'm letting it slide although a mod may disagree.
However, in regards to your question, I don't think you'll find a one-size-fits-all "damage reduction calculation in Mathf. I would instead suggest looking at the calculations used in other games for ideas. I know for example that the WoW mechanics are readily available.
I would ins$$anonymous$$d suggest looking at the calculations used in other games for ideas. I know for example that the WoW mechanics are readily available.
To add on @Tarlius's suggestion, Damage calculation for the Pokemon games.
Good Idee i will look like other do this. $$anonymous$$aybe i can build my own improved formula this way.
Just as a tip when you want to try your formula use an online function plotter ;)
To future readers,
Using animation-curve ( as per @Bunny83's answer ) have 3 great advantages:
Easy to adjust
Can avoid writing very complex mathematical function
You have a visual of the output curve presented to you
But, there are times you will want to stick with the formula, you can transfer the same formula to other game easily but I bet you can't get back the same curvature when you re-create one from scratch.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
A node in a childnode? 1 Answer
How do I find the inverse cosine ??? 1 Answer
shooting scripts 0 Answers
Rotating a Sphere with the mouse? 1 Answer