浏览代码

Adjusts map_foreachindir to include caster's cell (#5314)

* Fixes #3502.
* Adjusts map_foreachindir to include the caster's cell when calculating area of effect.
* Adds battle config 'skill_eightpath_same_cell' to allow toggling of the effect.
Thanks to @mrjnumber1!
Aleos 4 年之前
父节点
当前提交
3060865aa0
共有 4 个文件被更改,包括 8 次插入2 次删除
  1. 4 0
      conf/battle/skill.conf
  2. 1 0
      src/map/battle.cpp
  3. 1 0
      src/map/battle.hpp
  4. 2 2
      src/map/map.cpp

+ 4 - 0
conf/battle/skill.conf

@@ -355,6 +355,10 @@ default_fixed_castrate: 20
 // Note: Brandish Spear will always use this algorithm due to its special damage behavior.
 skill_eightpath_algorithm: yes
 
+// Should skills that use skill_eightpath_algorithm include targets in the caster's cell?
+// Official: yes
+skill_eightpath_same_cell: yes
+
 // Can damage skill units like icewall and traps (Note 3)
 // On official servers, players can damage icewalls and some traps with skills. When monsters use skills, damage
 // will show on the icewalls and traps, but it is not actually substracted from the durability.

+ 1 - 0
src/map/battle.cpp

@@ -8939,6 +8939,7 @@ static const struct _battle_data {
 	{ "monster_eye_range_bonus",            &battle_config.mob_eye_range_bonus,             0,      0,      10,             },
 	{ "monster_stuck_warning",              &battle_config.mob_stuck_warning,               0,      0,      1,              },
 	{ "skill_eightpath_algorithm",          &battle_config.skill_eightpath_algorithm,       1,      0,      1,              },
+	{ "skill_eightpath_same_cell",          &battle_config.skill_eightpath_same_cell,       1,      0,      1,              },
 	{ "death_penalty_maxlv",                &battle_config.death_penalty_maxlv,             0,      0,      3,              },
 	{ "exp_cost_redemptio",                 &battle_config.exp_cost_redemptio,              1,      0,      100,            },
 	{ "exp_cost_redemptio_limit",           &battle_config.exp_cost_redemptio_limit,        5,      0,      MAX_PARTY,      },

+ 1 - 0
src/map/battle.hpp

@@ -622,6 +622,7 @@ struct Battle_Config
 	int mob_eye_range_bonus; //Vulture's Eye and Snake's Eye range bonus
 	int mob_stuck_warning; //Show warning if a monster is stuck too long
 	int skill_eightpath_algorithm; //Official path algorithm
+	int skill_eightpath_same_cell;
 	int death_penalty_maxlv;
 	int exp_cost_redemptio;
 	int exp_cost_redemptio_limit;

+ 2 - 2
src/map/map.cpp

@@ -1420,7 +1420,7 @@ int map_foreachindir(int(*func)(struct block_list*, va_list), int16 m, int16 x0,
 						rx = (bl->x - x0);
 						ry = (bl->y - y0);
 						//Do not hit source cell
-						if (rx == 0 && ry == 0)
+						if (battle_config.skill_eightpath_same_cell == 0 && rx == 0 && ry == 0)
 							continue;
 						//This turns it so that the area that is hit is always with positive rx and ry
 						rx *= dx;
@@ -1456,7 +1456,7 @@ int map_foreachindir(int(*func)(struct block_list*, va_list), int16 m, int16 x0,
 						rx = (bl->x - x0);
 						ry = (bl->y - y0);
 						//Do not hit source cell
-						if (rx == 0 && ry == 0)
+						if (battle_config.skill_eightpath_same_cell == 0 && rx == 0 && ry == 0)
 							continue;
 						//This turns it so that the area that is hit is always with positive rx and ry
 						rx *= dx;