From e6bf2d18f9ec2d2f25b6c8a8d4f6978cf3ef40d4 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Mon, 4 Nov 2019 08:03:15 +0700 Subject: [PATCH] bonus bVariableCast and bonus2 bSkillVariableCast for Pre-renewal (#4268) * `bonus bVariableCast,t;` now works in pre-renewal to increase casting time * `bonus2 bSkillVariableCast,sk,t;` now works in pre-renewal to increase casting time by skill name * Item bonus documentation update --- doc/item_bonus.txt | 4 ++-- src/map/pc.cpp | 30 ++++++++++++++---------------- src/map/skill.cpp | 14 ++++++++++++-- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/doc/item_bonus.txt b/doc/item_bonus.txt index d8f4947613..5d3a528fb7 100644 --- a/doc/item_bonus.txt +++ b/doc/item_bonus.txt @@ -203,8 +203,8 @@ bonus2 bVariableCastrate,sk,n; Increases variable cast time of skill sk by n% bonus bFixedCast,t; Increases fixed cast time of all skills by t milliseconds (has effect in RENEWAL_CAST only) bonus2 bSkillFixedCast,sk,t; Increases fixed cast time of skill sk by t milliseconds (has effect in RENEWAL_CAST only) -bonus bVariableCast,t; Increases variable cast time of all skills by t milliseconds (has effect in RENEWAL_CAST only) -bonus2 bSkillVariableCast,sk,t; Increases variable cast time of skill sk by t milliseconds (has effect in RENEWAL_CAST only) +bonus bVariableCast,t; Increases variable cast time of all skills by t milliseconds +bonus2 bSkillVariableCast,sk,t; Increases variable cast time of skill sk by t milliseconds bonus bNoCastCancel; Prevents casting from being interrupted when hit (does not work in GvG) bonus bNoCastCancel2; Prevents casting from being interrupted when hit (works even in GvG) diff --git a/src/map/pc.cpp b/src/map/pc.cpp index dfc8a77aa0..fd0a36b314 100755 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -3415,6 +3415,10 @@ void pc_bonus(struct map_session_data *sd,int type,int val) if(sd->state.lr_flag != 2) sd->bonus.ematk += val; break; + case SP_ADD_VARIABLECAST: + if (sd->state.lr_flag != 2) + sd->bonus.add_varcast += val; + break; #ifdef RENEWAL_CAST case SP_FIXCASTRATE: if(sd->state.lr_flag != 2) @@ -3429,14 +3433,9 @@ void pc_bonus(struct map_session_data *sd,int type,int val) if(sd->state.lr_flag != 2) sd->bonus.varcastrate -= val; break; - case SP_ADD_VARIABLECAST: - if(sd->state.lr_flag != 2) - sd->bonus.add_varcast += val; - break; #else case SP_ADD_FIXEDCAST: case SP_FIXCASTRATE: - case SP_ADD_VARIABLECAST: //ShowWarning("pc_bonus: non-RENEWAL_CAST doesn't support this bonus %d.\n", type); break; case SP_VARCASTRATE: @@ -3950,6 +3949,16 @@ void pc_bonus2(struct map_session_data *sd,int type,int type2,int val) pc_bonus_itembonus(sd->skillcooldown, type2, val, false); break; + case SP_SKILL_VARIABLECAST: // bonus2 bSkillVariableCast,sk,t; + if (sd->state.lr_flag == 2) + break; + if (sd->skillvarcast.size() == MAX_PC_BONUS) { + ShowWarning("pc_bonus2: SP_SKILL_VARIABLECAST: Reached max (%d) number of skills per character, bonus skill %d (%d) lost.\n", MAX_PC_BONUS, type2, val); + break; + } + + pc_bonus_itembonus(sd->skillvarcast, type2, val, false); + break; #ifdef RENEWAL_CAST case SP_SKILL_FIXEDCAST: // bonus2 bSkillFixedCast,sk,t; if(sd->state.lr_flag == 2) @@ -3961,16 +3970,6 @@ void pc_bonus2(struct map_session_data *sd,int type,int type2,int val) pc_bonus_itembonus(sd->skillfixcast, type2, val, false); break; - case SP_SKILL_VARIABLECAST: // bonus2 bSkillVariableCast,sk,t; - if(sd->state.lr_flag == 2) - break; - if (sd->skillvarcast.size() == MAX_PC_BONUS) { - ShowWarning("pc_bonus2: SP_SKILL_VARIABLECAST: Reached max (%d) number of skills per character, bonus skill %d (%d) lost.\n", MAX_PC_BONUS, type2, val); - break; - } - - pc_bonus_itembonus(sd->skillvarcast, type2, val, false); - break; case SP_CASTRATE: // bonus2 bCastrate,sk,n; case SP_VARCASTRATE: // bonus2 bVariableCastrate,sk,n; if(sd->state.lr_flag == 2) @@ -3994,7 +3993,6 @@ void pc_bonus2(struct map_session_data *sd,int type,int type2,int val) break; #else case SP_SKILL_FIXEDCAST: // bonus2 bSkillFixedCast,sk,t; - case SP_SKILL_VARIABLECAST: // bonus2 bSkillVariableCast,sk,t; case SP_FIXCASTRATE: // bonus2 bFixedCastrate,sk,n; //ShowWarning("pc_bonus2: Non-RENEWAL_CAST doesn't support this bonus %d.\n", type); break; diff --git a/src/map/skill.cpp b/src/map/skill.cpp index 2841674c42..b48d4aa363 100755 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -16526,8 +16526,12 @@ int skill_castfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv) { // Calculate cast time reduced by item/card bonuses if (sd) { - if (!(flag&4) && sd->castrate != 100) - reduce_cast_rate += 100 - sd->castrate; + if (!(flag&4)) { + if (sd->castrate != 100) + reduce_cast_rate += 100 - sd->castrate; + if (sd->bonus.add_varcast != 0) + time += sd->bonus.add_varcast; // bonus bVariableCast + } // Skill-specific reductions work regardless of flag for (const auto &it : sd->skillcastrate) { if (it.id == skill_id) { @@ -16535,6 +16539,12 @@ int skill_castfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv) { break; } } + for (const auto &it : sd->skillvarcast) { + if (it.id == skill_id) { // bonus2 bSkillVariableCast + time += it.val; + break; + } + } } // These cast time reductions are processed even if the skill fails