Line 43 to 77 of Game_Battler 3 calculates the damage in battle, and line 103 to 204 calculates skill damage. The code is as follows:
All variables are available there for either skill or other things. The main variables are attacker, user and skill. You may also use 'self' to obtain values for the targeted battler.