Created
December 9, 2021 07:11
-
-
Save Zbizu/6a4aaef3e9d9cb37526604d35cb836a7 to your computer and use it in GitHub Desktop.
poison condition damage formula
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getValue(x) | |
local flipped = 0 | |
if x % 10 > 5 then | |
flipped = 1 | |
end | |
local f | |
if (x + flipped) % 2 == 1 then | |
f = math.floor | |
else | |
f = math.ceil | |
end | |
return f((20/x) * (1 + math.sin(math.pi * x))) | |
end | |
for i = 1, 22 do print(getValue(i)) end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
formula for taking damage while being poisoned in a role-playing game
input: amount of damage player receives
output: how many times will the player take this amount of damage (eg. 1 damage 20 times, 2 damage 10 times)
Example:
let's say you're DM and the player gets poisoned for 100 damage
you sum
f(1) + ... + f(n)
until the sum is equal or greater than 100.If your sum is greater than 100, you don't count the last tick.
The end result is that the player takes
n
damagef(n)
times andn
decreases until it reaches zero.