Browse Source

* Fixed players can pull water from ME cell (follow up to r13730)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13733 54d463be-8e91-2dee-dedb-b68131a5f0ec
Inkfish 16 years ago
parent
commit
68a983ce4b
2 changed files with 14 additions and 24 deletions
  1. 2 0
      Changelog-Trunk.txt
  2. 12 24
      src/map/skill.c

+ 2 - 0
Changelog-Trunk.txt

@@ -3,6 +3,8 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2009/05/07
+	* Fixed players can pull water from ME cell (follow up to r13730) [Inkfish]
 2009/05/04
 	* Added the md5() script command. [brianluau]
 	* Now if a dead player is moved for whatever reason, he'll be alive with 1 HP. (bugreport:70) [Inkfish]

+ 12 - 24
src/map/skill.c

@@ -2826,41 +2826,29 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
 	case WZ_WATERBALL:
 		skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag);
 		{
-			int range = skilllv/2;
-			int size = 2*range + 1;
+			int range = skilllv / 2;
+			int maxlv = skill_get_max(skillid); // learnable level
 			int count = 0;
 			int x, y;
+			struct skill_unit* unit;
 
-			if( src->type == BL_PC )
-			{// count the number of water cells in range
-				struct skill_unit* unit;
-				int maxlv = skill_get_max(skillid);
+			if( src->type == BL_PC && skilllv > maxlv )
+				range = maxlv / 2;
 
-				if( skilllv > maxlv )
-					range =  maxlv / 2;
-
-				for( y = src->y - range; y <= src->y + range; ++y )
-					for( x = src->x - range; x <= src->x + range; ++x )
+			for( y = src->y - range; y <= src->y + range; ++y )
+				for( x = src->x - range; x <= src->x + range; ++x )
+				{
+					if( !map_find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL) )
 					{
-						if( map_getcell(src->m,x,y,CELL_CHKWATER) )
+						if( src->type != BL_PC || map_getcell(src->m,x,y,CELL_CHKWATER) ) // non-players bypass the water requirement
 							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 )
+						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
 						}
 					}
-			}
-			else
-			{ // non-players bypass the water requirement
-				count = size*size;
-				for( y = src->y - range; y <= src->y + range; ++y )
-					for( x = src->x - range; x <= src->x + range; ++x )
-						if( map_find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL) != NULL )
-							count--;
-			}
+				}
 
 			if( count > 1 ) // queue the remaining count - 1 timerskill Waterballs
 				skill_addtimerskill(src,tick+150,bl->id,0,0,skillid,skilllv,count-1,flag);