summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c9
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/mob.c6
-rw-r--r--src/map/skill.c2
4 files changed, 15 insertions, 4 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 221c2c2de..0474d82a0 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3430,6 +3430,15 @@ bool battle_check_range(struct block_list *src, struct block_list *bl, int range
if( src->m != bl->m )
return false;
+#ifndef CIRCULAR_AREA
+ if( src->type == BL_PC )
+ { // Range for players' attacks and skills should always have a circular check. [Inkfish]
+ int dx = src->x - bl->x, dy = src->y - bl->y;
+ if( !check_distance(dx*dx + dy*dy, 0, range*range+(dx&&dy?1:0)) )
+ return false;
+ }
+ else
+#endif
if( !check_distance_bl(src, bl, range) )
return false;
diff --git a/src/map/clif.c b/src/map/clif.c
index 7f8b77c31..855d4c6f0 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9516,7 +9516,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
{
if( skilllv != sd->skillitemlv )
skilllv = sd->skillitemlv;
- if( !(skill_get_inf(skillnum)&INF_SELF_SKILL) )
+ if( !(tmp&INF_SELF_SKILL) )
pc_delinvincibletimer(sd); // Target skills thru items cancel invincibility. [Inkfish]
unit_skilluse_id(&sd->bl, target_id, skillnum, skilllv);
return;
diff --git a/src/map/mob.c b/src/map/mob.c
index 367d2ff7d..e6fa8d2fd 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3004,7 +3004,8 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
}
md->skillidx = i;
map_freeblock_lock();
- if (!unit_skilluse_pos2(&md->bl, x, y, ms[i].skill_id, ms[i].skill_lv, ms[i].casttime, ms[i].cancel))
+ if( !battle_check_range(&md->bl,bl,skill_get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) ||
+ !unit_skilluse_pos2(&md->bl, x, y,ms[i].skill_id, ms[i].skill_lv,ms[i].casttime, ms[i].cancel) )
{
map_freeblock_unlock();
continue;
@@ -3040,7 +3041,8 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
if (!bl) continue;
md->skillidx = i;
map_freeblock_lock();
- if (!unit_skilluse_id2(&md->bl, bl->id, ms[i].skill_id, ms[i].skill_lv, ms[i].casttime, ms[i].cancel))
+ if( !battle_check_range(&md->bl,bl,skill_get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) ||
+ !unit_skilluse_id2(&md->bl, bl->id,ms[i].skill_id, ms[i].skill_lv,ms[i].casttime, ms[i].cancel) )
{
map_freeblock_unlock();
continue;
diff --git a/src/map/skill.c b/src/map/skill.c
index ec8115080..eee0236a6 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -218,7 +218,7 @@ int skill_get_casttype (int id)
int skill_get_range2 (struct block_list *bl, int id, int lv)
{
int range;
- if( bl->type == BL_MOB && !(battle_config.mob_ai&0x400) )
+ if( bl->type == BL_MOB && battle_config.mob_ai&0x400 )
return 9; //Mobs have a range of 9 regardless of skill used.
range = skill_get_range(id, lv);