damage formula with minimum base damage

jonthefox

Veteran
Veteran
Joined
Jan 3, 2015
Messages
1,436
Reaction score
596
Primarily Uses
Let's say I want a skill's damage to be 50 + (a.atk - b.def). However, if b.def is greater than a.atk, I don't want this part of the formula to reduce the 50 - the damage should just be 50. Yet obviously, if a.atk is greater than b.def, I'd like the difference to be added to the 50. Is there an easy way to achieve this?
 

Lord Vectra

Master Eventer
Veteran
Joined
Dec 6, 2015
Messages
211
Reaction score
336
First Language
English
Primarily Uses
RMVXA
if a.atk - b.def <= 49; 50; else; a.atk - b.def; end

That should work for you. Alternatively, you can also say....

if a.atk - b.def < 50; 50; else; a.atk - b.def; end

Either way, it has the same effect.
 
Last edited:

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
557
Reaction score
232
First Language
english
Primarily Uses
RMMV
a.atk < b.def ? 50 : 50 + a.atk - b.def

minimum dmg 50, max dmg 50 + result
edit: just saw ace, not sure if uses same "? :" formula as mv
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,254
Reaction score
1,254
First Language
Spanish
Primarily Uses
RMVXA
a.atk < b.def ? 50 : 50 + a.atk - b.def
this.

although, I would flip it
a.atk > b.def ? 50 + a.atk - b.def : 50

because it seems like a.atk < b.def is like a particular less-occurring case of atk vs def.
since a.atk > b.def would seem to be the standard, return that from true rather than false.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,048
Messages
1,018,543
Members
137,834
Latest member
EverNoir
Top