private void PrepareStalk() { try { NWCreature self = (NWCreature)fSelf; AbstractMap map = self.CurrentField; if (self.Entry.Sign.Equals("WildDog")) { NWTile tile = (NWTile)map.GetTile(self.PosX, self.PosY); if (tile.ScentTrail != null) { int age = (int)tile.ScentAge; int mx = self.PosX; int my = self.PosY; for (int y = self.PosY - 1; y <= self.PosY + 1; y++) { for (int x = self.PosX - 1; x <= self.PosX + 1; x++) { tile = ((NWTile)map.GetTile(x, y)); if (age < (int)tile.ScentAge) { age = (int)tile.ScentAge; mx = x; my = y; } } } StalkGoal goal = (StalkGoal)FindGoalByKind(GoalKind.gk_Stalk); if (goal == null) { goal = ((StalkGoal)CreateGoal(GoalKind.gk_Stalk)); } goal.Position = new ExtPoint(mx, my); goal.Duration = 2; } } } catch (Exception ex) { Logger.Write("BeastBrain.prepareStalk(): " + ex.Message); } }
private void IsPassableDoor(int dx, int dy) { AbstractMap map = (AbstractMap)Owner; for (int yy = dy - 1; yy <= dy + 1; yy++) { for (int xx = dx - 1; xx <= dx + 1; xx++) { BaseTile tile = map.GetTile(xx, yy); if (tile != null) { ushort fg = tile.Foreground; if (fg != PlaceID.pid_Undefined && !MapUtils.IsBuilding(map, fg)) { tile.Foreground = PlaceID.pid_Undefined; } } } } }