diff options
-rw-r--r-- | Changelog.txt | 2 | ||||
-rw-r--r-- | src/map/pc.c | 92 | ||||
-rw-r--r-- | src/map/pc.h | 1 | ||||
-rw-r--r-- | src/map/skill.c | 16 |
4 files changed, 101 insertions, 10 deletions
diff --git a/Changelog.txt b/Changelog.txt index 4ee296625..40146bb80 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -14,6 +14,8 @@ Date Added since it's already fully implemented. - Added a bit more restrictions to Call Partner and Emergency Recall and updated mapflag for sec_pri.gat + - Added pc_calcspeed and updated Cloaking so it won't need to recalculate + the player's entire status everytime there is movement. 11/22 * (TXT)Stripped some code off read_gm_accounts() and made with it addGM() [MC Cameri] diff --git a/src/map/pc.c b/src/map/pc.c index 6bcea4b29..d8893407f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2092,6 +2092,98 @@ int pc_calcstatus(struct map_session_data* sd,int first) } /*========================================== + * For quick calculating [Celest] + *------------------------------------------ + */ +int pc_calcspeed (struct map_session_data *sd) +{ + int b_speed, skill; + struct pc_base_job s_class; + + nullpo_retr(0, sd); + + s_class = pc_calc_base_job(sd->status.class); + + b_speed = sd->speed; + sd->speed = DEFAULT_WALK_SPEED ; + sd->speed_rate = 100; + sd->speed_add_rate = 100; + if(sd->speed_add_rate != 100) + sd->speed_rate += sd->speed_add_rate - 100; + if(sd->aspd_add_rate != 100) + sd->aspd_rate += sd->aspd_add_rate - 100; + + if(sd->sc_count){ + if(sd->sc_data[SC_INCREASEAGI].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1){ // 速度?加 + sd->speed -= sd->speed *25/100; + } + if(sd->sc_data[SC_DECREASEAGI].timer!=-1) { + sd->speed = sd->speed *125/100; + } + if(sd->sc_data[SC_CLOAKING].timer!=-1) { + sd->speed = sd->speed * (sd->sc_data[SC_CLOAKING].val3-sd->sc_data[SC_CLOAKING].val1*3) /100; + } + if(sd->sc_data[SC_CHASEWALK].timer!=-1) { + sd->speed = sd->speed * sd->sc_data[SC_CHASEWALK].val3 /100; + } + if(sd->sc_data[SC_QUAGMIRE].timer!=-1){ + sd->speed = sd->speed*3/2; + } + if(sd->sc_data[SC_WINDWALK].timer!=-1) { + sd->speed -= sd->speed *(sd->sc_data[SC_WINDWALK].val1*2)/100; + } + if(sd->sc_data[SC_CARTBOOST].timer!=-1) { + sd->speed -= (DEFAULT_WALK_SPEED * 20)/100; + } + if(sd->sc_data[SC_BERSERK].timer!=-1) { + sd->speed -= sd->speed *25/100; + } + if(sd->sc_data[SC_WEDDING].timer!=-1) { + sd->speed = 2*DEFAULT_WALK_SPEED; + } + if(sd->sc_data[SC_DONTFORGETME].timer!=-1){ + sd->speed= sd->speed*(100+sd->sc_data[SC_DONTFORGETME].val1*2 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3&0xffff))/100; + } + if(sd->sc_data[SC_STEELBODY].timer!=-1){ + sd->speed = (sd->speed * 125) / 100; + } + if(sd->sc_data[SC_DEFENDER].timer != -1) { + sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100; + } + if( sd->sc_data[SC_DANCING].timer!=-1 ){ + sd->speed*=4; + } + if(sd->sc_data[SC_CURSE].timer!=-1) + sd->speed += 450; + } + + if(sd->status.option&2 && (skill = pc_checkskill(sd,RG_TUNNELDRIVE))>0 ) + sd->speed += (1.2*DEFAULT_WALK_SPEED - skill*9); + if (pc_iscarton(sd) && (skill=pc_checkskill(sd,MC_PUSHCART))>0) + sd->speed += (10-skill) * (DEFAULT_WALK_SPEED * 0.1); + else if (pc_isriding(sd)) { + sd->speed -= (0.25 * DEFAULT_WALK_SPEED); + } + if((skill=pc_checkskill(sd,TF_MISS))>0) + if(s_class.job==12) + sd->speed -= sd->speed *(skill*1.5)/100; + + if(sd->speed_rate != 100) + sd->speed = sd->speed*sd->speed_rate/100; + if(sd->speed < 1) sd->speed = 1; + + if(sd->skilltimer != -1 && (skill = pc_checkskill(sd,SA_FREECAST)) > 0) { + sd->prev_speed = sd->speed; + sd->speed = sd->speed*(175 - skill*5)/100; + } + + if(b_speed != sd->speed) + clif_updatestatus(sd,SP_SPEED); + + return 0; +} + +/*========================================== * ? 備品による能力等のボ?ナス設定 *------------------------------------------ */ diff --git a/src/map/pc.h b/src/map/pc.h index a8c9cb385..a6c5a2b2a 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -77,6 +77,7 @@ int pc_dropitem(struct map_session_data*,int,int); int pc_checkweighticon(struct map_session_data *sd); int pc_calcstatus(struct map_session_data*,int); +int pc_calcspeed(struct map_session_data*); // [Celest] int pc_bonus(struct map_session_data*,int,int); int pc_bonus2(struct map_session_data *sd,int,int,int); int pc_bonus3(struct map_session_data *sd,int,int,int,int); diff --git a/src/map/skill.c b/src/map/skill.c index 0b734d41a..9840d76dc 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -4407,7 +4407,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } } break; - case GD_REGENERATION: + case GD_REGENERATION: { struct guild *g = NULL; if (sd && sd->status.guild_id > 0 && (g = guild_search(sd->status.guild_id)) && @@ -4430,7 +4430,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int for(i = 0; i < g->max_member; i++) { if ((dstsd = g->member[i].sd) != NULL && sd->bl.m == dstsd->bl.m) { hp = dstsd->status.max_hp*0.9; - sp = dstsd->status.sp + hp < dstsd->status.max_sp ? hp : dstsd->status.max_sp - dstsd->status.sp; + sp = dstsd->status.sp + hp <= dstsd->status.max_sp ? hp : dstsd->status.max_sp - dstsd->status.sp; clif_skill_nodamage(src,bl,AL_HEAL,hp,1); battle_heal(NULL,bl,hp,sp,0); } @@ -9798,19 +9798,15 @@ int skill_check_cloaking(struct block_list *bl) skill_status_change_end(bl, SC_CLOAKING, -1); *battle_get_option(bl)&=~4; /* 念のための?理 */ } - else if (bl->type == BL_PC) { + else if (bl->type == BL_PC && sd->sc_data[SC_CLOAKING].val3 != 130) { sd->sc_data[SC_CLOAKING].val3 = 130; - //sd->speed = sd->speed * sd->sc_data[SC_CLOAKING].val3 /100; - //clif_updatestatus(sd,SP_SPEED); - pc_calcstatus (sd,0); // better way than calling this everytime? + pc_calcspeed (sd); } } else { - if (bl->type == BL_PC) { + if (bl->type == BL_PC && sd->sc_data[SC_CLOAKING].val3 != 103) { sd->sc_data[SC_CLOAKING].val3 = 103; - //sd->speed = sd->speed * sd->sc_data[SC_CLOAKING].val3 /100; - //clif_updatestatus(sd,SP_SPEED); - pc_calcstatus (sd,0); + pc_calcspeed (sd); } } return end; |