summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
authorpanikon <panikon@zoho.com>2014-07-10 02:02:59 -0300
committerpanikon <panikon@zoho.com>2014-07-10 02:02:59 -0300
commit9dd6ee636b783f1cd57b1be3d02fcc9782ebe2c3 (patch)
treeb633ab7d298a279b21d1cc0fafe8884deccd30f8 /src/map/unit.c
parent222345170f781b0cc19dfb99e0820098097a1254 (diff)
downloadhercules-9dd6ee636b783f1cd57b1be3d02fcc9782ebe2c3.tar.gz
hercules-9dd6ee636b783f1cd57b1be3d02fcc9782ebe2c3.tar.bz2
hercules-9dd6ee636b783f1cd57b1be3d02fcc9782ebe2c3.tar.xz
hercules-9dd6ee636b783f1cd57b1be3d02fcc9782ebe2c3.zip
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
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c6
1 files changed, 6 insertions, 0 deletions
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