diff options
author | Haru <haru@dotalux.com> | 2020-07-27 10:55:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-27 10:55:27 +0200 |
commit | da6bd5bd44ab14f8dd2658912e92d959ed26b7ad (patch) | |
tree | 7807a698d05ee0b47f3e5148330e2ab521879702 /src/map/battle.c | |
parent | e90730312b92edc237088d601b1047ceff3402eb (diff) | |
parent | 9f39a74248de7908955cb876fa2fb936babd2546 (diff) | |
download | hercules-da6bd5bd44ab14f8dd2658912e92d959ed26b7ad.tar.gz hercules-da6bd5bd44ab14f8dd2658912e92d959ed26b7ad.tar.bz2 hercules-da6bd5bd44ab14f8dd2658912e92d959ed26b7ad.tar.xz hercules-da6bd5bd44ab14f8dd2658912e92d959ed26b7ad.zip |
Merge pull request #2790 from Kenpachi2k13/def_ele_tolerance
Add bonuses to reduce received damage based on attacker's defense element
Diffstat (limited to 'src/map/battle.c')
-rw-r--r-- | src/map/battle.c | 39 |
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; |