using the maximum value from the QSpinBox to calculate the health completely dynamically