public void Morph(uint unitType) { MorphingType morphingType = MorphingType.LookUpToType[unitType]; if (Tyr.Bot.Gas() >= morphingType.Gas && Tyr.Bot.Minerals() >= morphingType.Minerals) { UnitsDesired.Add(unitType); } }
public void Morph(uint unitType) { Bot.Main.UnitManager.UnitTraining(unitType); MorphingType morphingType = MorphingType.LookUpToType[unitType]; if (Bot.Main.Gas() >= morphingType.Gas && Bot.Main.Minerals() >= morphingType.Minerals) { UnitsDesired.Add(unitType); Bot.Main.ReservedGas += morphingType.Gas; Bot.Main.ReservedMinerals += morphingType.Minerals; } }
public override void OnFrame(Tyr tyr) { for (int i = units.Count - 1; i >= 0; i--) { Agent agent = units[i]; MorphingType morphingType = MorphingType.LookUpToType[MorphingUnits[agent.Unit.Tag]]; if (tyr.Observation.Observation.PlayerCommon.Minerals < morphingType.Minerals || tyr.Observation.Observation.PlayerCommon.Vespene < morphingType.Gas) { continue; } if (agent.Unit.UnitType != morphingType.FromType || agent.CurrentAbility() == morphingType.Ability) { UnitsDesired.Remove(morphingType.ToType); UnitsMorphing.Remove(morphingType.ToType); MorphingUnits.Remove(agent.Unit.Tag); IdleTask.Task.Add(agent); units[i] = units[units.Count - 1]; units.RemoveAt(units.Count - 1); continue; } agent.Order(morphingType.Ability); } List <ulong> deadUnits = new List <ulong>(); foreach (ulong tag in MorphingUnits.Keys) { bool stillExists = false; foreach (Agent agent in Units) { if (agent.Unit.Tag == tag) { stillExists = true; } } if (!stillExists) { deadUnits.Add(tag); } } foreach (ulong tag in deadUnits) { UnitsMorphing.Remove(MorphingType.LookUpToType[MorphingUnits[tag]].ToType); MorphingUnits.Remove(tag); } }