summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-07-04 11:23:03 +0200
committerKenpachi Developer <Kenpachi.Developer@gmx.de>2020-07-04 11:37:10 +0200
commit9f39a74248de7908955cb876fa2fb936babd2546 (patch)
tree187cfacdd91fcf7088c5c32808a0c74f1ac784f2
parentd3311cd34169008f0ba67a11c2f3353ab565c343 (diff)
downloadhercules-9f39a74248de7908955cb876fa2fb936babd2546.tar.gz
hercules-9f39a74248de7908955cb876fa2fb936babd2546.tar.bz2
hercules-9f39a74248de7908955cb876fa2fb936babd2546.tar.xz
hercules-9f39a74248de7908955cb876fa2fb936babd2546.zip
Cast sstatus->def_ele to int
-rw-r--r--src/map/battle.c54
1 files changed, 30 insertions, 24 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index efc82c27f..a0140d32b 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1070,17 +1070,20 @@ static int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct
}
// Apply bMagicSubDefEle damage reduction.
- if ((src->type == BL_MOB || src->type == BL_PC)
- && !Assert_chk(sstatus->def_ele >= ELE_NEUTRAL && sstatus->def_ele < ELE_MAX)) {
- switch (src->type) {
- case BL_MOB:
- ele_fix += tsd->magic_sub_def_ele[sstatus->def_ele].rate_mob;
- break;
- case BL_PC:
- ele_fix += tsd->magic_sub_def_ele[sstatus->def_ele].rate_pc;
- break;
- default:
- break;
+ 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;
+ }
}
}
@@ -1252,20 +1255,23 @@ static int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct
}
// Apply bSubDefEle damage reduction.
- if ((src->type == BL_MOB || src->type == BL_PC)
- && !Assert_chk(sstatus->def_ele >= ELE_NEUTRAL && sstatus->def_ele < ELE_MAX)) {
- switch (src->type) {
- case BL_MOB:
- ele_fix = tsd->sub_def_ele[sstatus->def_ele].rate_mob;
- break;
- case BL_PC:
- ele_fix = tsd->sub_def_ele[sstatus->def_ele].rate_pc;
- break;
- default:
- break;
- }
+ 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 - ele_fix) / 100;
+ }
}
}
cardfix = cardfix * (100-tsd->subsize[sstatus->size]) / 100;