summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-04 14:10:14 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-04 14:10:14 +0000
commit2d5e8b6e1a67df8c0719e744211a188f9c855445 (patch)
tree4e6118dfb3785efb9a4657db0b3d559b26ee638d /src/map/mob.c
parenta933e1dd3618225e7bb3565bad3c0aa2b42907ad (diff)
downloadhercules-2d5e8b6e1a67df8c0719e744211a188f9c855445.tar.gz
hercules-2d5e8b6e1a67df8c0719e744211a188f9c855445.tar.bz2
hercules-2d5e8b6e1a67df8c0719e744211a188f9c855445.tar.xz
hercules-2d5e8b6e1a67df8c0719e744211a188f9c855445.zip
- Some cleanup of how mobcount works.
- status_calc_misc will now be invoked in status_calc_bl even on the first call, since status could have gone up due to skill bonuses. - Moved max HP/SP calculations to before invoking status_calc_misc - Simplified distance and check_distance to use "aegis" methods (greater of dx/dy = distance), there's a new define in map.h called CIRCULAR_AREA, when set, the previous method is used, and map for each in range calls will also check for distances, making most ground skills and battle system use real circles instead of squares. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8609 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 636d94ff0..0d7fceb83 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -786,7 +786,7 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
return 0; //For some reason Homun targets are never overriden.
dist = distance_bl(&md->bl, bl);
- if(dist < md->db->range2 &&
+ if(
((*target) == NULL || !check_distance_bl(&md->bl, *target, dist)) &&
battle_check_range(&md->bl,bl,md->db->range2)
) { //Pick closest target?
@@ -825,9 +825,8 @@ static int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap)
case BL_PC:
case BL_HOM: //[orn]
case BL_MOB:
- if(check_distance_bl(&md->bl, bl, md->status.rhw.range) &&
- battle_check_range (&md->bl, bl, md->status.rhw.range)
- ) {
+ if(battle_check_range (&md->bl, bl, md->status.rhw.range))
+ {
(*target) = bl;
md->target_id=bl->id;
md->min_chase= md->db->range3;
@@ -852,8 +851,8 @@ static int mob_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap)
md=va_arg(ap,struct mob_data *);
target= va_arg(ap,struct block_list**);
- if((dist=distance_bl(&md->bl, bl)) < md->db->range2 &&
- mob_can_reach(md,bl,dist+1, MSS_LOOT) &&
+ dist=distance_bl(&md->bl, bl);
+ if(mob_can_reach(md,bl,dist+1, MSS_LOOT) &&
((*target) == NULL || !check_distance_bl(&md->bl, *target, dist)) //New target closer than previous one.
) {
(*target) = bl;