protected override GoalEntity CreateGoalEx(int goalKind) { GoalEntity result = null; switch (goalKind) { case GoalKind.gk_Travel: result = new TravelGoal(this); break; case GoalKind.gk_PointGuard: result = new PointGuardGoal(this); break; case GoalKind.gk_ItemAcquire: result = new ItemAcquireGoal(this); break; case GoalKind.gk_EnemyChase: result = new EnemyChaseGoal(this); break; case GoalKind.gk_EnemyEvade: result = new EnemyEvadeGoal(this); break; case GoalKind.gk_AreaGuard: result = new AreaGuardGoal(this); break; case GoalKind.gk_ShopReturn: result = new ShopReturnGoal(this); break; case GoalKind.gk_PlayerFind: result = new PlayerFindGoal(this); break; case GoalKind.gk_Escort: result = new EscortGoal(this); break; case GoalKind.gk_Flock: result = new FlockGoal(this); break; case GoalKind.gk_DebtTake: result = new DebtTakeGoal(this); break; case GoalKind.gk_WareReturn: result = new WareReturnGoal(this); break; case GoalKind.gk_Stalk: result = new StalkGoal(this); break; } return(result); }
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); } }