Fixed an issue where mobs instantly walked after being spotted (#7738)

* Fixed an issue where mobs instantly walked after being spotted
  MIN_RANDOMWALKTIME was initialized too early
* This behavior is only applied on the monster script command
This commit is contained in:
Atemo
2023-05-12 00:34:36 +02:00
committed by GitHub
parent d3b99e6dc1
commit b4b69a2cc1
2 changed files with 22 additions and 2 deletions

View File

@@ -1571,6 +1571,12 @@ int mob_randomwalk(struct mob_data *md,t_tick tick)
nullpo_ret(md);
// Initialize next_walktime
if (md->next_walktime == INVALID_TIMER) {
md->next_walktime = tick+rnd()%1000+MIN_RANDOMWALKTIME;
return 1;
}
if(DIFF_TICK(md->next_walktime,tick)>0 ||
status_has_mode(&md->status,MD_NORANDOMWALK) ||
!unit_can_move(&md->bl) ||