コード例 #1
0
ファイル: Caravan.cs プロジェクト: fire-eggs/CivOne
        internal override bool Confront(int relX, int relY)
        {
            ITile moveTarget = Map[X, Y][relX, relY];
            City  city       = moveTarget.City;

            // fire-eggs Caravan can build wonder even in home city
            if (city != null && city.Owner == Owner && Game.Human == Owner)
            {
                // TODO fire-eggs this seems like bad design: how to determine whether to show a menu, without activating the menu?
                if (city.IsBuildingWonder || CaravanChoice.AllowEstablishTradeRoute(this, city))
                {
                    GameTask.Enqueue(Show.CaravanChoice(this, city));
                }
                else
                {
                    MovementTo(relX, relY);
                }
                return(true);
            }

            if (city == null || city == Home || (city.Owner == Owner && Home != null && moveTarget.DistanceTo(Home) < 10))
            {
                MovementTo(relX, relY);
                return(true);
            }

            if (city.Owner != Owner)
            {
                EstablishTradeRoute(moveTarget.City);
                return(true);
            }

            return(true);
        }
コード例 #2
0
ファイル: Caravan.cs プロジェクト: uHappyLogic/CivOne
        protected override bool Confront(int relX, int relY)
        {
            ITile moveTarget = Map[X, Y][relX, relY];
            City  city       = moveTarget.City;

            if (city == null || city == Home || (city.Owner == Owner && Home != null && moveTarget.DistanceTo(Home) < 10))
            {
                Movement       = new MoveUnit(relX, relY);
                Movement.Done += MoveEnd;
                GameTask.Insert(Movement);
                return(true);
            }

            if (city.Owner != Owner)
            {
                EstablishTradeRoute(moveTarget.City);
                return(true);
            }

            if (Game.Human == Owner)
            {
                GameTask.Enqueue(Show.CaravanChoice(this, city));
            }

            return(true);
        }