In my project, the standard setup for calculating whether a hit connects is thrown out; I use the damage formula to determine whether a hit connects.
Naturally, if I want to apply an effect on a successful hit, I can't use the built-in functionality to add an effect on an attack - they're set to auto-hit and the damage formula does the rest.
So, I have an enemy that uses a "bleed" type attack that will cause some damage and apply a damage over time effect. Here's my formula so far:
Math.randomInt(20)+a.atk > b.agi ? Math.randomInt(4)+1 + b.addState(4) : 0;
(I use agility as the defense stat)
I've highlighted in red the problematic code. The first part rolls a d20 and adds a modifier and compares this to the target's agility stat. If that works, damage is applied. However, I want it to apply the bleed state (4) as well.
Using the + symbol doesn't have the desired outcome; it just ignores the damage and decides whether to apply the state.
I've tried using no symbol, the && symbol, etc. No luck.
Any idea how I can modify this formula to do damage and apply an effect?
Thanks!
Naturally, if I want to apply an effect on a successful hit, I can't use the built-in functionality to add an effect on an attack - they're set to auto-hit and the damage formula does the rest.
So, I have an enemy that uses a "bleed" type attack that will cause some damage and apply a damage over time effect. Here's my formula so far:
Math.randomInt(20)+a.atk > b.agi ? Math.randomInt(4)+1 + b.addState(4) : 0;
(I use agility as the defense stat)
I've highlighted in red the problematic code. The first part rolls a d20 and adds a modifier and compares this to the target's agility stat. If that works, damage is applied. However, I want it to apply the bleed state (4) as well.
Using the + symbol doesn't have the desired outcome; it just ignores the damage and decides whether to apply the state.
I've tried using no symbol, the && symbol, etc. No luck.
Any idea how I can modify this formula to do damage and apply an effect?
Thanks!