Honestly, it's just my idea of how a battle could work. Others will have different ideas. The key for Random_Battle is in the screenshot. The code seems to work for me, but there could be mistakes or bugs in it. Modify the player & weapon data and attack & defense formulas and observe the results.