From 9dd6ee636b783f1cd57b1be3d02fcc9782ebe2c3 Mon Sep 17 00:00:00 2001 From: panikon Date: Thu, 10 Jul 2014 02:02:59 -0300 Subject: Corrected some SC behaviour, special thanks to Rytech - Extracted some methods to check SC blocks - Fixed issue that when players couldn't attack they couldn't talk to NPCs with mob view id either Follow up to ec51176326c6028630835538db67826281d34ffe, fixed minor typo --- src/map/unit.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/map/unit.c') diff --git a/src/map/unit.c b/src/map/unit.c index 875eb30af..e5c7c45c1 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -909,6 +909,7 @@ int unit_can_move(struct block_list *bl) { )) return 0; //Can't move + // Status changes that block movement if (sc) { if( sc->count && ( @@ -1602,6 +1603,10 @@ int unit_attack(struct block_list *src,int target_id,int continuous) { unit->stop_attack(src); return 0; } + if( !pc->can_attack(sd, target_id) ) { + unit->stop_attack(src); + return 0; + } } if( battle->check_target(src,target,BCT_ENEMY) <= 0 || !status->check_skilluse(src, target, 0, 0) ) { unit->unattackable(src); @@ -1791,6 +1796,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) { #ifdef OFFICIAL_WALKPATH || !path->search_long(NULL, src->m, src->x, src->y, target->x, target->y, CELL_CHKWALL) #endif + || (sd && !pc->can_attack(sd, ud->target) ) ) return 0; // can't attack under these conditions -- cgit v1.2.3-60-g2f50