Skill that reflects upcoming damage on the next turn

I'm new to writing scripts in general, and especially in RMMZ with java, but how would you theoretically code this? I had the idea for a skill that would reflect any damage done to the actor that round back to the enemy, multiplied by about 1.5 or so. Additionally, it would only successfully reflect the damage 80%/90% of the time. If anyone knows how to make this skill, please explain it to me, any help is appreciated.
I'm new to writing scripts in general, and especially in RMMZ with java
Just for your information, since this sounds like you plan to learn it - RPG Maker uses JavaScript, not Java. They're two different programming languages.

but how would you theoretically code this?
This is pretty straightforward to do with VisuStella's Battle Core.

I had the idea for a skill that would reflect any damage done to the actor that round back to the enemy, multiplied by about 1.5 or so. Additionally, it would only successfully reflect the damage 80%/90% of the time.
In the state that the skill puts on you, you put these notetags:
Code:
<JS Pre-Damage As Target>
if (this.isDamage() && this.isHpEffect() && Math.random()<.8)
{
    target.reflected=value;
    value=0;
}
</JS Pre-Damage As Target>

<JS Post-Apply As Target>
if (target.reflected)
{
    user.gainHp(0-target.reflected);
    delete target.reflected;
    if (user.isDead())
        user.performCollapse();
}
</JS Post-Apply As Target>

That has an 80% chance of triggering.
Just for your information, since this sounds like you plan to learn it - RPG Maker uses JavaScript, not Java. They're two different programming languages.


This is pretty straightforward to do with VisuStella's Battle Core.


In the state that the skill puts on you, you put these notetags:
Code:
<JS Pre-Damage As Target>
if (this.isDamage() && this.isHpEffect() && Math.random()<.8)
{
    target.reflected=value;
    value=0;
}
</JS Pre-Damage As Target>

<JS Post-Apply As Target>
if (target.reflected)
{
    user.gainHp(0-target.reflected);
    delete target.reflected;
    if (user.isDead())
        user.performCollapse();
}
</JS Post-Apply As Target>

That has an 80% chance of triggering.
thank you very much

Original thread: https://forums.rpgmakerweb.com/threads/skill-that-reflects-upcoming-damage-on-the-next-turn.154464/