summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 3f9441aa4..4ec4e652d 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -2333,10 +2333,22 @@ struct Damage battle_calc_magic_attack(
}
if(!flag.imdef){
+ int mdef = tstatus->mdef;
+ int mdef2= tstatus->mdef2;
+ if(sd) {
+ i = sd->ignore_mdef[is_boss(target)?RC_BOSS:RC_NONBOSS];
+ i+= sd->ignore_mdef[tstatus->race];
+ if (i)
+ {
+ if (i > 100) i = 100;
+ mdef -= mdef * i/100;
+ mdef2-= mdef2* i/100;
+ }
+ }
if(battle_config.magic_defense_type)
- ad.damage = ad.damage - tstatus->mdef*battle_config.magic_defense_type - tstatus->mdef2;
+ ad.damage = ad.damage - mdef*battle_config.magic_defense_type - mdef2;
else
- ad.damage = ad.damage * (100-tstatus->mdef)/100 - tstatus->mdef2;
+ ad.damage = ad.damage * (100-mdef)/100 - mdef2;
}
if(skill_num == CR_GRANDCROSS || skill_num == NPC_GRANDDARKNESS)