Пример #1
0
        public void Action(MyAI _player)
        {
            if (this.HPNumber == -1)
            {
                this.HPoint = _player.GetNextHoshimiPoint(this.Location, ref this.HPNumber);
            }

            if (this.HPNumber == -10)
            {
                this.HPoint = _player.GetNearestUnfilledHP(this.Location, ref this.HPNumber);
            }

            if (HPNumber >= 0)
            {
                if (_player.HoshimiPoints[HPNumber].Full == 1)
                {
                    this.HPoint = _player.GetNearestUnfilledHP(this.Location, ref this.HPNumber);
                    this.StopMoving();
                }
            }

            if (this.State == NanoBotState.WaitingOrders)
            {
                if (this.Location == this.APoint)
                {
                    if (this.Stock == 0)
                    {
                        //Collect
                        CollectFrom(Location, this.ContainerCapacity / this.CollectTransfertSpeed);
                    }
                    else
                    {
                        //Go Hoshimi point
                        //MoveTo(this.HPoint);
                        MoveTo(_player.Pathfinder.FindPath(this.Location, this.HPoint));
                    }
                }
                if (this.Location == this.HPoint)
                {
                    foreach (NanoBot bot in _player.NanoBots)
                    {
                        if ((bot is Needle) && (bot.Stock == bot.ContainerCapacity) && (bot.Location == this.Location))
                        {
                            if (HPNumber >= 0)
                            {
                                _player.HoshimiPoints[HPNumber].Full = 1;
                                this.HPoint = _player.GetNearestUnfilledHP(this.Location, ref this.HPNumber);
                                //Добавить возможность "дозаправки"!!!
                                if (Stock == 0)
                                {
                                    this.APoint = _player.GetNearestAZNPoint(this.Location, this.HPoint);
                                    //MoveTo(this.APoint);
                                    MoveTo(_player.Pathfinder.FindPath(this.Location, this.APoint));
                                }
                                else
                                {
                                    //this.MoveTo(this.HPoint);
                                    MoveTo(_player.Pathfinder.FindPath(this.Location, this.HPoint));
                                }
                            }
                        }
                    }
                    if (Stock == 0)
                    {
                        //return to azn
                        this.APoint = _player.GetNearestAZNPoint(this.Location, this.HPoint);
                        //MoveTo(this.APoint);
                        MoveTo(_player.Pathfinder.FindPath(this.Location, this.APoint));
                    }
                    else
                    {
                        //transfert
                        TransferTo(Location, this.Stock / this.CollectTransfertSpeed);
                    }
                }
                //Добавить возможность "дозаправки"!!!
                if (Stock == 0)
                {
                    this.APoint = _player.GetNearestAZNPoint(this.Location, this.HPoint);
                    //this.MoveTo(this.APoint);
                    MoveTo(_player.Pathfinder.FindPath(this.Location, this.APoint));
                }
                else
                {
                    //this.HPoint = _player.GetNearestUnfilledHP(this.Location, ref this.HPNumber);
                    //this.MoveTo(this.HPoint);
                    MoveTo(_player.Pathfinder.FindPath(this.Location, this.HPoint));
                }
            }
        }
