summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-01-04 16:57:53 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-01-04 16:57:53 +0000
commitf9eaf41366eabfa7f784e9d3eb0ed572b39f31c7 (patch)
treed353444583ccfa9c7467e63707daad035e472b25 /src/map/skill.c
parent4ca054f01983eaf5cfca204897eb43a7f9472d2a (diff)
downloadhercules-f9eaf41366eabfa7f784e9d3eb0ed572b39f31c7.tar.gz
hercules-f9eaf41366eabfa7f784e9d3eb0ed572b39f31c7.tar.bz2
hercules-f9eaf41366eabfa7f784e9d3eb0ed572b39f31c7.tar.xz
hercules-f9eaf41366eabfa7f784e9d3eb0ed572b39f31c7.zip
Waterball code cleanup (see bugreport:707)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12011 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c68
1 files changed, 28 insertions, 40 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 3e8ca67fa..a2c636ddc 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1994,32 +1994,6 @@ int skill_area_sub_count (struct block_list *src, struct block_list *target, int
return 1;
}
-int skill_count_water (struct block_list *src, int range)
-{
- int x,y,cnt = 0;
- struct skill_unit *unit;
-
- for( y = src->y - range; y <= src->y + range; ++y )
- {
- for( x = src->x - range; x <= src->x + range; ++x )
- {
- if (map_getcell(src->m,x,y,CELL_CHKWATER)) {
- cnt++;
- continue;
- }
- unit = map_find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL);
- if (!unit)
- unit = map_find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL);
- if (unit) {
- cnt++;
- skill_delunit(unit);
- }
- }
- }
-
- return cnt;
-}
-
/*==========================================
*
*------------------------------------------*/
@@ -2660,23 +2634,37 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
skill_attack(BF_MAGIC,src,src,bl,sid,skilllv,tick,flag|SD_LEVEL);
}
break;
- case WZ_WATERBALL: /* ウォーターボール */
+ case WZ_WATERBALL:
skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag);
- if (skilllv>1) {
- int range = skilllv/2;
- int cnt;
- if (sd)
- cnt = skill_count_water(src,range);
- else {
- range = 2*range+1;
- cnt = range*range;
+ {
+ int range = skilllv/2;
+ int size = 2*range + 1;
+ int count = 0;
+
+ if( src->type == BL_PC )
+ {// count the number of water cells in range
+ struct skill_unit* unit;
+ int x, y;
+ for( y = src->y - range; y <= src->y + range; ++y )
+ for( x = src->x - range; x <= src->x + range; ++x )
+ {
+ if( map_getcell(src->m,x,y,CELL_CHKWATER) )
+ count++; // natural water cell
+ else
+ if( (unit = map_find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL)) != NULL
+ || (unit = map_find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL)) != NULL )
+ {
+ count++; // skill-induced water cell
+ skill_delunit(unit); // consume cell
+ }
}
- cnt--;
- if (cnt > 0)
- skill_addtimerskill(src,tick+125,bl->id,0,0,skillid,skilllv,cnt,flag);
- } else if (sd) //Eat up deluge tiles.
- skill_count_water(src,0);
+ }
+ else // non-players bypass the water requirement
+ count = size*size;
+ if( count > 1 ) // queue the remaining count - 1 timerskill Waterballs
+ skill_addtimerskill(src,tick+150,bl->id,0,0,skillid,skilllv,count-1,flag);
+ }
break;
case PR_BENEDICTIO: