So in my game, there is a skill that applies a state to the target called "bear trap" when the trapped enemy/party member is attacked with a physical skill, the attacker is given a special state, and they also take damage. However, in my game, there are 2 elements that are considered physical attacks "melee" and "ranged".
I only want the trap status effect to react to melee attacks, However, due to my zero knowledge of javascript, I don't know how to do that. If anyone could help me modify this code to make it work how I want, that would be amazing!
(The code is taken from two different Yanfly Tips & Tricks videos. One is thorn mail, and the other I forgot.)
I did try to change "this.isPhysical" to "this.isMelee" which didn't work unsurprisingly.
P.S. I'm typing this at 12am and I'm gonna go to bed immediately after posting this thread so sorry if it takes a while to respond.
I only want the trap status effect to react to melee attacks, However, due to my zero knowledge of javascript, I don't know how to do that. If anyone could help me modify this code to make it work how I want, that would be amazing!
(The code is taken from two different Yanfly Tips & Tricks videos. One is thorn mail, and the other I forgot.)
JavaScript:
if (value > 0 && this.isPhysical()) {
var rate = 0.25;
var recoil = value * rate;
var rate = 0.25;
var bonus = target.def * rate;
var dmg = Math.ceil(bonus + recoil);
user.gainHp(-1 * dmg);
if (user.isDead()) {
user.performCollapse();
}
}
if (value > 0 && this.isPhysical()) {
if (this.isHpEffect() && value > 0) {
user.addState(36);
target.removeState(35);
if (user.isDead()) {
user.performCollapse();
}
}
}
P.S. I'm typing this at 12am and I'm gonna go to bed immediately after posting this thread so sorry if it takes a while to respond.