summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index f45c6f104..3d22baa80 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -569,7 +569,6 @@ int mob_linksearch(struct block_list *bl,va_list ap)
md->last_linktime = tick;
if( mob_can_reach(md,target,md->db->range2, MSS_FOLLOW) ){ // Reachability judging
md->target_id = target->id;
- md->state.aggressive = (status_get_mode(&md->bl)&MD_ANGRY)?1:0;
md->min_chase=md->db->range3;
return 1;
}
@@ -685,6 +684,7 @@ int mob_spawn (struct mob_data *md)
md->master_id = 0;
md->master_dist = 0;
+ md->state.aggressive = md->db->mode&MD_ANGRY?1:0;
md->state.skillstate = MSS_IDLE;
md->next_walktime = tick+rand()%5000+1000;
md->last_linktime = tick;
@@ -817,7 +817,6 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
) {
(*target) = bl;
md->target_id=bl->id;
- md->state.aggressive = (status_get_mode(&md->bl)&MD_ANGRY)?1:0;
md->min_chase= dist + md->db->range3;
if(md->min_chase>MAX_MINCHASE)
md->min_chase=MAX_MINCHASE;
@@ -855,7 +854,6 @@ static int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap)
) {
(*target) = bl;
md->target_id=bl->id;
- md->state.aggressive = (status_get_mode(&md->bl)&MD_ANGRY)?1:0;
md->min_chase= md->db->range3;
return 1;
}
@@ -965,7 +963,6 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
}
if (tbl && status_check_skilluse(&md->bl, tbl, 0, 0)) {
md->target_id=tbl->id;
- md->state.aggressive = (status_get_mode(&md->bl)&MD_ANGRY)?1:0;
md->min_chase=md->db->range3+distance_bl(&md->bl, tbl);
if(md->min_chase>MAX_MINCHASE)
md->min_chase=MAX_MINCHASE;
@@ -1167,6 +1164,8 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
) {
map_foreachinrange (mob_ai_sub_hard_activesearch, &md->bl,
view_range, md->special_state.ai?BL_CHAR:BL_PC, md, &tbl);
+ if(!tbl && mode&MD_ANGRY && !md->state.aggressive)
+ md->state.aggressive = 1; //Restore angry state when no targets are visible.
} else if (mode&MD_CHANGECHASE && (md->state.skillstate == MSS_RUSH || md->state.skillstate == MSS_FOLLOW)) {
search_size = view_range<md->db->range ? view_range:md->db->range;
map_foreachinrange (mob_ai_sub_hard_changechase, &md->bl,