diff options
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 04c3cd1cb..9cd04c96f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4031,6 +4031,52 @@ static int pc_bonus3(struct map_session_data *sd, int type, int type2, int type3 sd->bonus.sp_vanish_trigger = val; } break; + case SP_SUB_DEF_ELE: + if ((type2 >= ELE_MAX && type2 != ELE_ALL) || type2 < ELE_NEUTRAL) { + ShowError("pc_bonus3: SP_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->sub_def_ele[j].rate_mob += type3; + + if ((val & 2) != 0) + sd->sub_def_ele[j].rate_pc += type3; + } + } else { + if ((val & 1) != 0) + sd->sub_def_ele[type2].rate_mob += type3; + + if ((val & 2) != 0) + sd->sub_def_ele[type2].rate_pc += 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); |