|
@@ -1602,7 +1602,7 @@ int unit_set_walkdelay(struct block_list *bl, t_tick tick, t_tick delay, int typ
|
|
* @param castcancel: Whether or not the skill can be cancelled by interruption (hit)
|
|
* @param castcancel: Whether or not the skill can be cancelled by interruption (hit)
|
|
* @return Success(1); Fail(0);
|
|
* @return Success(1); Fail(0);
|
|
*/
|
|
*/
|
|
-int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel)
|
|
|
|
|
|
+int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel, bool ignore_range)
|
|
{
|
|
{
|
|
struct unit_data *ud;
|
|
struct unit_data *ud;
|
|
struct status_data *tstatus;
|
|
struct status_data *tstatus;
|
|
@@ -1747,7 +1747,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
// Fail if the targetted skill is near NPC [Cydh]
|
|
// Fail if the targetted skill is near NPC [Cydh]
|
|
- if(skill->inf2[INF2_DISABLENEARNPC] && skill_isNotOk_npcRange(src,skill_id,skill_lv,target->x,target->y)) {
|
|
|
|
|
|
+ if(skill->inf2[INF2_DISABLENEARNPC] && !ignore_range && skill_isNotOk_npcRange(src,skill_id,skill_lv,target->x,target->y)) {
|
|
if (sd)
|
|
if (sd)
|
|
clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
|
|
clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
|
|
|
|
|
|
@@ -1864,7 +1864,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
|
|
if(ud->stepaction || ud->steptimer != INVALID_TIMER)
|
|
if(ud->stepaction || ud->steptimer != INVALID_TIMER)
|
|
unit_stop_stepaction(src);
|
|
unit_stop_stepaction(src);
|
|
// Remember the skill request from the client while walking to the next cell
|
|
// Remember the skill request from the client while walking to the next cell
|
|
- if(src->type == BL_PC && ud->walktimer != INVALID_TIMER && !battle_check_range(src, target, range-1)) {
|
|
|
|
|
|
+ if(src->type == BL_PC && ud->walktimer != INVALID_TIMER && (!battle_check_range(src, target, range-1) || ignore_range)) {
|
|
ud->stepaction = true;
|
|
ud->stepaction = true;
|
|
ud->target_to = target_id;
|
|
ud->target_to = target_id;
|
|
ud->stepskill_id = skill_id;
|
|
ud->stepskill_id = skill_id;
|
|
@@ -1874,7 +1874,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
|
|
|
|
|
|
// Check range when not using skill on yourself or is a combo-skill during attack
|
|
// 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)
|
|
// (these are supposed to always have the same range as your attack)
|
|
- if( src->type != BL_NPC && src->id != target_id && (!combo || ud->attacktimer == INVALID_TIMER) ) {
|
|
|
|
|
|
+ if( src->type != BL_NPC && !ignore_range && src->id != target_id && (!combo || ud->attacktimer == INVALID_TIMER) ) {
|
|
if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE ) {
|
|
if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE ) {
|
|
if( !unit_can_reach_bl(src, target, range + 1, 1, NULL, NULL) )
|
|
if( !unit_can_reach_bl(src, target, range + 1, 1, NULL, NULL) )
|
|
return 0; // Walk-path check failed.
|
|
return 0; // Walk-path check failed.
|
|
@@ -2010,7 +2010,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
|
|
|
|
|
|
mobskill_event(md, src, tick, -1); // Cast targetted skill event.
|
|
mobskill_event(md, src, tick, -1); // Cast targetted skill event.
|
|
|
|
|
|
- if ((status_has_mode(tstatus,MD_CASTSENSORIDLE) || status_has_mode(tstatus,MD_CASTSENSORCHASE)) && battle_check_target(target, src, BCT_ENEMY) > 0) {
|
|
|
|
|
|
+ if ((status_has_mode(tstatus,MD_CASTSENSORIDLE) || status_has_mode(tstatus,MD_CASTSENSORCHASE)) && battle_check_target(target, src, BCT_ENEMY) > 0 && !ignore_range) {
|
|
switch (md->state.skillstate) {
|
|
switch (md->state.skillstate) {
|
|
case MSS_RUSH:
|
|
case MSS_RUSH:
|
|
case MSS_FOLLOW:
|
|
case MSS_FOLLOW:
|
|
@@ -2117,7 +2117,7 @@ int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint
|
|
* @param castcancel: Whether or not the skill can be cancelled by interuption (hit)
|
|
* @param castcancel: Whether or not the skill can be cancelled by interuption (hit)
|
|
* @return Success(1); Fail(0);
|
|
* @return Success(1); Fail(0);
|
|
*/
|
|
*/
|
|
-int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel)
|
|
|
|
|
|
+int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel, bool ignore_range)
|
|
{
|
|
{
|
|
map_session_data *sd = NULL;
|
|
map_session_data *sd = NULL;
|
|
struct unit_data *ud = NULL;
|
|
struct unit_data *ud = NULL;
|
|
@@ -2170,7 +2170,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
// Fail if the targetted skill is near NPC [Cydh]
|
|
// Fail if the targetted skill is near NPC [Cydh]
|
|
- if(skill_get_inf2(skill_id, INF2_DISABLENEARNPC) && skill_isNotOk_npcRange(src,skill_id,skill_lv,skill_x,skill_y)) {
|
|
|
|
|
|
+ if(skill_get_inf2(skill_id, INF2_DISABLENEARNPC) && !ignore_range && skill_isNotOk_npcRange(src,skill_id,skill_lv,skill_x,skill_y)) {
|
|
if (sd)
|
|
if (sd)
|
|
clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
|
|
clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
|
|
|
|
|
|
@@ -2192,7 +2192,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
|
|
if(ud->stepaction || ud->steptimer != INVALID_TIMER)
|
|
if(ud->stepaction || ud->steptimer != INVALID_TIMER)
|
|
unit_stop_stepaction(src);
|
|
unit_stop_stepaction(src);
|
|
// Remember the skill request from the client while walking to the next cell
|
|
// Remember the skill request from the client while walking to the next cell
|
|
- if(src->type == BL_PC && ud->walktimer != INVALID_TIMER && !battle_check_range(src, &bl, range-1)) {
|
|
|
|
|
|
+ if(src->type == BL_PC && ud->walktimer != INVALID_TIMER && (!battle_check_range(src, &bl, range-1) || ignore_range)) {
|
|
struct map_data *md = &map[src->m];
|
|
struct map_data *md = &map[src->m];
|
|
// Convert coordinates to target_to so we can use it as target later
|
|
// Convert coordinates to target_to so we can use it as target later
|
|
ud->stepaction = true;
|
|
ud->stepaction = true;
|
|
@@ -2202,12 +2202,13 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
|
|
return 0; // Attacking will be handled by unit_walktoxy_timer in this case
|
|
return 0; // Attacking will be handled by unit_walktoxy_timer in this case
|
|
}
|
|
}
|
|
|
|
|
|
- if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE ) {
|
|
|
|
- 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, range) )
|
|
|
|
- return 0; // Arrow-path check failed.
|
|
|
|
-
|
|
|
|
|
|
+ if (!ignore_range) {
|
|
|
|
+ if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE ) {
|
|
|
|
+ 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, range) )
|
|
|
|
+ return 0; // Arrow-path check failed.
|
|
|
|
+ }
|
|
unit_stop_attack(src);
|
|
unit_stop_attack(src);
|
|
|
|
|
|
// Moved here to prevent Suffragium from ending if skill fails
|
|
// Moved here to prevent Suffragium from ending if skill fails
|