public Point GetNextCyclicNavPoint(NavigationPointInfo[] UNPs, ref int Number) { Number = -10; for (int i = 0; i < UNPs.Length; i++) { if (UNPs[i].Complete == false) { Number = i; return UNPs[i].Location; } } NBCYCLICNAV = 0; NBCYCLICDOC = 0; return UNPs[UNPs.Length-1].Location; }
void MyAI_ChooseInjectionPointEvent() { int HealConvoysWithContainers = 0; int BigHealConvoys = 0; int HealConvoysWithCollectors = 0; int count = 0; int tmp = 0; int tmp1 = 0; int FHPnum = -1; int FAPnum = -1; Point p = new Point(); NavigationPointInfo FirstNavPoint = new NavigationPointInfo(); ScoreInfo FirstScoreObj = new ScoreInfo(); BattlePointInfo bp = new BattlePointInfo(); AtackPointInfo ap = new AtackPointInfo(); Pathfinder = new AStar(this.Tissue); ePathfinder = new eAStar(this.Tissue, new Point(PierreTeamInjectionPoint.X - 12, PierreTeamInjectionPoint.Y - 12), 24); //��������� ������ ReadAllMissions(); //������� HP � AP ReadHPsAndAPs(); //���������� ����� ������ � ������� HP, �� ������� ������ ����� AnalizeMap(ref FHPnum, ref FAPnum); //������� ����� ������ � ����� ������� ScoreMission`� if (ScoreObjectives != null) { count = 0; tmp = 10000; tmp1 = 0; for (int i = 0; i < ScoreObjectives.Length; i++) { if (ScoreObjectives[i].Score > count) { count = ScoreObjectives[i].Score; } if (ScoreObjectives[i].Turn < tmp) { tmp = ScoreObjectives[i].Turn; tmp1 = i; } } FirstScoreObj = ScoreObjectives[tmp1]; MinHPsToTake = (int)(count / 220) + 1; } else { FirstScoreObj.Score = 0; FirstScoreObj.Turn = 2000; MinHPsToTake = 0; } //������� ����� ������ NavigationMission if (NavigationPoints != null) { count = 10000; tmp = -1; for (int i = 0; i < NavigationPoints.Length; i++) { if (NavigationPoints[i].EndTurn < count) { count = NavigationPoints[i].EndTurn; tmp = i; } } FirstNavPoint = NavigationPoints[tmp]; } else { FirstNavPoint.Location = HoshimiPoints[FHPnum].Location; } //�������� � ����� ������ �� Pierre`� this.InjectionPointWanted = FinallyChooseInjectionPoint(HoshimiPoints[FHPnum].Location, AZNPoints[FAPnum].Location, FirstNavPoint.Location); if (KillPierre) { ap.Location = PierreTeamInjectionPoint; ap.Need = 5; ap.Exist = 0; ATargets.Add(ap); } //���� �������� HP � AP /* if (BattleExpected) { //��� ���������� ������������ ����� HP ���������� ����� for (int i = 0; i < MinHPsToTake; i++) { p = HoshimiPoints[(int)MyHPs[i]].Location; bp.Location = p; bp.Covered = 0; BTargets.Add(bp); } //��� ������ AP ���������� ����� p = AZNPoints[FAPnum].Location; bp.Location = p; bp.Covered = 0; BTargets.Add(bp); } */ //���������, ������� � ����� ����� ��� ���� NBPROTECTORTOBUILD = BTargets.Count; OBSERVERSTOBUILD = 1; NBBODYGUARSTOBUILD = 4; BodyGuards = new BodyGuard[NBBODYGUARSTOBUILD]; for (int i = 0; i < BodyGuards.Length; i++) { BodyGuards[i] = null; } //if (KillPierre) //{ // NBNAVIGATORTOBUILD = NavigationPoints.Length * 2; // NBATACKERTOBUILD = 4; //} //else //{ NBATACKERTOBUILD = 0; if (NavigationPoints != null) { for (int i = 0; i < NavigationPoints.Length; i++) { if ((NavigationPoints[i].BotType == NanoBotType.NanoExplorer) || ((NavigationPoints[i].BotType == NanoBotType.Unknown) && (NavigationPoints[i].Stock <= 0))) { NBNAVIGATORTOBUILD++; } else if ((NavigationPoints[i].BotType == NanoBotType.NanoCollector) && (NavigationPoints[i].Stock <= 0)) { NBATACKERTOBUILD++; AtackPointInfo api = new AtackPointInfo(); api.Location = NavigationPoints[i].Location; api.Need = 1; api.Exist = 0; ATargets.Add(api); } else if (((NavigationPoints[i].BotType == NanoBotType.NanoCollector) || (NavigationPoints[i].BotType == NanoBotType.Unknown)) && (NavigationPoints[i].Stock > 0) && (NavigationPoints[i].Stock <= 10)) { NBDOCTORSTOBUILD++; } else if (((NavigationPoints[i].BotType == NanoBotType.NanoContainer) || ((NavigationPoints[i].BotType == NanoBotType.Unknown) && (NavigationPoints[i].Stock > 0))) && (NavigationPoints[i].Stock <= 50)) { HealConvoysWithContainers++; } else if ((NavigationPoints[i].BotType == NanoBotType.NanoContainer || (NavigationPoints[i].BotType == NanoBotType.Unknown)) && (NavigationPoints[i].Stock > 50)) { BigHealConvoys++; } else if ((NavigationPoints[i].BotType == NanoBotType.NanoCollector) && (NavigationPoints[i].Stock > 10)) { HealConvoysWithCollectors++; } } } else { NBNAVIGATORTOBUILD = 0; } //} if (HealConvoysWithCollectors > 0) { CollConvoys = new ConvoyWithCollector[HealConvoysWithCollectors]; for (int i = 0; i < CollConvoys.Length; i++) { CollConvoys[i] = new ConvoyWithCollector(); } } if (BigHealConvoys > 0) { BigConvoys = new ConvoyWithBigContainer[BigHealConvoys]; for (int i = 0; i < BigConvoys.Length; i++) { BigConvoys[i] = new ConvoyWithBigContainer(); } } //����� ������� - ������� �� ����, ������� �� � �������� ����� ��������� � ������� ��� �� ���� int NotAllocatedBots = Utils.NbrMaxBots - 2 - NBBODYGUARSTOBUILD - NBATACKERTOBUILD - NBPROTECTORTOBUILD - MyHPs.Count; int ConvoysNumber = Math.Min((NotAllocatedBots - (NotAllocatedBots % 3)) / 3, MyHPs.Count + HealConvoysWithContainers); ConvoysNumber = Math.Max(ConvoysNumber, 3); Convoys = new Convoy[ConvoysNumber]; for (int i = 0; i < Convoys.Length; i++) { Convoys[i] = new Convoy(false); } for (int i = 0; i < HealConvoysWithContainers; i++) { Convoys[i].IsNavigating = true; } }
private void BuildUNOPath(int HP) { NavigationPointInfo[] Path = new NavigationPointInfo[UniqueNavPoints.Length]; int turn; int dist; int last = -1; Point tmp = new Point(); tmp = HoshimiPoints[HP].Location; for (int i = 0; i < Path.Length; i++) { turn = 2000; dist = 10000; for (int j = 0; j < Path.Length; j++) { if ((UniqueNavPoints[j].Location.X != -1 && UniqueNavPoints[j].EndTurn < turn) || (UniqueNavPoints[j].Location.X != -1 && UniqueNavPoints[j].EndTurn == turn && EstimateMovementTime(tmp, UniqueNavPoints[j].Location) <= dist)) { turn = UniqueNavPoints[j].EndTurn; dist = EstimateMovementTime(tmp, UniqueNavPoints[j].Location); last = j; } } Path[i] = UniqueNavPoints[last]; tmp = Path[i].Location; UniqueNavPoints[last].Location.X = -1; } for (int i = 0; i < Path.Length; i++) { UniqueNavPoints[i] = Path[i]; } }