Hello Makers!
I've been trying to make a Magic Reflection state for a while now, as I'm not the biggest fan of reflecting 100% of the original damage back. And it does work to an extent. There are just a few things I'm missing.
I've been trying to make a Magic Reflection state for a while now, as I'm not the biggest fan of reflecting 100% of the original damage back. And it does work to an extent. There are just a few things I'm missing.
- After taking the damage, the effects of the skill (e.g. add state) can still be applied to the target.
- I also haven't figured out how to make those effects have a chance of being applied back to the attacker.
<Custom Apply Effect>
var stacks = target.getStateCounter(stateId) || 0;
stacks += 1;
stacks = stacks.clamp(0, 1);
target.setStateCounter(stateId, stacks);
</Custom Apply Effect>
<Custom React Effect>
if (this.isPhysical() && value > 0) {
var reflect = Math.round(value * 0.25);
user.startAnimation(7);
user.gainHp(-1 * reflect);
if (user.isDead()) {
user.performCollapse();
}
target.startAnimation(2);
value = 0;
var stacks = target.getStateCounter(stateId) || 0;
stacks -= 1;
stacks = stacks.clamp(0, 1);
if (stacks < 1) {
target.removeState(stateId);
}
}
</Custom React Effect>