# 32 Dmg (Rdm(1…X)*(PA*3+Y))

```[32]
00189d78: afbf0010 sw r31,0x0010(r29)
00189d7c: 0c062144 jal 0x 00188510      		Physical Evade Calculation
00189d80: 00000000 nop
00189d84: 14400024 bne r2,r0,0x 00189e18		Branch to end if attack is evaded
00189d88: 00000000 nop
00189d8c: 0c061740 jal 0x 00185d00      		Store PA and PA + Y / 2
00189d90: 00000000 nop
00189d94: 0c061853 jal 0x 0018614c      		Formula 32, 33, 34, 35 Attack Up and Martial Arts
00189d98: 00000000 nop
00189d9c: 0c0622b7 jal 0x 00188adc      		Cluster of Physical Routines (Contains checks for frog and berserk for the caster.)
00189da0: 00000000 nop
00189da4: 0c06193e jal 0x 001864f8      		Critical Hit Calculation
00189da8: 00000000 nop
00189dac: 0c061967 jal 0x 0018659c      		Set XA + YA for Status Formulas (Stupid section)
00189db0: 00000000 nop
00189db4: 0c063ba8 jal 0x 0018eea0      		Random Process, gives a number between 0-7fff
00189db8: 00000000 nop
00189dbc: 3c038019 lui r3,0x8019
00189dc0: 906338f9 lbu r3,0x38f9(r3)      	Load X
00189dc4: 00000000 nop
00189dc8: 0043 0018 mult r2,r3
00189dcc: 3c058019 lui r5,0x8019
00189dd4: 00001012 mflo r2                 	X * RN
00189dd8: 04410002 bgez r2,0x 00189de4
00189ddc: 00000000 nop
00189de4: 000213c3 sra r2,r2,0xf
00189de8: 3c048019 lui r4,0x8019
00189dec: 8c842d90 lw r4,0x2d90(r4)
00189df4: a0a20000 sb r2,0x0000(r5)
00189df8: 90a20000 lbu r2,0x0000(r5)       	(Replace with  AND r2, r2, 0x00FF)
00189dfc: 84830004 lh r3,0x0004(r4)      	Load PA + (PA + Y) / 2
00189e00: 00000000 nop
00189e04: 0062 0018 mult r3,r2
00189e08: 34020080 ori r2,r0,0x0080
00189e0c: a0820025 sb r2,0x0025(r4)      	Set as HP Damage
00189e10: 00001012 mflo r2                 	Damage = {1...X} * [PA + (PA + Y) / 2]
00189e14: a4820004 sh r2,0x0004(r4)      	Store Damage
00189e18: 8fbf0010 lw r31,0x0010(r29)
00189e1c: 27bd 0018 addiu r29,r29,0x 0018
00189e20: 03e00008 jr r31
00189e24: 00000000 nop
```