Here you go. I copied the formula from the Excel. Now you can't ever say you had to do everything yourself.
Damage =
ROUNDDOWN
(IF(ATK<1,0,
IF(DEF<1,ATK+(STR/5),
IF(((((ATK+(STR/5))+DEF)/DEF-(DEF+DEF)/(ATK+(STR/5)))+1)*(ATK+(STR/5))/2<1,1,
[otherwise](((((ATK+(STR/5))+DEF)/DEF-(DEF+DEF)/(ATK+(STR/5)))+1)*(ATK+(STR/5))/2))))
,0) [round down end]
MAG would be substituted for ATK for Magic damage types. Now aren't you glad you asked? Personally, I wouldn't "bake in" any damage formula. I would set up a simple default formula which is loaded from an external configuration text document. Thus letting users insert their own formula if they want.
Damage =
ROUNDDOWN
(IF(ATK<1,0,
IF(DEF<1,ATK+(STR/5),
IF(((((ATK+(STR/5))+DEF)/DEF-(DEF+DEF)/(ATK+(STR/5)))+1)*(ATK+(STR/5))/2<1,1,
[otherwise](((((ATK+(STR/5))+DEF)/DEF-(DEF+DEF)/(ATK+(STR/5)))+1)*(ATK+(STR/5))/2))))
,0) [round down end]
MAG would be substituted for ATK for Magic damage types. Now aren't you glad you asked? Personally, I wouldn't "bake in" any damage formula. I would set up a simple default formula which is loaded from an external configuration text document. Thus letting users insert their own formula if they want.