Calculate the following: PDDRounded = Total WDEF * 0.25 <---- Round this to the nearest whole number
Calculate the following: PDDPercentage = Square Root(Total WDEF * 0.25) <--- Round Down
If your level is less than the mob's level, subtract 4 from PDDRounded for every level. If PDDRounded becomes less than 0 because of this, set PDDRounded to 0.
If your level is less than the mob's level, subtract 2.0 from PDDPercentage for every level. If PDDPercentage becomes less than 0 because of this, set PDDPercentage to 0.
Calculate the following: MobDamagePDDRounded = Enemy Attack - PDDRounded
Calculate the following: MobDamagePDDPercentage = (100 - PDDPercentage) * (Enemy Attack / 100)
Pick the smaller number between MobDamagePDDRounded and MobDamagePDDPercentage. Call this number "damage taken"
If damage taken is less than 1, set damage taken to 1.
Damage taken is the maximum damage you will receive from the enemy.