Browse Source

Fixed Error Messages when using Splash Skills on Skill Units (#9140)

* Fixed Error Messages when using Splash Skills on Skill Units
- Prevent sending 0 as number of targets when splash skills split damage among targets
  * This happened when using splash skills on skill units such as Icewall
  * Map server console will no longer be spammed with division by 0 error messages
- Fixes #5410
Playtester 2 tháng trước cách đây
mục cha
commit
36033f8065
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      src/map/skill.cpp

+ 5 - 1
src/map/skill.cpp

@@ -6114,8 +6114,12 @@ int32 skill_castend_damage_id (struct block_list* src, struct block_list *bl, ui
 			// if skill damage should be split among targets, count them
 			//SD_LEVEL -> Forced splash damage for Auto Blitz-Beat -> count targets
 			//special case: Venom Splasher uses a different range for searching than for splashing
-			if( flag&SD_LEVEL || skill_get_nk(skill_id, NK_SPLASHSPLIT) )
+			if (flag&SD_LEVEL || skill_get_nk(skill_id, NK_SPLASHSPLIT)) {
 				skill_area_temp[0] = map_foreachinallrange(skill_area_sub, bl, (skill_id == AS_SPLASHER)?1:splash_size, BL_CHAR, src, skill_id, skill_lv, tick, BCT_ENEMY, skill_area_sub_count);
+				// If there are no characters in the area, then it always counts as if there was one target
+				// This happens when targetting skill units such as icewall
+				skill_area_temp[0] = std::max(1, skill_area_temp[0]);
+			}
 
 			// recursive invocation of skill_castend_damage_id() with flag|1
 			map_foreachinrange(skill_area_sub, bl, splash_size, starget, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id);