I've looked around a bit but I'm not having much luck in finding a thorns state or plugin, anyone know one?
For those that don't know: thorns is an ability that, when active, deals damage to anyone attacking the one with the effect.
I wanted the ability to do that as well, so I've been looking into it, I found one method so far.
I put
if (b.isStateAffected(30)) {a.gainHp(-3)};
before the damage calculation of my physical attacks.
30 is the state (doesn't do anything really, just sits there to be detected)
You can have multiple ranks by checking for different states.
like this:
if (b.isStateAffected(30)) {a.gainHp(-3)}; if (b.isStateAffected(31)) {a.gainHp(-6)}; if (b.isStateAffected(32)) {a.gainHp(-9)};
Hope that gives you some ideas.
Edit:
Also, if the attack misses the attacker doesn't take damage.