Browse Source

- Some code cleaning of the skill reiteration/nofootset code.
- skill reiteration code now does not checks for the trigger-area of the skill in the case of non-players, which means mobs can now place traps in cells adjacent to each other.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6640 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 năm trước cách đây
mục cha
commit
862dde5c5b
4 tập tin đã thay đổi với 18 bổ sung28 xóa
  1. 3 0
      Changelog-Trunk.txt
  2. 3 2
      conf-tmpl/battle/skill.conf
  3. 12 24
      src/map/skill.c
  4. 0 2
      src/map/skill.h

+ 3 - 0
Changelog-Trunk.txt

@@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/05/18
+	* skill reiteration code now does not checks for the trigger-area of the
+	  skill in the case of non-players, which means mobs can now place traps in
+	  cells adjacent to each other. [Skotlex]
 	* Applied an experimental weather code that should lower bandwidth usage to
 	  near-none, which's only disadvantage should be the weather not clearing out
 	  until moving to another map (even when the mapflag is removed from the

+ 3 - 2
conf-tmpl/battle/skill.conf

@@ -109,8 +109,9 @@ combo_delay_rate: 100
 auto_counter_type: 15
 
 // Can ground skills be placed on top of each other? (Note 4)
-// If set, only skills with UF_NOREITERATION set will be affected (skill_unit_db)
-skill_reiteration: 2
+// By default, skills with UF_NOREITERATION set cannot be stacked on top of 
+// other skills, this setting will override that. (skill_unit_db)
+skill_reiteration: 0
 
 // Can ground skills NOT be placed underneath/near players/monsters? (Note 4)
 // If set, only skills with UF_NOFOOTSET set will be affected (skill_unit_db)

+ 12 - 24
src/map/skill.c

@@ -2148,31 +2148,25 @@ static int skill_check_unit_range_sub( struct block_list *bl,va_list ap )
 	return 1;
 }
 
-int skill_check_unit_range(int m,int x,int y,int skillid,int skilllv)
+static int skill_check_unit_range(struct block_list *bl,int x,int y,int skillid,int skilllv)
 {
-	int range = skill_get_unit_range(skillid, skilllv);
+	//Non players do not check for the skill's splash-trigger area.
+	int range = bl->type==BL_PC?skill_get_unit_range(skillid, skilllv):0;
 	int layout_type = skill_get_unit_layout_type(skillid,skilllv);
 	if (layout_type==-1 || layout_type>MAX_SQUARE_LAYOUT) {
 		ShowError("skill_check_unit_range: unsupported layout type %d for skill %d\n",layout_type,skillid);
 		return 0;
 	}
 
-	// とり� えず?ウ方形のユニットレイアウトのみ対応
 	range += layout_type;
-	return map_foreachinarea(skill_check_unit_range_sub,m,
+	return map_foreachinarea(skill_check_unit_range_sub,bl->m,
 			x-range,y-range,x+range,y+range,BL_SKILL,skillid);
 }
 
 static int skill_check_unit_range2_sub( struct block_list *bl,va_list ap )
 {
-	int *c;
 	int skillid;
 
-
-	nullpo_retr(0, bl);
-	nullpo_retr(0, ap);
-	nullpo_retr(0, c = va_arg(ap,int *));
-
 	if(bl->prev == NULL)
 		return 0;
 
@@ -2183,17 +2177,14 @@ static int skill_check_unit_range2_sub( struct block_list *bl,va_list ap )
 	if (skillid==HP_BASILICA && bl->type==BL_PC)
 		return 0;
 
-	if (skillid==AM_DEMONSTRATION && bl->type==BL_MOB && ((struct mob_data*)bl)->class_ == MOBID_EMPERIUM)
+	if (skillid==AM_DEMONSTRATION && bl->type==BL_MOB && ((TBL_MOB*)bl)->class_ == MOBID_EMPERIUM)
 		return 0; //Allow casting Bomb/Demonstration Right under emperium [Skotlex]
-	
-	(*c)++;
-
 	return 1;
 }
 
-int skill_check_unit_range2(struct block_list *bl, int m,int x,int y,int skillid, int skilllv)
+static int skill_check_unit_range2(struct block_list *bl, int x,int y,int skillid, int skilllv)
 {
-	int c = 0, range, type;
+	int range, type;
 
 	switch (skillid) {	// to be expanded later
 	case WZ_ICEWALL:
@@ -2206,7 +2197,6 @@ int skill_check_unit_range2(struct block_list *bl, int m,int x,int y,int skillid
 				ShowError("skill_check_unit_range2: unsupported layout type %d for skill %d\n",layout_type,skillid);
 				return 0;
 			}
-			// とり� えず?ウ方形のユニットレイアウトのみ対応
 			range = skill_get_unit_range(skillid,skilllv) + layout_type;
 		}
 		break;
@@ -2219,11 +2209,9 @@ int skill_check_unit_range2(struct block_list *bl, int m,int x,int y,int skillid
 	else
 		type = BL_PC;
 
-	map_foreachinarea(skill_check_unit_range2_sub, m,
+	return map_foreachinarea(skill_check_unit_range2_sub, bl->m,
 		x - range, y - range, x + range, y + range,
-		type, &c, skillid);
-
-	return c;
+		type, skillid);
 }
 
 int skill_guildaura_sub (struct block_list *bl,va_list ap)
@@ -5760,13 +5748,13 @@ int skill_castend_pos( int tid, unsigned int tick, int id,int data )
 
 		if (!(battle_config.skill_reiteration && src->type&battle_config.skill_reiteration) &&
 			skill_get_unit_flag(ud->skillid)&UF_NOREITERATION &&
-			skill_check_unit_range(src->m,ud->skillx,ud->skilly,ud->skillid,ud->skilllv)
+			skill_check_unit_range(src,ud->skillx,ud->skilly,ud->skillid,ud->skilllv)
 		)
 			break;
 
 		if (battle_config.skill_nofootset && src->type&battle_config.skill_nofootset &&
 			skill_get_unit_flag(ud->skillid)&UF_NOFOOTSET &&
-			skill_check_unit_range2(src, src->m,ud->skillx,ud->skilly,ud->skillid,ud->skilllv)
+			skill_check_unit_range2(src,ud->skillx,ud->skilly,ud->skillid,ud->skilllv)
 		)
 			break;
 		
@@ -6253,7 +6241,7 @@ int skill_castend_map( struct map_session_data *sd,int skill_num, const char *ma
 				return 0;
 			}
 			
-			if(skill_check_unit_range2(&sd->bl,sd->bl.m,wx,wy,skill_num,lv) > 0) {
+			if(skill_check_unit_range2(&sd->bl,wx,wy,skill_num,lv) > 0) {
 				clif_skill_fail(sd,0,0,0);
 				skill_failed(sd);
 				return 0;

+ 0 - 2
src/map/skill.h

@@ -199,8 +199,6 @@ int skill_castfix_sc( struct block_list *bl, int time);
 int skill_delayfix( struct block_list *bl, int skill_id, int skill_lv);
 int skill_check_condition( struct map_session_data *sd,int skill, int lv, int type);
 int skill_check_pc_partner(struct map_session_data *sd, int skill_id, int* skill_lv, int range, int cast_flag);
-int skill_check_unit_range(int m,int x,int y,int skillid, int skilllv);
-int skill_check_unit_range2(struct block_list *bl,int m,int x,int y,int skillid, int skilllv);
 // -- moonsoul	(added skill_check_unit_cell)
 int skill_check_unit_cell(int skillid,int m,int x,int y,int unit_id);
 int skill_unit_out_all( struct block_list *bl,unsigned int tick,int range);