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.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index a571a555d..72c3d8963 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1068,6 +1068,25 @@ static int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct
continue;
ele_fix += tsd->subele2[i].rate;
}
+
+ // Apply bMagicSubDefEle damage reduction.
+ if (src->type == BL_MOB || src->type == BL_PC) {
+ int ele = (int)sstatus->def_ele;
+
+ if (!Assert_chk(ele >= ELE_NEUTRAL && ele < ELE_MAX)) {
+ switch (src->type) {
+ case BL_MOB:
+ ele_fix += tsd->magic_sub_def_ele[ele].rate_mob;
+ break;
+ case BL_PC:
+ ele_fix += tsd->magic_sub_def_ele[ele].rate_pc;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
cardfix = cardfix * (100 - ele_fix) / 100;
}
cardfix = cardfix * (100 - tsd->subsize[sstatus->size]) / 100;
@@ -1234,6 +1253,26 @@ static int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct
}
cardfix = cardfix * (100 - ele_fix_lh) / 100;
}
+
+ // Apply bSubDefEle damage reduction.
+ if (src->type == BL_MOB || src->type == BL_PC) {
+ int ele = (int)sstatus->def_ele;
+
+ if (!Assert_chk(ele >= ELE_NEUTRAL && ele < ELE_MAX)) {
+ switch (src->type) {
+ case BL_MOB:
+ ele_fix = tsd->sub_def_ele[ele].rate_mob;
+ break;
+ case BL_PC:
+ ele_fix = tsd->sub_def_ele[ele].rate_pc;
+ break;
+ default:
+ break;
+ }
+
+ cardfix = cardfix * (100 - ele_fix) / 100;
+ }
+ }
}
cardfix = cardfix * (100-tsd->subsize[sstatus->size]) / 100;
cardfix = cardfix * (100-tsd->subrace2[s_race2]) / 100;