I am trying to have a skill which heals the user by twice the amount of the enemy's ATK stat, and after the damage has been calculated, to then reduce the ATK stat with a debuff. I need that debuff to be applied subsequently, or else it reduces the amount of healing that the user will get.
I have tried a few things. The simplest was to have a damage formula based on the enemy's stat, and a debuff applied by a command in the effects box

That, however, seems to apply the debuff first - except that the debuff icon does not appear on the enemy.
I then tried with a damage formula like this, with the damage type set to HP damage and the debuff in the Effects box:
a.hp += b.atk*2; b.hp-=b.atk*2
Again the debuff icon did not appear, but in addition, the enemy took far too much damage - 124 HP (probably with a bit of variance) instead of 60 (twice the stat of ATK = 30). I deduce that that formula does double damage.
Next up was a damage formula like this, where I incorporated the debuff into the formula itself:
a.hp += b.atk*2; b.add_debuff(2,2,); b.hp-=b.atk*2
That did 134 HP damage (according to the pop up) so still too high, but in addition knocked out an enemy which has 190HP.
Colour me confused.
Can anyone see what I'm doing wrong here.
I have tried a few things. The simplest was to have a damage formula based on the enemy's stat, and a debuff applied by a command in the effects box

That, however, seems to apply the debuff first - except that the debuff icon does not appear on the enemy.
I then tried with a damage formula like this, with the damage type set to HP damage and the debuff in the Effects box:
a.hp += b.atk*2; b.hp-=b.atk*2
Again the debuff icon did not appear, but in addition, the enemy took far too much damage - 124 HP (probably with a bit of variance) instead of 60 (twice the stat of ATK = 30). I deduce that that formula does double damage.
Next up was a damage formula like this, where I incorporated the debuff into the formula itself:
a.hp += b.atk*2; b.add_debuff(2,2,); b.hp-=b.atk*2
That did 134 HP damage (according to the pop up) so still too high, but in addition knocked out an enemy which has 190HP.
Colour me confused.
Can anyone see what I'm doing wrong here.
