From d433baee079a3168b4bf26cf25ed55342c81990c Mon Sep 17 00:00:00 2001 From: ultramage Date: Sat, 25 Jun 2011 23:21:24 +0000 Subject: Slightly cleaned up some ancient Brandish Spear code: * remove helper 'struct square' from common/mmo.h * moved skill_castend_nodamage_id's case ML_BRANDISH to separate function git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14866 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/skill.c | 105 +++++++++++++++++++++++++++++--------------------------- src/map/skill.h | 3 +- 2 files changed, 56 insertions(+), 52 deletions(-) (limited to 'src/map') diff --git a/src/map/skill.c b/src/map/skill.c index e16c8573c..58198a355 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -3958,51 +3958,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case KN_BRANDISHSPEAR: case ML_BRANDISH: - { - int c,n=4; - int dir = map_calc_dir(src,bl->x,bl->y); - struct square tc; - int x=bl->x,y=bl->y; - skill_brandishspear_first(&tc,dir,x,y); - skill_brandishspear_dir(&tc,dir,4); - skill_area_temp[1] = bl->id; - - if(skilllv > 9){ - for(c=1;c<4;c++){ - map_foreachincell(skill_area_sub, - bl->m,tc.val1[c],tc.val2[c],BL_CHAR, - src,skillid,skilllv,tick, flag|BCT_ENEMY|n, - skill_castend_damage_id); - } - } - if(skilllv > 6){ - skill_brandishspear_dir(&tc,dir,-1); - n--; - }else{ - skill_brandishspear_dir(&tc,dir,-2); - n-=2; - } - - if(skilllv > 3){ - for(c=0;c<5;c++){ - map_foreachincell(skill_area_sub, - bl->m,tc.val1[c],tc.val2[c],BL_CHAR, - src,skillid,skilllv,tick, flag|BCT_ENEMY|n, - skill_castend_damage_id); - if(skilllv > 6 && n==3 && c==4){ - skill_brandishspear_dir(&tc,dir,-1); - n--;c=-1; - } - } - } - for(c=0;c<10;c++){ - if(c==0||c==5) skill_brandishspear_dir(&tc,dir,-1); - map_foreachincell(skill_area_sub, - bl->m,tc.val1[c%5],tc.val2[c%5],BL_CHAR, - src,skillid,skilllv,tick, flag|BCT_ENEMY|1, - skill_castend_damage_id); - } - } + skill_brandishspear(src, bl, skillid, skilllv, tick, flag); break; case WZ_SIGHTRASHER: @@ -9149,7 +9105,12 @@ int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv) /*========================================= * *-----------------------------------------*/ -void skill_brandishspear_first (struct square *tc, int dir, int x, int y) +struct square { + int val1[5]; + int val2[5]; +}; + +static void skill_brandishspear_first (struct square *tc, int dir, int x, int y) { nullpo_retv(tc); @@ -9252,10 +9213,7 @@ void skill_brandishspear_first (struct square *tc, int dir, int x, int y) } -/*========================================= - * - *-----------------------------------------*/ -void skill_brandishspear_dir (struct square* tc, int dir, int are) +static void skill_brandishspear_dir (struct square* tc, int dir, int are) { int c; nullpo_retv(tc); @@ -9276,6 +9234,53 @@ void skill_brandishspear_dir (struct square* tc, int dir, int are) } } +void skill_brandishspear(struct block_list* src, struct block_list* bl, int skillid, int skilllv, unsigned int tick, int flag) +{ + int c,n=4; + int dir = map_calc_dir(src,bl->x,bl->y); + struct square tc; + int x=bl->x,y=bl->y; + skill_brandishspear_first(&tc,dir,x,y); + skill_brandishspear_dir(&tc,dir,4); + skill_area_temp[1] = bl->id; + + if(skilllv > 9){ + for(c=1;c<4;c++){ + map_foreachincell(skill_area_sub, + bl->m,tc.val1[c],tc.val2[c],BL_CHAR, + src,skillid,skilllv,tick, flag|BCT_ENEMY|n, + skill_castend_damage_id); + } + } + if(skilllv > 6){ + skill_brandishspear_dir(&tc,dir,-1); + n--; + }else{ + skill_brandishspear_dir(&tc,dir,-2); + n-=2; + } + + if(skilllv > 3){ + for(c=0;c<5;c++){ + map_foreachincell(skill_area_sub, + bl->m,tc.val1[c],tc.val2[c],BL_CHAR, + src,skillid,skilllv,tick, flag|BCT_ENEMY|n, + skill_castend_damage_id); + if(skilllv > 6 && n==3 && c==4){ + skill_brandishspear_dir(&tc,dir,-1); + n--;c=-1; + } + } + } + for(c=0;c<10;c++){ + if(c==0||c==5) skill_brandishspear_dir(&tc,dir,-1); + map_foreachincell(skill_area_sub, + bl->m,tc.val1[c%5],tc.val2[c%5],BL_CHAR, + src,skillid,skilllv,tick, flag|BCT_ENEMY|1, + skill_castend_damage_id); + } +} + /*========================================== * Weapon Repair [Celest/DracoRPG] *------------------------------------------*/ diff --git a/src/map/skill.h b/src/map/skill.h index a4f52e5cf..2046fe2c2 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -315,8 +315,7 @@ int skill_guildaura_sub (struct block_list *bl,va_list ap); int skill_castcancel(struct block_list *bl,int type); int skill_sit (struct map_session_data *sd, int type); -void skill_brandishspear_first(struct square *tc,int dir,int x,int y); -void skill_brandishspear_dir(struct square *tc,int dir,int are); +void skill_brandishspear(struct block_list* src, struct block_list* bl, int skillid, int skilllv, unsigned int tick, int flag); void skill_repairweapon(struct map_session_data *sd, int idx); void skill_identify(struct map_session_data *sd,int idx); void skill_weaponrefine(struct map_session_data *sd,int idx); // [Celest] -- cgit v1.2.3-70-g09d2