diff options
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 162 |
1 files changed, 80 insertions, 82 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 71950a032..1d7e2c9d5 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2072,7 +2072,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) status->mdef = cap_value(bonus, CHAR_MIN, CHAR_MAX); #endif if( sd->state.lr_flag == 3 ) {//Shield, used for royal guard - sd->shieldmdef += bonus; + sd->bonus.shieldmdef += bonus; } } break; @@ -2087,7 +2087,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) bonus = status->hit + val; status->hit = cap_value(bonus, SHRT_MIN, SHRT_MAX); } else - sd->arrow_hit+=val; + sd->bonus.arrow_hit+=val; break; case SP_FLEE1: if(sd->state.lr_flag != 2) { @@ -2106,7 +2106,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) bonus = status->cri + val*10; status->cri = cap_value(bonus, SHRT_MIN, SHRT_MAX); } else - sd->arrow_cri += val*10; + sd->bonus.arrow_cri += val*10; break; case SP_ATKELE: if(val >= ELE_MAX) { @@ -2127,7 +2127,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) status->rhw.ele=val; break; default: //Become arrow element. - sd->arrow_ele=val; + sd->bonus.arrow_ele=val; break; } break; @@ -2200,15 +2200,15 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_SPEED_RATE: //Non stackable increase if(sd->state.lr_flag != 2) - sd->speed_rate = min(sd->speed_rate, -val); + sd->bonus.speed_rate = min(sd->bonus.speed_rate, -val); break; case SP_SPEED_ADDRATE: //Stackable increase if(sd->state.lr_flag != 2) - sd->speed_add_rate -= val; + sd->bonus.speed_add_rate -= val; break; case SP_ASPD: //Raw increase if(sd->state.lr_flag != 2) - sd->aspd_add -= 10*val; + sd->bonus.aspd_add -= 10*val; break; case SP_ASPD_RATE: //Stackable increase - Made it linear as per rodatazone if(sd->state.lr_flag != 2) @@ -2224,23 +2224,23 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_CRITICAL_DEF: if(sd->state.lr_flag != 2) - sd->critical_def += val; + sd->bonus.critical_def += val; break; case SP_NEAR_ATK_DEF: if(sd->state.lr_flag != 2) - sd->near_attack_def_rate += val; + sd->bonus.near_attack_def_rate += val; break; case SP_LONG_ATK_DEF: if(sd->state.lr_flag != 2) - sd->long_attack_def_rate += val; + sd->bonus.long_attack_def_rate += val; break; case SP_DOUBLE_RATE: - if(sd->state.lr_flag == 0 && sd->double_rate < val) - sd->double_rate = val; + if(sd->state.lr_flag == 0 && sd->bonus.double_rate < val) + sd->bonus.double_rate = val; break; case SP_DOUBLE_ADD_RATE: if(sd->state.lr_flag == 0) - sd->double_add_rate += val; + sd->bonus.double_add_rate += val; break; case SP_MATK_RATE: if(sd->state.lr_flag != 2) @@ -2264,15 +2264,15 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_ATK_RATE: if(sd->state.lr_flag != 2) - sd->atk_rate += val; + sd->bonus.atk_rate += val; break; case SP_MAGIC_ATK_DEF: if(sd->state.lr_flag != 2) - sd->magic_def_rate += val; + sd->bonus.magic_def_rate += val; break; case SP_MISC_ATK_DEF: if(sd->state.lr_flag != 2) - sd->misc_def_rate += val; + sd->bonus.misc_def_rate += val; break; case SP_IGNORE_MDEF_RATE: if(sd->state.lr_flag != 2) { @@ -2286,19 +2286,19 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; } if(sd->state.lr_flag != 2) - sd->ignore_mdef_ele |= 1<<val; + sd->bonus.ignore_mdef_ele |= 1<<val; break; case SP_IGNORE_MDEF_RACE: if(sd->state.lr_flag != 2) - sd->ignore_mdef_race |= 1<<val; + sd->bonus.ignore_mdef_race |= 1<<val; break; case SP_PERFECT_HIT_RATE: - if(sd->state.lr_flag != 2 && sd->perfect_hit < val) - sd->perfect_hit = val; + if(sd->state.lr_flag != 2 && sd->bonus.perfect_hit < val) + sd->bonus.perfect_hit = val; break; case SP_PERFECT_HIT_ADD_RATE: if(sd->state.lr_flag != 2) - sd->perfect_hit_add += val; + sd->bonus.perfect_hit_add += val; break; case SP_CRITICAL_RATE: if(sd->state.lr_flag != 2) @@ -2401,23 +2401,23 @@ int pc_bonus(struct map_session_data *sd,int type,int val) sd->special_state.no_knockback = 1; break; case SP_SPLASH_RANGE: - if(sd->splash_range < val) - sd->splash_range = val; + if(sd->bonus.splash_range < val) + sd->bonus.splash_range = val; break; case SP_SPLASH_ADD_RANGE: - sd->splash_add_range += val; + sd->bonus.splash_add_range += val; break; case SP_SHORT_WEAPON_DAMAGE_RETURN: if(sd->state.lr_flag != 2) - sd->short_weapon_damage_return += val; + sd->bonus.short_weapon_damage_return += val; break; case SP_LONG_WEAPON_DAMAGE_RETURN: if(sd->state.lr_flag != 2) - sd->long_weapon_damage_return += val; + sd->bonus.long_weapon_damage_return += val; break; case SP_MAGIC_DAMAGE_RETURN: //AppleGirl Was Here if(sd->state.lr_flag != 2) - sd->magic_damage_return += val; + sd->bonus.magic_damage_return += val; break; case SP_ALL_STATS: // [Valaris] if(sd->state.lr_flag!=2) { @@ -2448,51 +2448,51 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_UNBREAKABLE: if(sd->state.lr_flag!=2) - sd->unbreakable += val; + sd->bonus.unbreakable += val; break; case SP_UNBREAKABLE_WEAPON: if(sd->state.lr_flag != 2) - sd->unbreakable_equip |= EQP_WEAPON; + sd->bonus.unbreakable_equip |= EQP_WEAPON; break; case SP_UNBREAKABLE_ARMOR: if(sd->state.lr_flag != 2) - sd->unbreakable_equip |= EQP_ARMOR; + sd->bonus.unbreakable_equip |= EQP_ARMOR; break; case SP_UNBREAKABLE_HELM: if(sd->state.lr_flag != 2) - sd->unbreakable_equip |= EQP_HELM; + sd->bonus.unbreakable_equip |= EQP_HELM; break; case SP_UNBREAKABLE_SHIELD: if(sd->state.lr_flag != 2) - sd->unbreakable_equip |= EQP_SHIELD; + sd->bonus.unbreakable_equip |= EQP_SHIELD; break; case SP_UNBREAKABLE_GARMENT: if(sd->state.lr_flag != 2) - sd->unbreakable_equip |= EQP_GARMENT; + sd->bonus.unbreakable_equip |= EQP_GARMENT; break; case SP_UNBREAKABLE_SHOES: if(sd->state.lr_flag != 2) - sd->unbreakable_equip |= EQP_SHOES; + sd->bonus.unbreakable_equip |= EQP_SHOES; break; case SP_CLASSCHANGE: // [Valaris] if(sd->state.lr_flag !=2) - sd->classchange=val; + sd->bonus.classchange=val; break; case SP_LONG_ATK_RATE: if(sd->state.lr_flag != 2) //[Lupus] it should stack, too. As any other cards rate bonuses - sd->long_attack_atk_rate+=val; + sd->bonus.long_attack_atk_rate+=val; break; case SP_BREAK_WEAPON_RATE: if(sd->state.lr_flag != 2) - sd->break_weapon_rate+=val; + sd->bonus.break_weapon_rate+=val; break; case SP_BREAK_ARMOR_RATE: if(sd->state.lr_flag != 2) - sd->break_armor_rate+=val; + sd->bonus.break_armor_rate+=val; break; case SP_ADD_STEAL_RATE: if(sd->state.lr_flag != 2) - sd->add_steal_rate+=val; + sd->bonus.add_steal_rate+=val; break; case SP_DELAYRATE: if(sd->state.lr_flag != 2) @@ -2500,7 +2500,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_CRIT_ATK_RATE: if(sd->state.lr_flag != 2) - sd->crit_atk_rate += val; + sd->bonus.crit_atk_rate += val; break; case SP_NO_REGEN: if(sd->state.lr_flag != 2) @@ -2508,20 +2508,20 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_UNSTRIPABLE_WEAPON: if(sd->state.lr_flag != 2) - sd->unstripable_equip |= EQP_WEAPON; + sd->bonus.unstripable_equip |= EQP_WEAPON; break; case SP_UNSTRIPABLE: case SP_UNSTRIPABLE_ARMOR: if(sd->state.lr_flag != 2) - sd->unstripable_equip |= EQP_ARMOR; + sd->bonus.unstripable_equip |= EQP_ARMOR; break; case SP_UNSTRIPABLE_HELM: if(sd->state.lr_flag != 2) - sd->unstripable_equip |= EQP_HELM; + sd->bonus.unstripable_equip |= EQP_HELM; break; case SP_UNSTRIPABLE_SHIELD: if(sd->state.lr_flag != 2) - sd->unstripable_equip |= EQP_SHIELD; + sd->bonus.unstripable_equip |= EQP_SHIELD; break; case SP_HP_DRAIN_VALUE: if(!sd->state.lr_flag) { @@ -2545,39 +2545,39 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_SP_GAIN_VALUE: if(!sd->state.lr_flag) - sd->sp_gain_value += val; + sd->bonus.sp_gain_value += val; break; case SP_HP_GAIN_VALUE: if(!sd->state.lr_flag) - sd->hp_gain_value += val; + sd->bonus.hp_gain_value += val; break; case SP_MAGIC_SP_GAIN_VALUE: if(!sd->state.lr_flag) - sd->magic_sp_gain_value += val; + sd->bonus.magic_sp_gain_value += val; break; case SP_MAGIC_HP_GAIN_VALUE: if(!sd->state.lr_flag) - sd->magic_hp_gain_value += val; + sd->bonus.magic_hp_gain_value += val; break; case SP_ADD_HEAL_RATE: if(sd->state.lr_flag != 2) - sd->add_heal_rate += val; + sd->bonus.add_heal_rate += val; break; case SP_ADD_HEAL2_RATE: if(sd->state.lr_flag != 2) - sd->add_heal2_rate += val; + sd->bonus.add_heal2_rate += val; break; case SP_ADD_ITEM_HEAL_RATE: if(sd->state.lr_flag != 2) - sd->itemhealrate2 += val; + sd->bonus.itemhealrate2 += val; break; case SP_WEAPON_MATK: if(sd->state.lr_flag != 2) - sd->sp_weapon_matk += val; + sd->bonus.sp_weapon_matk += val; break; case SP_BASE_MATK: if(sd->state.lr_flag != 2) - sd->sp_base_matk += val; + sd->bonus.sp_base_matk += val; break; default: ShowWarning("pc_bonus: unknown type %d %d !\n",type,val); @@ -2806,22 +2806,20 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) break; case SP_SP_VANISH_RATE: if(sd->state.lr_flag != 2) { - sd->sp_vanish_rate += type2; - sd->sp_vanish_per += val; + sd->bonus.sp_vanish_rate += type2; + sd->bonus.sp_vanish_per += val; } break; case SP_GET_ZENY_NUM: - if(sd->state.lr_flag != 2 && sd->get_zeny_rate < val) - { - sd->get_zeny_rate = val; - sd->get_zeny_num = type2; + if(sd->state.lr_flag != 2 && sd->bonus.get_zeny_rate < val) { + sd->bonus.get_zeny_rate = val; + sd->bonus.get_zeny_num = type2; } break; case SP_ADD_GET_ZENY_NUM: - if(sd->state.lr_flag != 2) - { - sd->get_zeny_rate += val; - sd->get_zeny_num += type2; + if(sd->state.lr_flag != 2) { + sd->bonus.get_zeny_rate += val; + sd->bonus.get_zeny_num += type2; } break; case SP_WEAPON_COMA_ELE: @@ -4301,7 +4299,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv) // base skill success chance (percentual) rate = (sd_status->dex - md_status->dex)/2 + lv*6 + 4; - rate += sd->add_steal_rate; + rate += sd->bonus.add_steal_rate; if( rate < 1 ) return 0; @@ -6085,34 +6083,34 @@ int pc_skillatk_bonus(struct map_session_data *sd, int skill_num) return bonus; } -int pc_skillheal_bonus(struct map_session_data *sd, int skill_num) -{ - int i, bonus = sd->add_heal_rate; +int pc_skillheal_bonus(struct map_session_data *sd, int skill_num) { + int i, bonus = sd->bonus.add_heal_rate; - if( bonus ) - { - switch( skill_num ) - { - case AL_HEAL: if( !(battle_config.skill_add_heal_rate&1) ) bonus = 0; break; - case PR_SANCTUARY: if( !(battle_config.skill_add_heal_rate&2) ) bonus = 0; break; - case AM_POTIONPITCHER: if( !(battle_config.skill_add_heal_rate&4) ) bonus = 0; break; - case CR_SLIMPITCHER: if( !(battle_config.skill_add_heal_rate&8) ) bonus = 0; break; - case BA_APPLEIDUN: if( !(battle_config.skill_add_heal_rate&16)) bonus = 0; break; + if( bonus ) { + switch( skill_num ) { + case AL_HEAL: if( !(battle_config.skill_add_heal_rate&1) ) bonus = 0; break; + case PR_SANCTUARY: if( !(battle_config.skill_add_heal_rate&2) ) bonus = 0; break; + case AM_POTIONPITCHER: if( !(battle_config.skill_add_heal_rate&4) ) bonus = 0; break; + case CR_SLIMPITCHER: if( !(battle_config.skill_add_heal_rate&8) ) bonus = 0; break; + case BA_APPLEIDUN: if( !(battle_config.skill_add_heal_rate&16)) bonus = 0; break; } } ARR_FIND(0, ARRAYLENGTH(sd->skillheal), i, sd->skillheal[i].id == skill_num); - if( i < ARRAYLENGTH(sd->skillheal) ) bonus += sd->skillheal[i].val; + + if( i < ARRAYLENGTH(sd->skillheal) ) + bonus += sd->skillheal[i].val; return bonus; } -int pc_skillheal2_bonus(struct map_session_data *sd, int skill_num) -{ - int i, bonus = sd->add_heal2_rate; +int pc_skillheal2_bonus(struct map_session_data *sd, int skill_num) { + int i, bonus = sd->bonus.add_heal2_rate; ARR_FIND(0, ARRAYLENGTH(sd->skillheal2), i, sd->skillheal2[i].id == skill_num); - if( i < ARRAYLENGTH(sd->skillheal2) ) bonus += sd->skillheal2[i].val; + + if( i < ARRAYLENGTH(sd->skillheal2) ) + bonus += sd->skillheal2[i].val; return bonus; } @@ -6725,7 +6723,7 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp) if (potion_flag > 1) bonus += bonus*(potion_flag-1)*50/100; //All item bonuses. - bonus += sd->itemhealrate2; + bonus += sd->bonus.itemhealrate2; //Item Group bonuses bonus += bonus*itemdb_group_bonus(sd, itemid)/100; //Individual item bonuses. |