I want to make an attack that; Attempts to inflict Instant Death on an enemy, and failing that, it does damage equivalent to a Critical Hit instead. I know I can do this with a Custom Formula, but it's lost on me exactly how. Am I checking for a State, and if that state isn't there, then formula? Like;
b.state?(50) ? r = a.atk * 12 : r = a.atk * 4 ; r - b.def * 2
But I don't think that's it.
Any leads?
Basically instant death would be adding state #1, and the only way to prevent death by default would be if the target is resistent to death.
But that resistance is a feature, and unless that feature is given by a state you can't test for it directly.
So how do your enemies gain resistance from death?
AFAIK, damage is done before trying to add effects, so your skill will always have the death check as false... If you want to do this, you'd need to add the death state right in your formula. then check if it's inflicted afterwards.
So something like
b.add_state(1);if !b.state?(1) then; atk*12 - b.def*2;end;
This way, it will try to add Death state, then check if the unit has not been inflicted with it. If it's not inflicted, deal critical, else deal nothing.
btw, Critical is actually damage formula * 3, so the correct critical formula isn't atk*12 - b.def*2 but rather (atk*4-b.def*2)*3 or (atk*12-b.def*6)