summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
author(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-01 11:22:25 +0000
committer(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-01 11:22:25 +0000
commit910f4d54f14d3859318082205bd00d4f256c38fb (patch)
treefa5094820bcfc5cfd62d23c51db911760a09bbdf /src/map/skill.c
parentefeb89f34eccad6613e97c711fd5ef561ed0e4e3 (diff)
downloadhercules-910f4d54f14d3859318082205bd00d4f256c38fb.tar.gz
hercules-910f4d54f14d3859318082205bd00d4f256c38fb.tar.bz2
hercules-910f4d54f14d3859318082205bd00d4f256c38fb.tar.xz
hercules-910f4d54f14d3859318082205bd00d4f256c38fb.zip
Updated skill_range_leniency code when casting a ground targetting spell
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1018 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index ae06305d2..b57b2d2aa 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -811,12 +811,11 @@ int skill_count_target(struct block_list *bl, va_list ap );
// [MouseJstr] - skill ok to cast? and when?
int skillnotok(int skillid, struct map_session_data *sd) {
- if (sd == 0)
- return 0;
+ nullpo_retr (1, sd);
- if (!(skillid >= 10000 && skillid < 10015))
- if ((skillid > MAX_SKILL) || (skillid < 0))
- return 1;
+ if (!(skillid >= 10000 && skillid < 10015))
+ if ((skillid > MAX_SKILL) || (skillid < 0))
+ return 1;
if (pc_isGM(sd) >= 20)
return 0; // gm's can do anything damn thing they want
@@ -7806,14 +7805,28 @@ int skill_use_pos( struct map_session_data *sd,
bl.m = sd->bl.m;
bl.x = skill_x;
bl.y = skill_y;
- range = skill_get_range(skill_num,skill_lv);
- if(range < 0)
- range = status_get_range(&sd->bl) - (range + 1);
-// be lenient if the skill was cast before we have moved to the correct position [Celest]
- if (sd->walktimer != -1)
- range += battle_config.skill_range_leniency;
- if(!battle_check_range(&sd->bl,&bl,range) )
- return 0;
+
+ {
+ int check_range_flag = 0;
+
+ /* 射程と障害物チェック */
+ range = skill_get_range(skill_num,skill_lv);
+ if(range < 0)
+ range = status_get_range(&sd->bl) - (range + 1);
+ // be lenient if the skill was cast before we have moved to the correct position [Celest]
+ if (sd->walktimer != -1)
+ range += battle_config.skill_range_leniency;
+ else check_range_flag = 1;
+ if(!battle_check_range(&sd->bl,&bl,range)) {
+ if (check_range_flag && battle_check_range(&sd->bl,&bl,range + battle_config.skill_range_leniency)) {
+ int dir, mask[8][2] = {{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1},{1,0},{1,1}};
+ dir = map_calc_dir(&sd->bl,bl.x,bl.y);
+ pc_walktoxy (sd, sd->bl.x + mask[dir][0] * battle_config.skill_range_leniency,
+ sd->bl.y + mask[dir][1] * battle_config.skill_range_leniency);
+ } else
+ return 0;
+ }
+ }
pc_stopattack(sd);