# False Swipe Attack Formula?

#### palom

##### Villager
I have a doubt, I want to make an attack with a "False Swipe" style, this attack will deal fixed damage (150 for example), but if that skill will kill the opponent it let it with 1 HP instead.

I was trying to lurk for a damage formula, but I didn't found it.

Thank you

#### CrocPirate

##### Veteran
I would imagine the damage formula would look something like this:

b.hp >= 151 ? 150 : b.hp - 1

#### palom

##### Villager
I tested it and it works!!!! Thank you very much.

No problem.

#### Nolonar

##### Veteran
Alternate formula: `Math.min(150, b.hp - 1)`

It gives you the smaller number between 150 and HP-1.

#### palom

##### Villager
Alternate formula: `Math.min(150, b.hp - 1)`

It gives you the smaller number between 150 and HP-1.
Thanks, I'll save that formula too

### Latest Profile Posts

I might not participate in the Boss Battle contest after all... I have more important things to do, like Wishful Wanda. And of course the Dark Deception spinoff I plan to pitch, Demon Slayer.
Changed my avatar, goodbye Alan Sugar, hello George Carlin (one of my favorite human beings ever)
If you still don't subscribe our Polish channel please consider it
Who wants to see my review of the worst star wars movie? This movie has all the excitement of being on Jury Duty of the most boring case ever about trade negotiations.
A lot to learn to make a game. Can I handle it?