summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authoraleos <aleos@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-12-31 20:31:20 +0000
committeraleos <aleos@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-12-31 20:31:20 +0000
commite3b4f8c0367635534990a79cf896a7973e4764e1 (patch)
tree56073a937bca8bfc6159630ba3649bde3de58db2 /src/map
parentf2e6d012726b884d066094a045f74064326e89fa (diff)
downloadhercules-e3b4f8c0367635534990a79cf896a7973e4764e1.tar.gz
hercules-e3b4f8c0367635534990a79cf896a7973e4764e1.tar.bz2
hercules-e3b4f8c0367635534990a79cf896a7973e4764e1.tar.xz
hercules-e3b4f8c0367635534990a79cf896a7973e4764e1.zip
> Follow-up to r17048:
* 'npcskill' now uses AREA_SIZE as maximum distance rather than using skill distance. (bugreport:7069) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17068 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/unit.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index f8e887dc6..110fcb079 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1017,7 +1017,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
struct map_session_data *sd = NULL;
struct block_list * target = NULL;
unsigned int tick = gettick();
- int temp = 0;
+ int temp = 0, range;
nullpo_ret(src);
if(status_isdead(src))
@@ -1169,16 +1169,21 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
return 0;
}
+ if (src->type == BL_NPC) // NPC-objects can override cast distance
+ range = AREA_SIZE; // Maximum visible distance before NPC goes out of sight
+ else
+ range = skill_get_range2(src, skill_id, skill_lv); // Skill cast distance from database
+
//Check range when not using skill on yourself or is a combo-skill during attack
//(these are supposed to always have the same range as your attack)
if( src->id != target_id && (!temp || ud->attacktimer == INVALID_TIMER) ) {
if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE ) {
- if( !unit_can_reach_bl(src, target, skill_get_range2(src, skill_id,skill_lv) + 1, 1, NULL, NULL) )
+ if( !unit_can_reach_bl(src, target, range + 1, 1, NULL, NULL) )
return 0; // Walk-path check failed.
} else if( src->type == BL_MER && skill_id == MA_REMOVETRAP ) {
- if( !battle_check_range(battle_get_master(src), target, skill_get_range2(src, skill_id, skill_lv) + 1) )
+ if( !battle_check_range(battle_get_master(src), target, range + 1) )
return 0; // Aegis calc remove trap based on Master position, ignoring mercenary O.O
- } else if( !battle_check_range(src, target, skill_get_range2(src, skill_id,skill_lv) + (skill_id == RG_CLOSECONFINE?0:2)) ) {
+ } else if( !battle_check_range(src, target, range + (skill_id == RG_CLOSECONFINE?0:2)) ) {
return 0; // Arrow-path check failed.
}
}
@@ -1379,6 +1384,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
struct status_change *sc;
struct block_list bl;
unsigned int tick = gettick();
+ int range;
nullpo_ret(src);
@@ -1425,12 +1431,17 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
bl.x = skill_x;
bl.y = skill_y;
+ if (src->type == BL_NPC) // NPC-objects can override cast distance
+ range = AREA_SIZE; // Maximum visible distance before NPC goes out of sight
+ else
+ range = skill_get_range2(src, skill_id, skill_lv); // Skill cast distance from database
+
if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE )
{
- if( !unit_can_reach_bl(src, &bl, skill_get_range2(src, skill_id,skill_lv) + 1, 1, NULL, NULL) )
+ if( !unit_can_reach_bl(src, &bl, range + 1, 1, NULL, NULL) )
return 0; //Walk-path check failed.
}
- else if( !battle_check_range(src, &bl, skill_get_range2(src, skill_id,skill_lv) + 1) )
+ else if( !battle_check_range(src, &bl, range + 1) )
return 0; //Arrow-path check failed.
unit_stop_attack(src);