diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-07-02 04:26:09 +0200 |
---|---|---|
committer | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-07-02 04:33:17 +0200 |
commit | 98064d23a7231816d2c04e1e95c90b18d5636b30 (patch) | |
tree | 54fe2c63d025b2ea55e0d95a69bcee4a04ad982f /src | |
parent | 7888d7144db4c4e71542b786eb7e143dbd066230 (diff) | |
download | hercules-98064d23a7231816d2c04e1e95c90b18d5636b30.tar.gz hercules-98064d23a7231816d2c04e1e95c90b18d5636b30.tar.bz2 hercules-98064d23a7231816d2c04e1e95c90b18d5636b30.tar.xz hercules-98064d23a7231816d2c04e1e95c90b18d5636b30.zip |
Add bMagicSubDefEle item bonus
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battle.c | 13 | ||||
-rw-r--r-- | src/map/map.h | 2 | ||||
-rw-r--r-- | src/map/pc.c | 23 | ||||
-rw-r--r-- | src/map/pc.h | 4 |
4 files changed, 41 insertions, 1 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 12d85993f..956cc4a49 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1068,6 +1068,19 @@ static int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct continue; ele_fix += tsd->subele2[i].rate; } + + // Apply bMagicSubDefEle damage reduction. + switch (src->type) { + case BL_MOB: + ele_fix += tsd->magic_sub_def_ele[status_get_element(src)].rate_mob; + break; + case BL_PC: + ele_fix += tsd->magic_sub_def_ele[status_get_element(src)].rate_pc; + break; + default: + break; + } + cardfix = cardfix * (100 - ele_fix) / 100; } cardfix = cardfix * (100 - tsd->subsize[sstatus->size]) / 100; diff --git a/src/map/map.h b/src/map/map.h index f57bb0278..9f17ae439 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -557,7 +557,7 @@ enum status_point_types { //we better clean up this enum and change it name [Hem SP_SKILL_USE_SP,SP_MAGIC_ATK_ELE, SP_ADD_FIXEDCAST, SP_ADD_VARIABLECAST, //2055-2058 SP_SET_DEF_RACE,SP_SET_MDEF_RACE, //2059-2060 SP_RACE_TOLERANCE,SP_ADDMAXWEIGHT, //2061-2062 - SP_SUB_DEF_ELE, // 2063 + SP_SUB_DEF_ELE, SP_MAGIC_SUB_DEF_ELE, // 2063-2064 /* must be the last, plugins add bonuses from this value onwards */ SP_LAST_KNOWN, diff --git a/src/map/pc.c b/src/map/pc.c index 2d3115d68..242c43ba3 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4054,6 +4054,29 @@ static int pc_bonus3(struct map_session_data *sd, int type, int type2, int type3 } break; + case SP_MAGIC_SUB_DEF_ELE: + if ((type2 >= ELE_MAX && type2 != ELE_ALL) || type2 < ELE_NEUTRAL) { + ShowError("pc_bonus3: SP_MAGIC_SUB_DEF_ELE: Invalid element %d\n", type2); + break; + } + + if (type2 == ELE_ALL) { + for (int j = ELE_NEUTRAL; j < ELE_MAX; j++) { + if ((val & 1) != 0) + sd->magic_sub_def_ele[j].rate_mob += type3; + + if ((val & 2) != 0) + sd->magic_sub_def_ele[j].rate_pc += type3; + } + } else { + if ((val & 1) != 0) + sd->magic_sub_def_ele[type2].rate_mob += type3; + + if ((val & 2) != 0) + sd->magic_sub_def_ele[type2].rate_pc += type3; + } + + break; default: ShowWarning("pc_bonus3: unknown type %d %d %d %d!\n",type,type2,type3,val); diff --git a/src/map/pc.h b/src/map/pc.h index a0c3bf955..3f8f88444 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -400,6 +400,10 @@ BEGIN_ZEROED_BLOCK; // this block will be globally zeroed at the beginning of st int rate_pc; //!< Physical damage reduction against player's defense element. } sub_def_ele[ELE_MAX]; //!< Bonus bSubDefEle data structure. struct { + int rate_mob; //!< Magical damage reduction against monster's defense element. + int rate_pc; //!< Magical damage reduction against player's defense element. + } magic_sub_def_ele[ELE_MAX]; //!< Bonus bMagicSubDefEle data structure. + struct { int atk_rate; int arrow_atk,arrow_ele,arrow_cri,arrow_hit; int nsshealhp,nsshealsp; |