diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-07-08 17:49:26 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-07-08 17:49:26 +0000 |
commit | 2c9c73b3121b9bba577c053ebbf8783e69b73f59 (patch) | |
tree | 64e30bc6ac99fb588260efb0f13706bcd6380db1 /src/map/status.c | |
parent | 01a1daae3343e0c993de83e7c38fab6a7f5bf5d4 (diff) | |
download | hercules-2c9c73b3121b9bba577c053ebbf8783e69b73f59.tar.gz hercules-2c9c73b3121b9bba577c053ebbf8783e69b73f59.tar.bz2 hercules-2c9c73b3121b9bba577c053ebbf8783e69b73f59.tar.xz hercules-2c9c73b3121b9bba577c053ebbf8783e69b73f59.zip |
- Fixed mobinfo displaying exp as signed ints rather than unsigned.
- Added status_check_visibility to check if an object is within range of view of another. Nothing more, nothing less. It's used by unit movement to check whether you can continue chasing your target or not when the "chase target" directive is given.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7582 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/status.c')
-rw-r--r-- | src/map/status.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/map/status.c b/src/map/status.c index 4b8a9f9f2..1cc6f5f49 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1027,6 +1027,56 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int return 1; } +//Checks whether the source can see and chase target. +int status_check_visibility(struct block_list *src, struct block_list *target) +{ + int view_range; + struct status_data* status = status_get_status_data(src); + struct status_change* tsc = status_get_sc(target); + switch (src->type) { + case BL_MOB: + view_range = ((TBL_MOB*)src)->min_chase; + break; + case BL_PET: + view_range = ((TBL_PET*)src)->db->range2; + break; + default: + view_range = AREA_SIZE; + } + + if (src->m != target->m || !check_distance_bl(src, target, view_range)) + return 0; + + switch (target->type) + { + case BL_PC: + { + if (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) + && !(status->mode&MD_BOSS) && ( + ((TBL_PC*)target)->state.perfect_hiding || !( + status->race == RC_INSECT || + status->race == RC_DEMON || + status->mode&MD_DETECTOR + ))) + return 0; + } + break; + default: + //Check for chase-walk/hiding/cloaking opponents. + if (tsc && !(status->mode&MD_BOSS)) + { + if (tsc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) + && !( + status->race == RC_INSECT || + status->race == RC_DEMON || + status->mode&MD_DETECTOR + )) + return 0; + } + } + return 1; +} + void status_calc_bl(struct block_list *bl, unsigned long flag); static int status_base_atk(struct block_list *bl, struct status_data *status) |