summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-06-25 23:21:24 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-06-25 23:21:24 +0000
commitd433baee079a3168b4bf26cf25ed55342c81990c (patch)
tree87398d28faf50eb1e19332734a611461c241978c /src/map
parent04452763110f0245617c876ecbb271dffb01d05d (diff)
downloadhercules-d433baee079a3168b4bf26cf25ed55342c81990c.tar.gz
hercules-d433baee079a3168b4bf26cf25ed55342c81990c.tar.bz2
hercules-d433baee079a3168b4bf26cf25ed55342c81990c.tar.xz
hercules-d433baee079a3168b4bf26cf25ed55342c81990c.zip
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
Diffstat (limited to 'src/map')
-rw-r--r--src/map/skill.c105
-rw-r--r--src/map/skill.h3
2 files changed, 56 insertions, 52 deletions
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]