I assume using the Battle Core it's possible using one of the many "pre-apply" "pre-damage" etc
but im not sure at which one I'd need and then expanding on that what code i'd even need to do that, if possible.
for example, if you have a skill that doesnt deal damage then post/pre damage notetags will not run and youll need post/pre apply. but if the skill does do damage, pre/post apply both run regardless of the skill actually hitting the target and youll be triggering effects on misses. you'd have to write extra code to catch misses or use post/pre damage as those necessitate having hit the target.
Then since pre notetags run before the actual action effects have taken place, states that get removed on taking damage would be removed if you tried to apply one with a pre-damage/apply effect on a damaging skill, but if you wanted a skill to apply the skill and then execute the skill youd do need to use a pre apply/damage notetag
You cast Fire on the enemy. Enemy's element rate to Fire is 105%. The skill now has a 20% chance to inflict Burn on the enemy.
Code:
x would be the id for the burn state<JS Post-Damage>
if (this.calcElementRate(target) > 1 && Math.random() < .2)
target.addState(x)
</JS Post-Damage>