public void Update(int x, int y, float frameDeltaTime) { if (_colonizableFleetsThisTurn.Count > 0) { _colonizeScreen.MouseHover(x, y, frameDeltaTime); } if (_newResearchTopicsNeeded.Count > 0) { _researchPrompt.MouseHover(x, y, frameDeltaTime); } switch (_updateStep) { case 0: //Process AI's Turn here // TODO: AI checks for peace treaties, and plans accordingly // TODO: AI plan movement on basis of need to expand, to press attack, or to defend // TODO: AI designs any new ships, done randomly every 6-15 turns // TODO: AI plans production strategy and set their ratio bars _updateStep++; break; case 1: _gameMain.EmpireManager.LaunchTransports(); // TODO: Deduct cost for transports // TODO: Production is executed _gameMain.EmpireManager.AccureIncome(); _gameMain.EmpireManager.UpdatePopulationGrowth(); _gameMain.EmpireManager.AccureResearch(); // TODO: Trade growth occurs // TODO: New spies are added _gameMain.EmpireManager.UpdateEmpires(); _updateStep++; break; case 2: //Diplomacy update: // TODO: Love nub move towards natural state if no treaty or war // TODO: Points added if there's trade, non-agg, or alliance // TODO: Points subtracted for military buildup, or owning more than 1/4 of map // TODO: Temp modifiers are adjusted toward 0 by 10 points each _updateStep++; break; case 3: // TODO: New missile bases/shields added here _gameMain.EmpireManager.UpdateMilitary(); _updateStep++; break; case 4: // TODO: Economic adjustments // TODO: Collect Tax and surplus industry spending and put into reserves // TODO: New factories are built _updateStep++; break; case 5: if (!_gameMain.EmpireManager.UpdateFleetMovement(frameDeltaTime)) { //Finished moving, merge fleets then move to next step _gameMain.EmpireManager.MergeIdleFleets(); _updateStep++; } break; case 6: // TODO: Space combat _updateStep++; break; case 7: // TODO: Spies do stuff if not hiding _updateStep++; break; case 8: if (_newResearchTopicsNeeded.Count == 0) { _newResearchTopicsNeeded = _gameMain.EmpireManager.RollForDiscoveries(_gameMain.Random); if (_newResearchTopicsNeeded.Count > 0) { foreach (var keyPair in _newResearchTopicsNeeded) { //How else to get the first key? _whichEmpireFocusedOn = keyPair.Key; break; } _researchPrompt.LoadEmpire(_whichEmpireFocusedOn, _newResearchTopicsNeeded[_whichEmpireFocusedOn]); _researchPrompt.Completed += OnResearchPromptComplete; } } if (_newResearchTopicsNeeded.Count == 0) { _updateStep++; } // TODO: If computer player gets a new research item, it reevaluates its need to spy on other races here break; case 9: if (_exploredSystemsThisTurn.Count == 0) { _exploredSystemsThisTurn = _gameMain.EmpireManager.CheckExploredSystems(_gameMain.Galaxy); if (_exploredSystemsThisTurn.Count > 0) { foreach (var keyPair in _exploredSystemsThisTurn) { //How else to get the first key? _whichEmpireFocusedOn = keyPair.Key; break; } _systemInfoWindow.LoadExploredSystem(_exploredSystemsThisTurn[_whichEmpireFocusedOn][0]); _systemView.LoadSystem(_exploredSystemsThisTurn[_whichEmpireFocusedOn][0], _whichEmpireFocusedOn); _camera.CenterCamera(_exploredSystemsThisTurn[_whichEmpireFocusedOn][0].X, _exploredSystemsThisTurn[_whichEmpireFocusedOn][0].Y, 1); } } // Results of planetary exploration are shown if (_exploredSystemsThisTurn.Count == 0) { //Either no explored systems or finished displaying all explored systems _updateStep++; } break; case 10: if (_colonizableFleetsThisTurn.Count == 0) { _colonizableFleetsThisTurn = _gameMain.EmpireManager.CheckColonizableSystems(_gameMain.Galaxy); if (_colonizableFleetsThisTurn.Count > 0) { foreach (var keyPair in _colonizableFleetsThisTurn) { _whichEmpireFocusedOn = keyPair.Key; break; } _colonizeScreen.LoadFleetAndSystem(_colonizableFleetsThisTurn[_whichEmpireFocusedOn][0]); _colonizeScreen.Completed += OnColonizeComplete; _camera.CenterCamera(_colonizableFleetsThisTurn[_whichEmpireFocusedOn][0].AdjacentSystem.X, _colonizableFleetsThisTurn[_whichEmpireFocusedOn][0].AdjacentSystem.Y, 1); } } if (_colonizableFleetsThisTurn.Count == 0) { _updateStep++; } break; case 11: // TODO: resolve combat _gameMain.EmpireManager.LandTransports(); // TODO: Orbital bombardments // TODO: Transports land and ground combat is resolved _updateStep++; break; case 12: // TODO: BNN checks for genocide, and if only one player remains, it is hailed as winner of game _updateStep++; break; case 13: // TODO: Random events // Add 2% to cumulative probability chance, multipled by game difficulty modifier, rolls d100 die to see if an event occurs // If event occurs, randomly select from those that haven't occured yet, and reset probability to 0. Target player determined and event takes effect _updateStep++; break; case 14: // TODO: First contacts, if either race is not in contact, but overlaps one of two's colonies with their fuel range, establish contact _updateStep++; break; case 15: // TODO: All computer-initiated diplomacy initiated // TODO: High council convences if criterias are met. // TODO: Messages from computer players are delivered to human player // TODO: If contact is broken, notification occurs _updateStep++; break; case 16: // TODO: Planetary production/completion messages are displayed (i.e. shield built). Slider bars can be adjusted // TODO: Production numbers for next turn are calculated _updateStep++; break; case 17: // TODO: Any star systems within advanced space scanner range of colonies/ships is updated // TODO: Turn advances by 1 // TODO: Recalculate players' current technology levels // TODO: Autosave game _updateStep = 0; _gameMain.EmpireManager.ClearEmptyFleets(); _gameMain.EmpireManager.SetInitialEmpireTurn(); _gameMain.ChangeToScreen(Screen.Galaxy); break; } }