Skip to content
Permalink
Browse files

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
  • Loading branch information...
cydh committed Nov 4, 2019
1 parent 930f52e commit e6bf2d18f9ec2d2f25b6c8a8d4f6978cf3ef40d4
Showing with 28 additions and 20 deletions.
  1. +2 −2 doc/item_bonus.txt
  2. +14 −16 src/map/pc.cpp
  3. +12 −2 src/map/skill.cpp
@@ -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)
@@ -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,26 +3949,26 @@ void pc_bonus2(struct map_session_data *sd,int type,int type2,int val)

pc_bonus_itembonus(sd->skillcooldown, type2, val, false);
break;
#ifdef RENEWAL_CAST
case SP_SKILL_FIXEDCAST: // bonus2 bSkillFixedCast,sk,t;
if(sd->state.lr_flag == 2)
case SP_SKILL_VARIABLECAST: // bonus2 bSkillVariableCast,sk,t;
if (sd->state.lr_flag == 2)
break;
if (sd->skillfixcast.size() == MAX_PC_BONUS) {
ShowWarning("pc_bonus2: SP_SKILL_FIXEDCAST: Reached max (%d) number of skills per character, bonus skill %d (%d) lost.\n", MAX_PC_BONUS, type2, val);
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->skillfixcast, type2, val, false);
pc_bonus_itembonus(sd->skillvarcast, type2, val, false);
break;
case SP_SKILL_VARIABLECAST: // bonus2 bSkillVariableCast,sk,t;
#ifdef RENEWAL_CAST
case SP_SKILL_FIXEDCAST: // bonus2 bSkillFixedCast,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);
if (sd->skillfixcast.size() == MAX_PC_BONUS) {
ShowWarning("pc_bonus2: SP_SKILL_FIXEDCAST: 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);
pc_bonus_itembonus(sd->skillfixcast, type2, val, false);
break;
case SP_CASTRATE: // bonus2 bCastrate,sk,n;
case SP_VARCASTRATE: // bonus2 bVariableCastrate,sk,n;
@@ -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;
@@ -16526,15 +16526,25 @@ 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) {
time += time * it.val / 100;
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

0 comments on commit e6bf2d1

Please sign in to comment.
You can’t perform that action at this time.