--- deliantra/server/server/monster.C 2008/12/27 08:41:44 1.56 +++ deliantra/server/server/monster.C 2008/12/28 06:59:27 1.57 @@ -509,7 +509,6 @@ part = rv.part; dir = rv.direction; -#if DEVEL // if the enemy is a player, we have los. if los says we // can directly reach the player, we do not deviate. // for non-players, we never deviate @@ -517,22 +516,23 @@ { int sdir = 0; - for (int dir = 1; dir <= 8; ++dir) + for (int ndir = 1; ndir <= 8; ++ndir) { - mapxy pos (op); pos.move (dir); + mapxy pos (op); pos.move (ndir); + if (pos.normalise ()) { mapspace &ms = pos.ms (); if (ms.smell > op->ms ().smell) { - printf ("%s: found smell, following it, apparently (%d, %d)\n",& op->name,op->ms().smell,ms.smell);//D - op->ms ().smell = ms.smell - 1; - sdir = dir; + //printf ("%s: found smell, following it, apparently (%d, %d)\n",& op->name,op->ms().smell,ms.smell);//D + op->ms ().smell = ms.smell - 1; // smarter: tell others + sdir = ndir; // perturbing the path might let the monster lose track, - // but it will also wide the actual path, spreading information - if (!rndm (20)) + // but it will also widen the actual path, spreading information + if (!rndm (20)) // even smarter, deviate and spread? sdir += absdir (1 - rndm (2) * 2); } } @@ -540,18 +540,17 @@ if (sdir) dir = sdir; - else - // no better smell found, so assume the player jumped, and erase this smell - {if (op->ms ().smell) printf ("erasing smell %d\n", op->ms ().smell);//D + else if (op->ms ().smell) + { + // no better smell found, so assume the player jumped, and erase this smell + //printf ("erasing smell %d\n", op->ms ().smell);//D ordered_mapwalk_begin (op, -1, -1, 1, 1) if (m) m->at (nx, ny).smell = 0; ordered_mapwalk_end - }//D + } } -#endif - if (QUERY_FLAG (op, FLAG_SCARED) || QUERY_FLAG (op, FLAG_RUN_AWAY)) dir = absdir (dir + 4);