Skip to content
Permalink
Browse files
Fix Bug # 7049
Added new item bonuses bFixedCast, bVariableCast & bFixedCastrate. (see
'doc/item_bonus.txt' for info)
Added new conf for max walk path.(Bug Report # 7042)

http://hercules.ws/board/tracker/issue-7049-do-we-need-new-bonus/?gopid=16578#entry16578
  • Loading branch information
malufett committed Feb 5, 2013
1 parent f9d5d4f commit c69e4b6cf853d31f18ef9c2f04d2bc965f4ad158
Showing with 78 additions and 9 deletions.
  1. +4 −0 conf/battle/client.conf
  2. +3 −0 db/const.txt
  3. +5 −2 doc/item_bonus.txt
  4. +1 −0 src/map/battle.c
  5. +1 −0 src/map/battle.h
  6. +1 −1 src/map/map.h
  7. +44 −1 src/map/pc.c
  8. +2 −1 src/map/pc.h
  9. +1 −0 src/map/script.c
  10. +10 −0 src/map/skill.c
  11. +2 −1 src/map/status.c
  12. +4 −3 src/map/unit.c
@@ -61,6 +61,10 @@ pet_hair_style: 100
// Visible area size (how many squares away from a player can they see)
area_size: 14

// Maximum walk path (how many cells a player can walk going to cursor)
// default: 17(official)
max_walk_path: 17

// Maximum allowed 'level' value that can be sent in unit packets.
// Use together with the aura_lv setting to tell when exactly to show the aura.
// NOTE: You also need to adjust the client if you want this to work.
@@ -588,6 +588,9 @@ bFixedCastrate 2053
bVariableCastrate 2054
bSkillUseSP 2055
bMagicAtkEle 2056
bFixedCast 2057

bVariableCast 2058

EQI_HEAD_TOP 1
EQI_ARMOR 2
@@ -409,8 +409,11 @@ bonus2 bSkillUseSPrate,s,x; Reduces SP consumption of skill s by x%. (supports
bonus2 bSkillUseSP,s,x; Reduces SP consumption of skill s by x. (supports skill names.)
bonus2 bSkillCooldown,s,x; Increases cooldown of skill s by x milliseconds. (supports skill names.)

bonus bFixedCastrate,x; Increases fixed cast time of skills by x%.
bonus bVariableCastrate,x; Increases variable cast time of skills by x%.
bonus bFixedCastrate,x; Increases fixed cast time of all skills by x%.
bonus bVariableCastrate,x; Increases variable cast time of all skills by x%.
bonus bFixedCast,x; Increases fixed cast time of all skills by x milliseconds;
bonus bVariableCast,x; Increases variable cast time of all skills by x milliseconds;
bonus2 bSkillFixedCast,s,x; Increases fixed cast time of skill s by x milliseconds. (supports skill names.)
bonus2 bSkillVariableCast,s,x; Increases variable cast time of skill s by x milliseconds. (supports skill names.)
bonus2 bVariableCastrate,s,x; Increases variable cast time of skill s by x%. (supports skill names.)
bonus2 bFixedCastrate,s,x; Increases fixed cast time of skill s by x%. (supports skill names.)
@@ -5868,6 +5868,7 @@ static const struct _battle_data {
**/
{ "skill_trap_type", &battle_config.skill_trap_type, 0, 0, 1, },
{ "item_restricted_consumption_type", &battle_config.item_restricted_consumption_type,1, 0, 1, },
{ "max_walk_path", &battle_config.max_walk_path, 17, 1, MAX_WALKPATH, },
};
#ifndef STATS_OPT_OUT
/**
@@ -485,6 +485,7 @@ extern struct Battle_Config
int mob_size_influence; // Enable modifications on earned experience, drop rates and monster status depending on monster size. [mkbu95]
int skill_trap_type;
int item_restricted_consumption_type;
int max_walk_path;
} battle_config;

void do_init_battle(void);
@@ -406,7 +406,7 @@ enum _sp {
SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE, SP_MAGIC_SP_GAIN_VALUE, SP_MAGIC_HP_GAIN_VALUE, SP_ADD_CLASS_DROP_ITEM, //2041-2045
SP_EMATK, SP_SP_GAIN_RACE_ATTACK, SP_HP_GAIN_RACE_ATTACK, SP_SKILL_USE_SP_RATE, //2046-2049
SP_SKILL_COOLDOWN,SP_SKILL_FIXEDCAST, SP_SKILL_VARIABLECAST, SP_FIXCASTRATE, SP_VARCASTRATE, //2050-2054
SP_SKILL_USE_SP,SP_MAGIC_ATK_ELE //2055-2056
SP_SKILL_USE_SP,SP_MAGIC_ATK_ELE, SP_ADD_FIXEDCAST, SP_ADD_VARIABLECAST //2055-2058
};

enum _look {
@@ -2591,11 +2591,22 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
if(sd->state.lr_flag != 2)
sd->bonus.fixcastrate -= val;
break;
case SP_ADD_FIXEDCAST:
if(sd->state.lr_flag != 2)
sd->bonus.add_fixcast += val;

break;
#ifdef RENEWAL_CAST
case SP_VARCASTRATE:
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;
#endif
default:
ShowWarning("pc_bonus: unknown type %d %d !\n",type,val);
@@ -2953,7 +2964,15 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
ARR_FIND(0, ARRAYLENGTH(sd->skillcast), i, sd->skillcast[i].id == 0 || sd->skillcast[i].id == type2);
if (i == ARRAYLENGTH(sd->skillcast))
{ //Better mention this so the array length can be updated. [Skotlex]
ShowDebug("run_script: bonus2 bCastRate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillcast), type2, val);
ShowDebug("run_script: bonus2 %s reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n",

#ifndef RENEWAL_CAST
"bCastRate",
#else
"bVariableCastrate",
#endif

ARRAYLENGTH(sd->skillcast), type2, val);
break;
}
if(sd->skillcast[i].id == type2)
@@ -2964,6 +2983,30 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
}
break;

case SP_FIXCASTRATE:
if(sd->state.lr_flag == 2)
break;

ARR_FIND(0, ARRAYLENGTH(sd->skillfixcastrate), i, sd->skillfixcastrate[i].id == 0 || sd->skillfixcastrate[i].id == type2);

if (i == ARRAYLENGTH(sd->skillfixcastrate))

{

ShowDebug("run_script: bonus2 bFixedCastrate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillfixcastrate), type2, val);
break;
}

if(sd->skillfixcastrate[i].id == type2)
sd->skillfixcastrate[i].val += val;

else {
sd->skillfixcastrate[i].id = type2;
sd->skillfixcastrate[i].val = val;
}

break;

case SP_HP_LOSS_RATE:
if(sd->state.lr_flag != 2) {
sd->hp_loss.value = type2;
@@ -263,7 +263,7 @@ struct map_session_data {
struct { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills.
unsigned short id;
short val;
} skillatk[MAX_PC_BONUS], skillusesprate[MAX_PC_BONUS], skillusesp[MAX_PC_BONUS], skillheal[5], skillheal2[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS], skillcooldown[MAX_PC_BONUS], skillfixcast[MAX_PC_BONUS], skillvarcast[MAX_PC_BONUS];
} skillatk[MAX_PC_BONUS], skillusesprate[MAX_PC_BONUS], skillusesp[MAX_PC_BONUS], skillheal[5], skillheal2[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS], skillcooldown[MAX_PC_BONUS], skillfixcast[MAX_PC_BONUS], skillvarcast[MAX_PC_BONUS], skillfixcastrate[MAX_PC_BONUS];
struct {
short value;
int rate;
@@ -320,6 +320,7 @@ struct map_session_data {
unsigned short unbreakable_equip; //100% break resistance on certain equipment
unsigned short unstripable_equip;
int fixcastrate,varcastrate;
int add_fixcast,add_varcast;
int ematk; // matk bonus from equipment
// int eatk; // atk bonus from equipment
} bonus;
@@ -7860,6 +7860,7 @@ BUILDIN_FUNC(bonus)
case SP_SKILL_FIXEDCAST:
case SP_SKILL_VARIABLECAST:
case SP_VARCASTRATE:
case SP_FIXCASTRATE:
case SP_SKILL_USE_SP:
// these bonuses support skill names
val1 = ( script_isstring(st,3) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) );
@@ -13819,6 +13819,10 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16
if(sd && !(skill_get_castnodex(skill_id, skill_lv)&4) ){ // Increases/Decreases fixed/variable cast time of a skill by item/card bonuses.
if( sd->bonus.varcastrate < 0 )
VARCAST_REDUCTION(sd->bonus.varcastrate);
if( sd->bonus.add_varcast != 0 ) // bonus bVariableCast
time += sd->bonus.add_varcast;
if( sd->bonus.add_fixcast != 0 ) // bonus bFixedCast
fixed += sd->bonus.add_fixcast;
for (i = 0; i < ARRAYLENGTH(sd->skillfixcast) && sd->skillfixcast[i].id; i++)
if (sd->skillfixcast[i].id == skill_id){ // bonus2 bSkillFixedCast
fixed += sd->skillfixcast[i].val;
@@ -13835,6 +13839,12 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16
VARCAST_REDUCTION(i);
break;
}
for( i = 0; i < ARRAYLENGTH(sd->skillfixcastrate) && sd->skillfixcastrate[i].id; i++ )

if( sd->skillfixcastrate[i].id == skill_id ){ // bonus2 bFixedCastrate
fixcast_r = sd->skillfixcastrate[i].val; // just speculation
break;
}
}

if (sc && sc->count && !(skill_get_castnodex(skill_id, skill_lv)&2) ) {
@@ -1,4 +1,4 @@
// Copyright (c) Hercules dev team, licensed under GNU GPL.
// Copyright (c) Hercules dev team, licensed under GNU GPL.
// See the LICENSE file
// Portions Copyright (c) Athena dev team

@@ -2416,6 +2416,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
+ sizeof(sd->skillcooldown)
+ sizeof(sd->skillfixcast)
+ sizeof(sd->skillvarcast)
+ sizeof(sd->skillfixcastrate)
);

memset (&sd->bonus, 0,sizeof(sd->bonus));
@@ -315,21 +315,22 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
{
struct unit_data* ud = NULL;
struct status_change* sc = NULL;
#ifdef OFFICIAL_WALKPATH
struct walkpath_data wpd;
#endif

nullpo_ret(bl);

ud = unit_bl2ud(bl);

if( ud == NULL) return 0;

#ifdef OFFICIAL_WALKPATH
path_search(&wpd, bl->m, bl->x, bl->y, x, y, flag&1, CELL_CHKNOPASS); // Count walk path cells
#ifdef OFFICIAL_WALKPATH
if( !path_search_long(NULL, bl->m, bl->x, bl->y, x, y, CELL_CHKNOPASS) // Check if there is an obstacle between
&& wpd.path_len > 14 ) // Official number of walkable cells is 14 if and only if there is an obstacle between. [malufett]
return 0;
#endif
if( battle_config.max_walk_path < wpd.path_len )
return 0;

if (flag&4 && DIFF_TICK(ud->canmove_tick, gettick()) > 0 &&
DIFF_TICK(ud->canmove_tick, gettick()) < 2000)

0 comments on commit c69e4b6

Please sign in to comment.