Negative MDEF should not increase damage taken from magic (#3190)

* Fixes #3189.
* MDEF should never go below 0.
Thanks to @flamefury!
This commit is contained in:
flamefury 2018-07-16 09:43:29 -07:00 committed by Aleos
parent f1f4709127
commit 030443c9d3

View File

@ -6348,8 +6348,8 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
* RE MDEF Reduction
* Damage = Magic Attack * (1000+eMDEF)/(1000+eMDEF) - sMDEF
*/
if (mdef < -99)
mdef = -99; // Avoid divide by 0
if (mdef < 0)
mdef = 0; // Negative eMDEF is treated as 0 on official
ad.damage = ad.damage * (1000 + mdef) / (1000 + mdef * 10) - mdef2;
#else