コード例 #1
0
        public override void OnFrame()
        {
            List <Agent> overlords = AssignedAgents.Where(a => a.Unit.UnitType == Units.OVERLORD).ToList();

            if (overlords.Count() < 2 && overlords.Count() < Controller.GetCompletedCount(Units.OVERLORD))
            {
                Agent ov = Controller.GetAvailableAgent(Units.OVERLORD);
                ov.Busy = true;
                AssignAgents(ov);
            }

            int ovieCount = overlords.Count();

            foreach (Point2D loc in scoutLocations)
            {
                if (ovieCount == 0)
                {
                    break;
                }
                if (EnemyStrategyManager.EnemyBuildingAtLocation(loc))
                {
                    continue;
                }
                new SingleUnitScoutTask(overlords[overlords.Count() - ovieCount], loc);
                ovieCount--;
            }
        }
コード例 #2
0
        public override void OnFrame()
        {
            CheckRequirements();
            if (Active)
            {
                if (VBot.Bot.Observation.Observation.GameLoop - 32 > lastAttackFrame)
                {
                    foreach (var agent in Controller.GetAgents(Units.ArmyUnits).Where(a => !a.Busy))
                    {
                        if (!AssignedAgents.Contains(agent))
                        {
                            AssignedAgents.Add(agent);
                        }
                    }

                    var armyTags = AssignedAgents.Select(a => a.Unit.Tag);
                    targetLocation = VBot.Bot.Map.TargetAttackLocation;
                    var unitCommand = new ActionRawUnitCommand();
                    unitCommand.AbilityId           = (int)Abilities.ATTACK;
                    unitCommand.TargetWorldSpacePos = targetLocation;
                    unitCommand.UnitTags.AddRange(armyTags);
                    lastAttackFrame = VBot.Bot.Observation.Observation.GameLoop;
                    VBot.Bot.AddAction(unitCommand);
                }
            }
        }
コード例 #3
0
        public override void Deactivate()
        {
            base.Deactivate();
            Agent q = null;

            if (AssignedAgents.Count > 0)
            {
                q      = AssignedAgents[0];
                q.Busy = false;
                AssignedAgents.Remove(q);
            }
        }
コード例 #4
0
 public string[]? GetAssignedAgents()
 {
     if (AssignedAgents == null)
     {
         return(null);
     }
     string[] values = AssignedAgents.TrimStart('[').TrimEnd(']').Split(',', StringSplitOptions.RemoveEmptyEntries);
     for (int i = 0; i < values.Length; i++)
     {
         values[i] = values[i].Trim('"');
     }
     return(values);
 }
コード例 #5
0
 public override void OnFrame()
 {
     CheckRequirements();
     if (Active)
     {
         if (AssignedAgents.Count == 0)
         {
             Agent q = Controller.GetAvailableAgent(Units.QUEEN);
             AssignedAgents.Add(q);
             q.Busy = true;
             t      = new SpreadCreepTask(q);
         }
     }
 }
コード例 #6
0
        public override void OnFrame()
        {
            CheckRequirements();
            if (!Active)
            {
                return;
            }

            if (VBot.Bot.StateManager.GetCompletedCount(Units.HATCHERY) > bases.Count)
            {
                foreach (Agent b in Controller.GetAgents(Units.HATCHERY))
                {
                    if (b.Unit.BuildProgress > 0.9999 && !bases.Contains(b.Unit.Tag))
                    {
                        bases.Add(b.Unit.Tag);
                    }
                }
            }

            if (AssignedAgents.Count < Controller.GetCompletedCount(Units.HATCHERY))
            {
                //try to assign a new queen
                if (Controller.GetAvailableAgent(Units.QUEEN) != null)
                {
                    Agent q = Controller.GetAvailableAgent(Units.QUEEN);
                    q.Busy = true;
                    AssignAgents(q);
                }
            }

            foreach (Agent q in AssignedAgents)
            {
                int index = AssignedAgents.IndexOf(q);
                if (q.Unit.Energy >= 25)
                {
                    q.Order(Abilities.INJECT_LARVA, bases[index]);
                }
            }
        }