- Joined
- Oct 24, 2015
- Messages
- 376
- Reaction score
- 84
- First Language
- English
Hello, I have a question about how to fix this code or just some more explanation.
Basically, I'm I took Yanfly's Unstable Affliction skill and found a user on his Youtube that post the following code:
<Custom Regenerate Effect>
// Get the Darkness element.
var elementId = 10;
// Damage set to equal the origin's MAT.
var damage = origin.mat;
// Damage multiplier for weakness/resistance to Darkness element.
damage *= user.elementRate(elementId);
// Round down the damage, apply mdf and mdr.
damage = Math.floor((damage * 100 / (100 + user.mdf)) * user.mdr);
// Inflict damage to the user.
user.gainHp(-damage);
</Custom Regenerate Effect>
I'm trying to take this code and make a formula that basically works like this for the regen effect:
a.mat * 4 - b.mdef * 2
However, the code above doesn't seem to apply the enemies magic defense. And, the damage = Math.floor((damage * 100/(100+usermdf))*user.mdr); seem sto amplify the damage as if I change 100 to 1, the damage is reduce but if I increase the number to 200, it boost the damage. Taking the players defense to 999 doesn't even mitigate the damage. Any help
Thanks!
Basically, I'm I took Yanfly's Unstable Affliction skill and found a user on his Youtube that post the following code:
<Custom Regenerate Effect>
// Get the Darkness element.
var elementId = 10;
// Damage set to equal the origin's MAT.
var damage = origin.mat;
// Damage multiplier for weakness/resistance to Darkness element.
damage *= user.elementRate(elementId);
// Round down the damage, apply mdf and mdr.
damage = Math.floor((damage * 100 / (100 + user.mdf)) * user.mdr);
// Inflict damage to the user.
user.gainHp(-damage);
</Custom Regenerate Effect>
I'm trying to take this code and make a formula that basically works like this for the regen effect:
a.mat * 4 - b.mdef * 2
However, the code above doesn't seem to apply the enemies magic defense. And, the damage = Math.floor((damage * 100/(100+usermdf))*user.mdr); seem sto amplify the damage as if I change 100 to 1, the damage is reduce but if I increase the number to 200, it boost the damage. Taking the players defense to 999 doesn't even mitigate the damage. Any help
Thanks!
