I moved the mindamage formulas above the random number formula to create the variable before its use.