summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index 53e517045..c23e96aee 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -270,9 +270,8 @@ static int unit_steptimer(int tid, int64 tick, int id, intptr_t data)
} else {
// If a player has target_id set and target is in range, attempt attack
struct block_list *tbl = map->id2bl(target_id);
- nullpo_retr(2, tbl);
- if (status->check_visibility(bl, tbl) == 0) // Target not visible
- return 1;
+ if (tbl == NULL || status->check_visibility(bl, tbl) == 0)
+ return 1; // Target does not exist (player offline, monster died, etc.) or target is not visible to source.
if (ud->stepskill_id == 0)
unit->attack(bl, tbl->id, ud->state.attack_continue + 2); // Execute normal attack
else
@@ -1152,7 +1151,7 @@ static int unit_stop_walking(struct block_list *bl, int flag)
static int unit_skilluse_id(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv)
{
int casttime = skill->cast_fix(src, skill_id, skill_lv);
- int castcancel = skill->get_castcancel(skill_id);
+ int castcancel = skill->get_castcancel(skill_id, skill_lv);
int ret = unit->skilluse_id2(src, target_id, skill_id, skill_lv, casttime, castcancel);
struct map_session_data *sd = BL_CAST(BL_PC, src);
@@ -1567,7 +1566,7 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill
//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 (skill->get_state(ud->skill_id, ud->skill_lv) == ST_MOVE_ENABLE) {
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 ) {
@@ -1790,7 +1789,7 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill
static int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv)
{
int casttime = skill->cast_fix(src, skill_id, skill_lv);
- int castcancel = skill->get_castcancel(skill_id);
+ int castcancel = skill->get_castcancel(skill_id, skill_lv);
int ret = unit->skilluse_pos2(src, skill_x, skill_y, skill_id, skill_lv, casttime, castcancel);
struct map_session_data *sd = BL_CAST(BL_PC, src);
@@ -1872,7 +1871,7 @@ static int unit_skilluse_pos2(struct block_list *src, short skill_x, short skill
return 0; // Attacking will be handled by unit_walk_toxy_timer in this case
}
- if( skill->get_state(ud->skill_id) == ST_MOVE_ENABLE ) {
+ if (skill->get_state(ud->skill_id, ud->skill_lv) == 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) )