I have the script
def magic_evade?( a, b )
c = rand(100000) / 100000.0
if c < b.mev
return true
else
return false
end
end
I'm trying to emulate Breath Weapons from Dungeons and Dragons, which did half damage instead of none when magic resist was in effect.
example damage formula: ( magic_evade?( a, b ) ) ? x : 2x
But calling this seems to make the skill do absolutely nothing regardless of the target's MEV. I have no idea what's causing this.
My own script - Having Problems
● ARCHIVED · READ-ONLY
-
-
if I understand you try to cut the damage by half when the magic evade is actif?
-
all numbers are integer by default until they are converted to float - and in your case, c is always lower than 1 and thereby the function will always return true.
also, how did you define x as a damage number?
and 2x is not a valid mathematical statement... -
Pretty much, yeah.if I understand you try to cut the damage by half when the magic evade is actif?
Tried that. Went so far as to convert them to floats too. (using .to_f, making the denominator in the script 100000.0)all numbers are integer by default until they are converted to float - and in your case, c is always lower than 1 and thereby the function will always return true.
UPDATE: I take that back. Your suggestion worked.
In the case I was testing, x = a.mat * 2 - b.mdf * 1also, how did you define x as a damage number?
I meant 2 * xand 2x is not a valid mathematical statement...