Пример #2
0
        public void Action(MyAI _player)
        {
            if (this.HPNumber == -1)
            {
                this.HPoint = _player.GetNextHoshimiPoint(this.Location, ref this.HPNumber);
            }

            if (this.HPNumber == -10)
            {
                this.HPoint = _player.GetNearestUnfilledHP(this.Location, ref this.HPNumber);
            }

            if (HPNumber >= 0)
            {
                if (_player.HoshimiPoints[HPNumber].Full == 1)
                {
                    this.HPoint = _player.GetNearestUnfilledHP(this.Location, ref this.HPNumber);
                    this.StopMoving();
                }
            }

            if (this.State == NanoBotState.WaitingOrders)
            {
                if (this.Location == this.APoint)
                {
                    if (this.Stock == 0)
                    {
                        //Collect
                        CollectFrom(Location, this.ContainerCapacity / this.CollectTransfertSpeed);
                        return;
                    }
                    else
                    {
                        //Go Hoshimi point
                        //MoveTo(this.HPoint);
                        //string str = "Collector[" + this.ID.ToString() + "] at AP X: " + this.Location.X.ToString() + " Y: " + this.Location.Y.ToString() + "\n";
                        //Debugger.Log(2, "Local", str);
                        MoveTo(_player.Pathfinder.FindPath(this.Location, this.HPoint));
                        return;
                    }
                }
                if (this.Location == this.HPoint)
                {
                    foreach (NanoBot bot in _player.NanoBots)
                    {
                        if ((bot is Needle) && (bot.Stock == bot.ContainerCapacity) && (bot.Location == this.Location))
                        {
                            if (HPNumber >= 0)
                            {
                                _player.HoshimiPoints[HPNumber].Full = 1;
                                this.HPoint = _player.GetNearestUnfilledHP(this.Location, ref this.HPNumber);
                                //Добавить возможность "дозаправки"!!!
                                if (Stock == 0)
                                {
                                    this.APoint = _player.GetNearestAZNPoint(this.Location, this.HPoint);
                                    //MoveTo(this.APoint);
                                    //string str = "Empty collector[" + this.ID.ToString() +"] at finished HP X: " + this.Location.X.ToString() + " Y: " + this.Location.Y.ToString() + "\n";
                                    //Debugger.Log(2, "Local", str);
                                    MoveTo(_player.Pathfinder.FindPath(this.Location, this.APoint));
                                    return;
                                }
                                else
                                {
                                    //this.MoveTo(this.HPoint);
                                    //string str = "Not empty collector[" + this.ID.ToString() +"] at finished HP X: " + this.Location.X.ToString() + " Y: " + this.Location.Y.ToString() + "\n";
                                    //Debugger.Log(2, "Local", str);
                                    MoveTo(_player.Pathfinder.FindPath(this.Location, this.HPoint));
                                    return;
                                }
                            }
                        }
                    }
                    if (Stock == 0)
                    {
                        //return to azn
                        this.APoint = _player.GetNearestAZNPoint(this.Location, this.HPoint);
                        //MoveTo(this.APoint);
                        //string str = "Empty collector[" + this.ID.ToString() +"] at HP X: " + this.Location.X.ToString() + " Y: " + this.Location.Y.ToString() + "\n";
                        //Debugger.Log(2, "Local", str);
                        MoveTo(_player.Pathfinder.FindPath(this.Location, this.APoint));
                        return;
                    }
                    else
                    {
                        //transfert
                        TransferTo(Location, this.Stock / this.CollectTransfertSpeed);
                        return;
                    }
                }
                //Добавить возможность "дозаправки"!!!
                if (Stock == 0)
                {
                    //string str = "Empty collector[" + this.ID.ToString() +"] somewhere X: " + this.Location.X.ToString() + " Y: " + this.Location.Y.ToString() + "\n";
                    //Debugger.Log(2, "Local", str);
                    this.APoint = _player.GetNearestAZNPoint(this.Location, this.HPoint);
                    //this.MoveTo(this.APoint);
                    MoveTo(_player.Pathfinder.FindPath(this.Location, this.APoint));
                    return;
                }
                else
                {
                    //this.HPoint = _player.GetNearestUnfilledHP(this.Location, ref this.HPNumber);
                    //this.MoveTo(this.HPoint);
                    //string str = "Not empty collector[" + this.ID.ToString() +"] somewhere X: " + this.Location.X.ToString() + " Y: " + this.Location.Y.ToString() + "\n";
                    //Debugger.Log(2, "Local", str);
                    MoveTo(_player.Pathfinder.FindPath(this.Location, this.HPoint));
                    return;
                }
            }
        }