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--; } }
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); } } }
public override void Deactivate() { base.Deactivate(); Agent q = null; if (AssignedAgents.Count > 0) { q = AssignedAgents[0]; q.Busy = false; AssignedAgents.Remove(q); } }
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); }
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); } } }
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]); } } }