summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-07-03 03:24:58 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-07-03 03:24:58 +0000
commitae6b1fa5f282bfa9822a9a8edaa9fd2f89a3e4e8 (patch)
tree6349e6dcc9295178ee3ce4b18307e39831b15e08 /src
parentf02e49e2f48c7aa316bffce2ec51357e9e869b7c (diff)
downloadhercules-ae6b1fa5f282bfa9822a9a8edaa9fd2f89a3e4e8.tar.gz
hercules-ae6b1fa5f282bfa9822a9a8edaa9fd2f89a3e4e8.tar.bz2
hercules-ae6b1fa5f282bfa9822a9a8edaa9fd2f89a3e4e8.tar.xz
hercules-ae6b1fa5f282bfa9822a9a8edaa9fd2f89a3e4e8.zip
Adjusted Free Cast code so that its walk penalty gets calculated in status_calc_speed and nowhere else.
Removed aspd penalty from Free Cast since tests show it's not there, even though RO sites claim it is. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12904 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/pc.h1
-rw-r--r--src/map/skill.c23
-rw-r--r--src/map/status.c53
-rw-r--r--src/map/status.h1
-rw-r--r--src/map/unit.c17
5 files changed, 31 insertions, 64 deletions
diff --git a/src/map/pc.h b/src/map/pc.h
index 53218c033..f09a45f35 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -141,7 +141,6 @@ struct map_session_data {
int cart_weight,cart_num;
int fd;
unsigned short mapindex;
- unsigned short prev_speed,prev_adelay;
unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left.
unsigned int client_tick;
int npc_id,areanpc_id,npc_shopid;
diff --git a/src/map/skill.c b/src/map/skill.c
index f106ebd57..bcff361dc 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -5241,15 +5241,21 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr data)
return 0;
}
- if(ud->skillid != SA_CASTCANCEL ) {
+ if(ud->skillid != SA_CASTCANCEL )
+ {// otherwise handled in unit_skillcastcancel()
if( ud->skilltimer != tid ) {
ShowError("skill_castend_id: Timer mismatch %d!=%d!\n", ud->skilltimer, tid);
ud->skilltimer = -1;
return 0;
}
- if( sd && ud->skilltimer != -1 && pc_checkskill(sd,SA_FREECAST))
- status_freecast_switch(sd);
- ud->skilltimer=-1;
+
+ if( sd && ud->skilltimer != -1 && pc_checkskill(sd,SA_FREECAST) > 0 )
+ {// restore original walk speed
+ ud->skilltimer = -1;
+ status_calc_bl(&sd->bl, SCB_SPEED);
+ }
+
+ ud->skilltimer = -1;
}
if (ud->skilltarget == id)
@@ -5473,10 +5479,13 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr data)
return 0;
}
- if(sd && ud->skilltimer != -1 && pc_checkskill(sd,SA_FREECAST))
- status_freecast_switch(sd);
-
+ if( sd && ud->skilltimer != -1 && pc_checkskill(sd,SA_FREECAST) > 0 )
+ {// restore original walk speed
+ ud->skilltimer=-1;
+ status_calc_bl(&sd->bl, SCB_SPEED);
+ }
ud->skilltimer=-1;
+
do {
if(status_isdead(src))
break;
diff --git a/src/map/status.c b/src/map/status.c
index 9f7a05d52..cb04563f7 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1193,8 +1193,6 @@ int status_check_visibility(struct block_list *src, struct block_list *target)
return 1;
}
-void status_calc_bl(struct block_list *bl, unsigned long flag);
-
// Basic ASPD value
int status_base_amotion_pc(struct map_session_data* sd, struct status_data* status)
{
@@ -2741,17 +2739,8 @@ void status_calc_bl_sub_pc(struct map_session_data *sd, unsigned long flag)
if(flag&SCB_SPEED) {
if(status->speed < battle_config.max_walk_speed)
status->speed = battle_config.max_walk_speed;
-
- if ((skill=pc_checkskill(sd,SA_FREECAST))>0) {
- //Store casting walk speed for quick restoration. [Skotlex]
- sd->prev_speed = status->speed * (175-5*skill)/100;
- if(sd->ud.skilltimer != -1) { //Swap speed.
- skill = status->speed;
- status->speed = sd->prev_speed;
- sd->prev_speed = skill;
- }
- }
}
+
if(flag&(SCB_ASPD|SCB_AGI|SCB_DEX)) {
flag|=SCB_ASPD;
@@ -2763,18 +2752,7 @@ void status_calc_bl_sub_pc(struct map_session_data *sd, unsigned long flag)
skill = skill *status->aspd_rate/1000;
status->amotion = cap_value(skill,battle_config.max_aspd,2000);
-
status->adelay = 2*status->amotion;
- if ((skill=pc_checkskill(sd,SA_FREECAST))>0) {
- //Store casting adelay for quick restoration. [Skotlex]
- sd->prev_adelay = status->adelay*(150-5*skill)/100;
- if(sd->ud.skilltimer != -1) { //Swap adelay.
- skill = status->adelay;
- status->adelay = sd->prev_adelay;
- sd->prev_adelay = skill;
- }
- }
-
}
if(flag&(SCB_AGI|SCB_DSPD)) {
@@ -3699,10 +3677,15 @@ static signed short status_calc_mdef2(struct block_list *bl, struct status_chang
static unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc, int speed)
{
+ TBL_PC* sd = BL_CAST(BL_PC, bl);
+
//Default speed coming in means there's no speed_rate adjustments.
int new_speed = speed;
bool default_speed = (speed == DEFAULT_WALK_SPEED);
+ if( sd && sd->ud.skilltimer != -1 && pc_checkskill(sd,SA_FREECAST) > 0 )
+ speed = speed * (175 - 5 * pc_checkskill(sd,SA_FREECAST))/100;
+
if(!sc || !sc->count)
return cap_value(speed,10,USHRT_MAX);
@@ -4015,30 +3998,6 @@ static unsigned short status_calc_mode(struct block_list *bl, struct status_chan
return cap_value(mode,0,USHRT_MAX);
}
-/*==========================================
- * Quick swap of adelay/speed when starting ending SA_FREECAST
- *------------------------------------------*/
-void status_freecast_switch(struct map_session_data *sd)
-{
- struct status_data *status;
- unsigned short b_speed,tmp;
-
- status = &sd->battle_status;
-
- b_speed = status->speed;
-
- tmp = status->speed;
- status->speed = sd->prev_speed;
- sd->prev_speed = tmp;
-
- tmp = status->adelay;
- status->adelay = sd->prev_adelay;
- sd->prev_adelay = tmp;
-
- if(b_speed != status->speed)
- clif_updatestatus(sd,SP_SPEED);
-}
-
const char* status_get_name(struct block_list *bl)
{
nullpo_retr(0, bl);
diff --git a/src/map/status.h b/src/map/status.h
index 55fea6b2e..8e0ff6f85 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -806,7 +806,6 @@ void status_calc_misc(struct block_list *bl, struct status_data *status, int lev
void status_calc_regen(struct block_list *bl, struct status_data *status, struct regen_data *regen);
void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, struct status_change *sc);
-void status_freecast_switch(struct map_session_data *sd);
int status_getrefinebonus(int lv,int type);
int status_check_skilluse(struct block_list *src, struct block_list *target, int skill_num, int flag); // [Skotlex]
int status_check_visibility(struct block_list *src, struct block_list *target); //[Skotlex]
diff --git a/src/map/unit.c b/src/map/unit.c
index 07607603e..1da28c9e7 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1086,8 +1086,8 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
if(casttime > 0) {
ud->skilltimer = add_timer( tick+casttime, skill_castend_id, src->id, 0 );
- if(sd && pc_checkskill(sd,SA_FREECAST))
- status_freecast_switch(sd);
+ if( sd && pc_checkskill(sd,SA_FREECAST) > 0 )
+ status_calc_bl(&sd->bl, SCB_SPEED);
else
unit_stop_walking(src,1);
}
@@ -1187,8 +1187,8 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, sh
if(casttime > 0) {
ud->skilltimer = add_timer( tick+casttime, skill_castend_pos, src->id, 0 );
- if(sd && pc_checkskill(sd,SA_FREECAST))
- status_freecast_switch(sd);
+ if( sd && pc_checkskill(sd,SA_FREECAST) > 0 )
+ status_calc_bl(&sd->bl, SCB_SPEED);
else
unit_stop_walking(src,1);
}
@@ -1520,9 +1520,11 @@ int unit_skillcastcancel(struct block_list *bl,int type)
return 0;
}
- ud->canact_tick=tick;
- if(sd && pc_checkskill(sd,SA_FREECAST))
- status_freecast_switch(sd);
+ ud->canact_tick = tick;
+ ud->skilltimer = -1;
+
+ if( sd && pc_checkskill(sd,SA_FREECAST) > 0 )
+ status_calc_bl(&sd->bl, SCB_SPEED);
if(type&1 && sd)
skill = sd->skillid_old;
@@ -1538,7 +1540,6 @@ int unit_skillcastcancel(struct block_list *bl,int type)
if(bl->type==BL_MOB) ((TBL_MOB*)bl)->skillidx = -1;
- ud->skilltimer = -1;
clif_skillcastcancel(bl);
return 1;
}