Damage Over Time: Yanfly's Plugin

Status
Not open for further replies.

Solis

Veteran
Veteran
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 :D



Thanks!
 
Joined
Oct 26, 2015
Messages
540
Reaction score
1,062
First Language
English
Primarily Uses
Try this:


<Custom Regenerate Effect>
// Get the Darkness element.
var elementId = 10;
// Round down the damage, apply formula.
var damage = Math.floor((origin.mat * 4 - user.mdf * 2) * user.mdr);
// Damage multiplier for weakness/resistance to Darkness element.
damage *= user.elementRate(elementId);
// Inflict damage to the user, caps at zero to prevent unintentional healing.
user.gainHp(Math.min(-damage, 0));
</Custom Regenerate Effect>




For states as far as I can tell, 'origin' is the original caster (a) and 'user' is the person inflicted with the state (b)


a.mat * 4 - b.mdf * 2  = origin.mat * 4 - user.mdf * 2


I have moved the elemental multiplier after the formula to better emulate how skills normally work, in addition the damage is capped at 0 so there wont be accidental healing if MDF is too high.


Remember to change the element ID if needed
 

Solis

Veteran
Veteran
Joined
Oct 24, 2015
Messages
376
Reaction score
84
First Language
English
I love you so much! Can I make a statue of you :D <3!!! I'll check it out. 


If user isn't "correct", what could be some other terms I could try. 


Thanks! 


This works just fine. Thanks for the help. 
 
Last edited by a moderator:
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,569
Latest member
Shtelsky
Top