- Joined
- Jan 22, 2016
- Messages
- 261
- Reaction score
- 216
- First Language
- Swedish
- Primarily Uses
I'm doing this as a universal passive state using Yanflys Buffs and States core and Passive States, I've tried several variations but I'm messing up somewhere.
<Custom Establish Effect>
if (this.isPhysical() && target.result().hpDamage > 0 && target.result().critical){
//If user TP is over 0.
if (user.tp >= 0){
/Calculate TP gain.
var value = Math.floor(user.tp * 2 * 0.25);
user.gainTP(value);
} else {
//If TP is at 0 add 25 TP.
var value = 25;
user.gainTP(value);
}
// Check if target is alive.
if (target.isAlive()) {
// Remove 25 TP from target.
if (target.tp >= 0){
var value = 25;
target.gainTP(-value);
}
}
}
</Custom Establish Effect>
