public void CheckImprovement(int system, int planet) //Contains data on the quality of planets and the bonuses they receive { systemSIMData = MasterScript.systemListConstructor.systemList [system].systemObject.GetComponent <SystemSIMData> (); if (systemSIMData.improvementNumber == 0) { systemSIMData.improvementLevel = "Poor"; MasterScript.systemListConstructor.systemList[system].planetsInSystem[planet].maxPopulation = 25; systemSIMData.canImprove = true; systemSIMData.improvementCost = MasterScript.systemListConstructor.systemList[system].planetsInSystem[planet].wealthValue / 3; } if (systemSIMData.improvementNumber == 1) { systemSIMData.improvementLevel = "Normal"; MasterScript.systemListConstructor.systemList[system].planetsInSystem[planet].maxPopulation = 50; systemSIMData.canImprove = true; systemSIMData.improvementCost = (MasterScript.systemListConstructor.systemList[system].planetsInSystem[planet].wealthValue * 2) / 3; } if (systemSIMData.improvementNumber == 2) { systemSIMData.improvementLevel = "Good"; MasterScript.systemListConstructor.systemList[system].planetsInSystem[planet].maxPopulation = 75; systemSIMData.canImprove = true; systemSIMData.improvementCost = MasterScript.systemListConstructor.systemList[system].planetsInSystem[planet].wealthValue + (MasterScript.systemListConstructor.systemList[system].planetsInSystem[planet].wealthValue / 3); } if (systemSIMData.improvementNumber == 3) { systemSIMData.improvementLevel = "Superb"; MasterScript.systemListConstructor.systemList[system].planetsInSystem[planet].maxPopulation = 100; systemSIMData.canImprove = false; } }
private void Update() { if (MasterScript.cameraFunctionsScript.openMenu == true) //If the menu should be open { NGUITools.SetActive(MasterScript.systemPopup.overlayContainer, false); //Disable all the overlays if (MasterScript.playerTurnScript.tempObject != null) //If there is a selected system { selectedSystem = MasterScript.RefreshCurrentSystem(MasterScript.cameraFunctionsScript.selectedSystem); //Get references to the required scripts systemSIMData = MasterScript.playerTurnScript.tempObject.GetComponent <SystemSIMData>(); } CheckActiveElements(); UpdateOverview(); CheckSystemSize(); } if (MasterScript.cameraFunctionsScript.openMenu == false) //If the menu should be closed { NGUITools.SetActive(MasterScript.systemPopup.overlayContainer, true); //Enable the overlays if (playerSystemInfoScreen.activeInHierarchy == true) //If there are any menu components active { NGUITools.SetActive(playerSystemInfoScreen, false); //Disable them selectedPlanet = -1; //Reset the selected planet systemScrollviews.selectedPlanet = -1; } } }
/* * private void OptimumTechToBuild(int system) * { * systemSIMData = systemListConstructor.systemList [system].systemObject.GetComponent<SystemSIMData> (); * improvementsBasic = systemListConstructor.systemList [system].systemObject.GetComponent<ImprovementsBasic> (); * * knwlRatio = (100 / systemSIMData.totalSystemSIM) * systemSIMData.totalSystemKnowledge; * powRatio = (100 / systemSIMData.totalSystemSIM) * systemSIMData.totalSystemPower; * * tempFloat = 0f; * tempTech = -1; * tempPlanet = -1; * * for(int i = 0; i < improvementsBasic.listOfImprovements.Count; ++i) * { * if(improvementsBasic.listOfImprovements[i].improvementCost > thisPlayer.power) * { * continue; * } * * if(improvementsBasic.listOfImprovements[i].improvementLevel <= improvementsBasic.techTier && improvementsBasic.listOfImprovements[i].hasBeenBuilt == false) * { * improvements.TechSwitch(i, improvementsBasic, thisPlayer, true); * bool okToBuild = false; * * if(improvementsBasic.planetToBuildOn.Count > 0) * { * for(int j = 0; j < systemListConstructor.systemList[system].planetsInSystem.Count; ++j) * { * if(improvementsBasic.planetToBuildOn.Contains(systemListConstructor.systemList[system].planetsInSystem[j].planetType)) * { * okToBuild = true; * tempPlanet = j; * } * } * } * * if(tempPlanet != -1) * { * int tempPlanSize = 0; * * for(int j = 0; j < systemListConstructor.systemList[system].planetsInSystem.Count; ++j) * { * int noSlots = 0; * * for(int k = 0; k < systemListConstructor.systemList[system].planetsInSystem[j].improvementSlots; ++k) * { * if(systemListConstructor.systemList[system].planetsInSystem[j].improvementsBuilt[k] == null) * { ++noSlots; * } * } * * if(noSlots > tempPlanSize) * { * tempPlanSize = noSlots; * tempPlanet = j; * } * } * } * * if(improvementsBasic.planetToBuildOn.Count == 0) * { * okToBuild = true; * } * * if(okToBuild == true) * { * RacialTechCheck(i); * GenericTechCheck(i); * } * } * } * * if(tempTech != -1f) * { * if(improvementsBasic.ImproveSystem(system) == true) * { * for(int i = 0; i < systemListConstructor.systemList[systemGUI.selectedSystem].planetsInSystem[tempPlanet].improvementSlots; ++i) * { * if(systemListConstructor.systemList[systemGUI.selectedSystem].planetsInSystem[tempPlanet].improvementsBuilt[i] == null) * { * systemListConstructor.systemList[systemGUI.selectedSystem].planetsInSystem[tempPlanet].improvementsBuilt[i] = improvementsBasic.listOfImprovements[i].improvementName; * } * } * } * } * } * * private void RacialTechCheck(int i, int system) * { * if(thisPlayer.playerRace == "Humans") * { * if(improvementsBasic.tempBonusAmbition * 50 * improvementsBasic.listOfImprovements[i].improvementLevel > improvementsBasic.listOfImprovements[i].improvementCost) * { * if(improvementsBasic.tempBonusAmbition * 50 * improvementsBasic.listOfImprovements[i].improvementLevel > tempFloat || tempTech == i) * { * tempFloat = improvementsBasic.tempBonusAmbition * 50 * improvementsBasic.listOfImprovements[i].improvementLevel; * tempTech = i; * } * } * } * * if(thisPlayer.playerRace == "Selkies") * { * if((improvementsBasic.amberPenalty > systemListConstructor.systemList[system].sysAmberPenalty) * 10 * improvementsBasic.listOfImprovements[i].improvementLevel > tempFloat || tempTech == i) * { * if(improvementsBasic.amberPenalty > systemListConstructor.systemList[system].sysAmberPenalty) * { * tempFloat = (systemListConstructor.systemList[system].sysAmberPenalty + improvementsBasic.amberPenalty) * 10 * improvementsBasic.listOfImprovements[i].improvementLevel; * tempTech = i; * } * } * * if(improvementsBasic.amberPointBonus * 50 * improvementsBasic.listOfImprovements[i].improvementLevel > tempFloat || tempTech == i) * { * if(improvementsBasic.amberPointBonus * 50 * improvementsBasic.listOfImprovements[i].improvementLevel > improvementsBasic.listOfImprovements[i].improvementCost) * { * if(tempTech == i) * { * tempFloat += improvementsBasic.amberPointBonus * 50 * improvementsBasic.listOfImprovements[i].improvementLevel; * } * else * { * tempFloat = improvementsBasic.amberPointBonus * 50 * improvementsBasic.listOfImprovements[i].improvementLevel; * tempTech = i; * } * } * } * * if(improvementsBasic.amberProductionBonus * systemSIMData.totalSystemAmber * 100 * improvementsBasic.listOfImprovements[i].improvementLevel > tempFloat || tempTech == i) * { * if(improvementsBasic.amberProductionBonus * systemSIMData.totalSystemAmber * 100 * improvementsBasic.listOfImprovements[i].improvementLevel > improvementsBasic.listOfImprovements[i].improvementCost) * { * if(tempTech == i) * { * tempFloat += improvementsBasic.amberProductionBonus * systemSIMData.totalSystemAmber * 100 * improvementsBasic.listOfImprovements[i].improvementLevel; * } * else * { * tempFloat = improvementsBasic.amberProductionBonus * systemSIMData.totalSystemAmber * 100 * improvementsBasic.listOfImprovements[i].improvementLevel; * tempTech = i; * } * } * } * } * } * * private void GenericTechCheck(int i, int system) * { * if(systemListConstructor.systemList[system].sysPowerModifier * 4 * improvementsBasic.listOfImprovements[i].improvementLevel > improvementsBasic.listOfImprovements[i].improvementCost) * { * if(systemListConstructor.systemList[system].sysPowerModifier * powRatio > tempFloat) * { * if(tempTech == i) * { * tempFloat += systemListConstructor.systemList[system].sysPowerModifier * powRatio * improvementsBasic.listOfImprovements[i].improvementLevel; * } * else * { * tempFloat = systemListConstructor.systemList[system].sysPowerModifier * powRatio * improvementsBasic.listOfImprovements[i].improvementLevel; * tempTech = i; * } * } * } * * if(improvementsBasic.systemListConstructor.systemList[system].sysPowerModifier * 4 * improvementsBasic.listOfImprovements[i].improvementLevel > improvementsBasic.listOfImprovements[i].improvementCost) * { * if(improvementsBasic.tempKnwlUnitBonus * knwlRatio > tempFloat || tempTech == i) * { * if(tempTech == i) * { * tempFloat += improvementsBasic.tempKnwlUnitBonus * knwlRatio * improvementsBasic.listOfImprovements[i].improvementLevel; * } * else * { * tempFloat = improvementsBasic.tempKnwlUnitBonus * knwlRatio * improvementsBasic.listOfImprovements[i].improvementLevel; * tempTech = i; * } * } * } * * if(improvementsBasic.tempImprovementSlots * 100 * improvementsBasic.listOfImprovements[i].improvementLevel > improvementsBasic.listOfImprovements[i].improvementCost) * { * if(improvementsBasic.tempImprovementSlots * 100 * improvementsBasic.listOfImprovements[i].improvementLevel > tempFloat || tempTech == i) * { * if(tempTech == i) * { * tempFloat += improvementsBasic.tempImprovementSlots * 100 * improvementsBasic.listOfImprovements[i].improvementLevel; * } * else * { * tempFloat = improvementsBasic.tempImprovementSlots * 100 * improvementsBasic.listOfImprovements[i].improvementLevel; * tempTech = i; * } * } * } * * if(improvementsBasic.tempWealth * 25 * improvementsBasic.listOfImprovements[i].improvementLevel > improvementsBasic.listOfImprovements[i].improvementCost) * { * if(improvementsBasic.tempWealth * 25 * improvementsBasic.listOfImprovements[i].improvementLevel > tempFloat) * { * if(tempTech == i) * { * tempFloat += improvementsBasic.tempWealth * 25 * improvementsBasic.listOfImprovements[i].improvementLevel; * } * else * { * tempFloat = improvementsBasic.tempWealth * 25 * improvementsBasic.listOfImprovements[i].improvementLevel; * tempTech = i; * } * } * } * * if(improvementsBasic.tempImprovementCostReduction * 50 * improvementsBasic.listOfImprovements[i].improvementLevel > improvementsBasic.listOfImprovements[i].improvementCost) * { * if(improvementsBasic.tempImprovementCostReduction * 50 * improvementsBasic.listOfImprovements[i].improvementLevel > tempFloat) * { * if(tempTech == i) * { * tempFloat += improvementsBasic.tempImprovementCostReduction * 50 * improvementsBasic.listOfImprovements[i].improvementLevel; * } * else * { * tempFloat = improvementsBasic.tempImprovementCostReduction * 50 * improvementsBasic.listOfImprovements[i].improvementLevel; * tempTech = i; * } * } * } * * if(improvementsBasic.tempResearchCostReduction * 50 * improvementsBasic.listOfImprovements[i].improvementLevel > improvementsBasic.listOfImprovements[i].improvementCost) * { * if(improvementsBasic.tempResearchCostReduction * 50 * improvementsBasic.listOfImprovements[i].improvementLevel > tempFloat) * { * if(tempTech == i) * { * tempFloat += improvementsBasic.tempResearchCostReduction * 50 * improvementsBasic.listOfImprovements[i].improvementLevel; * } * else * { * tempFloat = improvementsBasic.tempResearchCostReduction * 50 * improvementsBasic.listOfImprovements[i].improvementLevel; * tempTech = i; * } * } * } * }*/ private void CheckToSaveForHero() { checkHeroTimer++; if (checkHeroTimer == 6) { float temp = 0; for (int j = 0; j < MasterScript.systemListConstructor.systemList.Count; ++j) { if (MasterScript.systemListConstructor.systemList[j].systemOwnedBy == thisPlayer.playerRace) { systemSIMData = MasterScript.systemListConstructor.systemList[j].systemObject.GetComponent <SystemSIMData>(); temp += systemSIMData.totalSystemKnowledge + systemSIMData.totalSystemPower; } if (temp >= ((playerOwnedHeroes.Count * 20f) + 20f)) { saveForHero = true; } else if (temp < ((playerOwnedHeroes.Count * 20f) + 20f)) { saveForHero = false; } } checkHeroTimer = 0; } }
private void UpdateOverview() { if (MasterScript.cameraFunctionsScript.selectedSystem != null) { selectedSystem = MasterScript.cameraFunctionsScript.selectedSystemNumber; systemName.text = MasterScript.systemListConstructor.systemList[selectedSystem].systemName.ToUpper(); systemSize.text = ReturnSystemSize(MasterScript.systemListConstructor.systemList[selectedSystem].systemSize).ToUpper(); systemSIMData = MasterScript.systemListConstructor.systemList[selectedSystem].systemObject.GetComponent <SystemSIMData>(); if (selectedPlanet != -1) { systemSIMData.CheckPlanetValues(selectedPlanet, "None"); string headerTemp = MasterScript.systemListConstructor.systemList[selectedSystem].systemName + " " + (selectedPlanet + 1); planetHeaderName.text = headerTemp.ToUpper(); planetHeaderClass.text = MasterScript.systemListConstructor.systemList[selectedSystem].planetsInSystem[selectedPlanet].planetCategory.ToUpper(); planetHeaderOwner.text = MasterScript.systemListConstructor.systemList[selectedSystem].systemOwnedBy; } if (MasterScript.cameraFunctionsScript.openMenu == true) { systemPower.text = Math.Round(systemSIMData.totalSystemPower, 1).ToString(); systemKnowledge.text = Math.Round(systemSIMData.totalSystemKnowledge, 1).ToString(); systemWealth.text = Math.Round(systemSIMData.totalSystemWealth, 1).ToString(); } } }
public void IncreaseAmber(int system) { SystemSIMData systemSIMData = MasterScript.systemListConstructor.systemList [system].systemObject.GetComponent <SystemSIMData> (); ImprovementsBasic improvementsBasic = MasterScript.systemListConstructor.systemList [system].systemObject.GetComponent <ImprovementsBasic> (); systemSIMData.totalSystemAmber = 0f; if (improvementsBasic.listOfImprovements[28].hasBeenBuilt == true) { float tempMod = 0.1f; if (improvementsBasic.IsBuiltOnPlanetType(system, 28, "Molten") == true) { tempMod = 0.15f; } for (int i = 0; i < MasterScript.systemListConstructor.systemList[system].systemSize; ++i) { string tempString = MasterScript.systemListConstructor.systemList[system].planetsInSystem[i].planetType; if (tempString == "Molten" || tempString == "Chasm" || tempString == "Waste") { systemSIMData.totalSystemAmber += (tempMod * 2f) * improvementsBasic.amberProductionBonus; } else { systemSIMData.totalSystemAmber += tempMod * improvementsBasic.amberProductionBonus; } } } systemSIMData.totalSystemAmber += improvementsBasic.amberPointBonus; MasterScript.racialTraitScript.amber += systemSIMData.totalSystemAmber; }
public void Promote() { heroScript = currentHero.GetComponent <HeroScriptParent> (); systemSIMData = heroScript.heroLocation.GetComponent <SystemSIMData> (); systemSIMData.embargoedBy = null; systemSIMData.promotedBy = heroScript.heroOwnedBy; systemSIMData.promotionTimer = Time.time; }
public float CheckThroughSystems(TurnInfo thisPlayer) { highestSIM = 0; for (int i = 0; i < MasterScript.systemListConstructor.mapSize; ++i) { if (MasterScript.systemListConstructor.systemList[i].systemOwnedBy == thisPlayer.playerRace) { for (int j = 0; j < MasterScript.systemListConstructor.systemList[i].permanentConnections.Count; ++j) { tempSIM = 0.0f; int k = MasterScript.RefreshCurrentSystem(MasterScript.systemListConstructor.systemList[i].permanentConnections[j]); systemSIMData = MasterScript.systemListConstructor.systemList[k].systemObject.GetComponent <SystemSIMData>(); if (MasterScript.systemListConstructor.systemList[k].systemOwnedBy == null) { if (systemSIMData.guardedBy == "" || systemSIMData.guardedBy == thisPlayer.playerRace || systemSIMData.guardedBy == null) { float tempPlanetSIM = 0.0f; int tempPlanet = -1; float tempHighestPlanetSIM = 0.0f; for (int l = 0; l < MasterScript.systemListConstructor.systemList[k].systemSize; ++l) { tempPlanetSIM = (MasterScript.systemListConstructor.systemList[k].planetsInSystem[l].planetKnowledge + MasterScript.systemListConstructor.systemList[k].planetsInSystem[l].planetPower) * (MasterScript.systemListConstructor.systemList[k].planetsInSystem[l].currentImprovementSlots); if (tempPlanetSIM > tempHighestPlanetSIM) { tempHighestPlanetSIM = tempPlanetSIM; tempPlanet = l; } tempSIM += tempPlanetSIM; } tempSIM = (tempSIM / MasterScript.systemListConstructor.systemList[k].systemSize); if (tempSIM > highestSIM) { highestSIM = tempSIM; tempSystemB = k; tempPlanetB = tempPlanet; } } } } } } return(highestSIM); }
public void ShipAbilities(TurnInfo thisPlayer) { heroScript = gameObject.GetComponent <HeroScriptParent> (); system = MasterScript.RefreshCurrentSystem(heroScript.heroLocation); ShipFunctions.UpdateShips(); heroScript.assaultDamage = ShipFunctions.primaryWeaponPower * heroScript.assaultMod; heroScript.maxHealth = ShipFunctions.armourRating * heroScript.healthMod; heroScript.movementSpeed = ShipFunctions.engineValue * heroScript.movementMod; if (heroScript.heroType == "Diplomat") { heroScript.auxiliaryDamage = ShipFunctions.dropshipPower * heroScript.auxiliaryMod; DiplomatFunctions((ShipFunctions.logisticsRating + 10), thisPlayer); canViewSystem = true; } if (heroScript.heroType == "Infiltrator") { heroScript.auxiliaryDamage = ShipFunctions.bombPower * heroScript.auxiliaryMod; canViewSystem = true; systemSIMData = MasterScript.systemListConstructor.systemList[system].systemObject.GetComponent <SystemSIMData>(); if (MasterScript.systemListConstructor.systemList[system].systemOwnedBy != thisPlayer.playerRace) { if (ShipFunctions.stealthValue >= systemSIMData.antiStealthPower) { hasStealth = true; } else { hasStealth = false; } } if (ShipFunctions.infiltratorEngine == true) { heroScript.movementSpeed = 1000; } } if (heroScript.heroType == "Soldier") { heroScript.auxiliaryDamage = ShipFunctions.artilleryPower * heroScript.auxiliaryMod; if (ShipFunctions.soldierPrimary == true) { heroScript.assaultDamage = heroScript.assaultDamage * 2; } } }
public void AIExpansion() { if (thisPlayer.wealth > 1) { MasterScript.turnInfoScript.RefreshPlanetPower(); currentPlanet = -1; currentSystem = -1; float planetSIM = CheckThroughPlanets(thisPlayer); float systemSIM = CheckThroughSystems(thisPlayer); if (planetSIM > systemSIM && thisPlayer.wealth >= MasterScript.systemListConstructor.systemList[tempSystem].planetsInSystem[tempPlanet].wealthValue) { currentPlanet = tempPlanet; currentSystem = tempSystem; thisPlayer.wealth -= MasterScript.systemListConstructor.systemList[tempSystem].planetsInSystem[tempPlanet].wealthValue; } if (systemSIM > planetSIM && thisPlayer.wealth >= 20.0f) { currentPlanet = tempPlanetB; currentSystem = tempSystemB; systemSIMData = MasterScript.systemListConstructor.systemList[currentSystem].systemObject.GetComponent <SystemSIMData>(); systemSIMData.guardedBy = null; MasterScript.systemListConstructor.systemList[currentSystem].systemOwnedBy = thisPlayer.playerRace; MasterScript.voronoiGenerator.voronoiCells[currentSystem].renderer.material = thisPlayer.materialInUse; MasterScript.voronoiGenerator.voronoiCells[currentSystem].renderer.material.shader = Shader.Find("Transparent/Diffuse"); ++systemsInPlay; ++thisPlayer.systemsColonisedThisTurn; thisPlayer.wealth -= 20.0f; } if (currentPlanet != -1 && currentSystem != -1) { MasterScript.systemListConstructor.systemList[currentSystem].planetsInSystem[currentPlanet].planetColonised = true; MasterScript.systemListConstructor.systemList [currentSystem].planetsInSystem [currentPlanet].expansionPenaltyTimer = Time.time; ++thisPlayer.planetsColonisedThisTurn; } CheckToImprovePlanet(thisPlayer); } }
public void TurnEnd(TurnInfo selectedPlayer) //This function accumulates all the SIM generated by each system to give an empire SIM value { selectedPlayer.researchCostModifier = 0; MasterScript.diplomacyScript.DiplomaticStateEffects(); CalculateExpansionModifier(selectedPlayer); for (int i = 0; i < MasterScript.systemListConstructor.mapSize; ++i) { if (MasterScript.systemListConstructor.systemList[i].systemOwnedBy != selectedPlayer.playerRace) { continue; } SystemSIMData systemSIMData = MasterScript.systemListConstructor.systemList[i].systemObject.GetComponent <SystemSIMData>(); ImprovementsBasic improvementsBasic = MasterScript.systemListConstructor.systemList[i].systemObject.GetComponent <ImprovementsBasic>(); SystemDefence systemDefence = MasterScript.systemListConstructor.systemList[i].systemObject.GetComponent <SystemDefence>(); systemDefence.CalculateSystemDefence(); improvementsBasic.ActiveTechnologies(i, selectedPlayer); systemSIMData.SystemSIMCounter(selectedPlayer); MasterScript.systemFunctions.CheckUnlockedTier(improvementsBasic, i); selectedPlayer.knowledge += systemSIMData.totalSystemKnowledge; selectedPlayer.power += systemSIMData.totalSystemPower; if (selectedPlayer.playerRace == "Selkies") { MasterScript.racialTraitScript.amber += systemSIMData.totalSystemAmber; } selectedPlayer.researchCostModifier += improvementsBasic.researchCost; } for (int j = 0; j < selectedPlayer.playerOwnedHeroes.Count; ++j) { HeroScriptParent heroScript = selectedPlayer.playerOwnedHeroes[j].GetComponent <HeroScriptParent>(); heroScript.HeroEndTurnFunctions(selectedPlayer); } MasterScript.racialTraitScript.RacialBonus(selectedPlayer); MasterScript.turnInfoScript.SortSystemPower(); if (selectedPlayer.wealth > 10000.0f) { selectedPlayer.wealth = 10000.0f; } selectedPlayer.planetsColonisedThisTurn = 0; selectedPlayer.systemsColonisedThisTurn = 0; }
void Start() { planetToBuildOn = new List <string>(); knowledgePercentBonus = 0; powerPercentBonus = 0; systemSIMData = gameObject.GetComponent <SystemSIMData>(); //References to scripts again. genericImprovements = GameObject.Find("ScriptsContainer").GetComponent <GenericImprovements> (); LoadNewTechTree(); }
void Update() { if (Input.GetMouseButtonDown(0) && MasterScript.cameraFunctionsScript.selectedSystem != null) //Assigns scripts to selected system. { tempObject = MasterScript.cameraFunctionsScript.selectedSystem; if (tempObject != null && tempObject.tag == "StarSystem") { systemSIMData = tempObject.GetComponent <SystemSIMData>(); } } MasterScript.cameraFunctionsScript.CentreCamera(); //Checks if camera needs centreing }
private void UpdateVariables(int i) { systemSIMData = MasterScript.systemListConstructor.systemList [i].systemObject.GetComponent <SystemSIMData> (); overlayObjectList [i].power.text = Math.Round(systemSIMData.totalSystemPower, 1).ToString(); overlayObjectList [i].knowledge.text = Math.Round(systemSIMData.totalSystemKnowledge, 1).ToString(); float colonisedPlanets = 0; for (int j = 0; j < MasterScript.systemListConstructor.systemList[i].systemSize; ++j) { if (MasterScript.systemListConstructor.systemList[i].planetsInSystem[j].planetColonised == true) { ++colonisedPlanets; } } overlayObjectList[i].planets.fillAmount = (1f / MasterScript.systemListConstructor.systemList[i].systemSize) * colonisedPlanets; }
private float PromoteBonus() //Calculates resource bonus from promotions on enemy systems { float totalAdjacencyBonus = 1f; if (promotedBy == null) { for (int i = 0; i < MasterScript.systemListConstructor.systemList[thisSystem].permanentConnections.Count; ++i) { int j = MasterScript.RefreshCurrentSystem(MasterScript.systemListConstructor.systemList[thisSystem].permanentConnections[i]); systemSIMData = MasterScript.systemListConstructor.systemList[j].systemObject.GetComponent <SystemSIMData>(); if (systemSIMData.promotedBy != null) { if (MasterScript.systemListConstructor.systemList[j].systemOwnedBy == thisPlayer.playerRace) { totalAdjacencyBonus += 0.05f; } else { totalAdjacencyBonus += 0.1f; } } } } else if (promotedBy != null) { if (promotionTimer + 30.0f < Time.time) { promotedBy = null; } DiplomaticPosition temp = MasterScript.diplomacyScript.ReturnDiplomaticRelation(thisPlayer.playerRace, promotedBy); ++temp.stateCounter; totalAdjacencyBonus = 1.5f; } return(totalAdjacencyBonus); }
public void CheckUnlockedTier(ImprovementsBasic improvements, int system) { systemSIMData = MasterScript.systemListConstructor.systemList [system].systemObject.GetComponent <SystemSIMData> (); systemSIMData.totalSystemSIM += systemSIMData.totalSystemKnowledge + systemSIMData.totalSystemPower; if (systemSIMData.totalSystemSIM >= 1600.0f && systemSIMData.totalSystemSIM < 3200 && improvements.techTier != 1) { improvements.techTier = 1; } if (systemSIMData.totalSystemSIM >= 3200.0f && systemSIMData.totalSystemSIM < 6400 && improvements.techTier != 2) { improvements.techTier = 2; } if (systemSIMData.totalSystemSIM >= 6400.0f && improvements.techTier != 3) { improvements.techTier = 3; } }
public void RefreshPlanetPower() { mostPowerfulPlanets.Clear(); MasterScript.turnInfoScript.savedIterator = 0; for (int i = 0; i < MasterScript.systemListConstructor.mapSize; i++) { if (MasterScript.systemListConstructor.systemList[i].systemOwnedBy == null) { continue; } SystemSIMData systemSIMData = MasterScript.systemListConstructor.systemList[i].systemObject.GetComponent <SystemSIMData>(); systemSIMData.UpdatePlanetPowerArray(); } SortSystemPower(); }
public void DiplomatFunctions(int links, TurnInfo thisPlayer) { CheckTradeRoutesAreValid(thisPlayer); for (int i = 0; i < links; ++i) { ActivateCurrentTradeRoutes(i, thisPlayer); if (i >= allTradeRoutes.Count) { MakeNewTradeRoutes(thisPlayer); } } if (heroScript.heroOwnedBy == thisPlayer.playerRace) { systemSIMData = heroScript.heroLocation.GetComponent <SystemSIMData>(); systemSIMData.totalSystemPower += systemSIMData.totalSystemPower * (0.2f + thisPlayer.racePower); systemSIMData.totalSystemKnowledge += systemSIMData.totalSystemKnowledge * (0.2f + thisPlayer.raceKnowledge); } }
private void ActivateCurrentTradeRoutes(int i, TurnInfo thisPlayer) { if (i < allTradeRoutes.Count) { int pSys = allTradeRoutes[i].playerSystem; int eSys = allTradeRoutes[i].enemySystem; SystemSIMData playerSystemData = MasterScript.systemListConstructor.systemList[pSys].systemObject.GetComponent <SystemSIMData>(); SystemSIMData enemySystemData = MasterScript.systemListConstructor.systemList[eSys].systemObject.GetComponent <SystemSIMData>(); float playerPowerTransfer = playerSystemData.totalSystemPower / 2; float playerKnowledgeTransfer = playerSystemData.totalSystemKnowledge / 2; float enemyPowerTransfer = enemySystemData.totalSystemPower / 2; float enemyKnowledgeTransfer = enemySystemData.totalSystemKnowledge / 2; playerSystemData.totalSystemPower += playerPowerTransfer; playerSystemData.totalSystemKnowledge += playerKnowledgeTransfer; enemySystemData.totalSystemPower += enemyPowerTransfer; enemySystemData.totalSystemKnowledge += enemyKnowledgeTransfer; } }
void EconomicWin() { float knowledgeRate = 0; float powerRate = 0; for (int i = 0; i < MasterScript.systemListConstructor.mapSize; ++i) { if (MasterScript.systemListConstructor.systemList[i].systemOwnedBy == player.playerRace) { SystemSIMData systemSIMData = MasterScript.systemListConstructor.systemList[i].systemObject.GetComponent <SystemSIMData>(); knowledgeRate += systemSIMData.totalSystemKnowledge; powerRate += systemSIMData.totalSystemPower; } } if (knowledgeRate >= 1000f && powerRate >= 1000f) { winPlayer = player.playerRace; winCondition = "Economic"; } }
public void ImprovePlanet(int planetPosition, int system, TurnInfo thisPlayer) { systemSIMData = MasterScript.systemListConstructor.systemList [system].systemObject.GetComponent <SystemSIMData> (); systemDefence = MasterScript.systemListConstructor.systemList [system].systemObject.GetComponent <SystemDefence> (); systemSIMData.improvementNumber = MasterScript.systemListConstructor.systemList[system].planetsInSystem[planetPosition].planetImprovementLevel; MasterScript.systemFunctions.CheckImprovement(system, planetPosition); if (systemSIMData.canImprove == true && systemDefence.underInvasion == false) { float powerImprovementCost = MasterScript.systemFunctions.PowerCost(systemSIMData.improvementNumber, system, planetPosition); if (thisPlayer.power >= powerImprovementCost && thisPlayer.wealth >= systemSIMData.improvementCost) { ++MasterScript.systemListConstructor.systemList[system].planetsInSystem[planetPosition].planetImprovementLevel; thisPlayer.power -= powerImprovementCost; thisPlayer.wealth -= systemSIMData.improvementCost; } } }
void Start() { systemSIMData = gameObject.GetComponent <SystemSIMData> (); CalculateSystemDefence(); system = MasterScript.RefreshCurrentSystem(gameObject); }
public void HeroDecisionStart(TurnInfo thisPlayer) { player = thisPlayer; for (int i = 0; i < MasterScript.diplomacyScript.relationsList.Count; ++i) { if (MasterScript.diplomacyScript.relationsList[i].playerOne.playerRace == player.playerRace || MasterScript.diplomacyScript.relationsList[i].playerTwo.playerRace == player.playerRace) { string enemyRace = null; if (MasterScript.diplomacyScript.relationsList[i].playerTwo.playerRace == player.playerRace) { enemyRace = MasterScript.diplomacyScript.relationsList[i].playerOne.playerRace; } if (MasterScript.diplomacyScript.relationsList[i].playerOne.playerRace == player.playerRace) { enemyRace = MasterScript.diplomacyScript.relationsList[i].playerTwo.playerRace; } if (MasterScript.diplomacyScript.relationsList[i].diplomaticState == "War") { float protectSystemValue = 0f, invadeSystemValue = 0f; int systemToProtect = -1, systemToInvade = -1; for (int j = 0; j < MasterScript.systemListConstructor.systemList.Count; ++j) { systemDefence = MasterScript.systemListConstructor.systemList[j].systemObject.GetComponent <SystemDefence>(); systemSIMData = MasterScript.systemListConstructor.systemList[j].systemObject.GetComponent <SystemSIMData>(); if (MasterScript.systemListConstructor.systemList[j].systemOwnedBy == player.playerRace && systemDefence.underInvasion == true && systemSIMData.totalSystemSIM > protectSystemValue) { protectSystemValue = systemSIMData.totalSystemSIM; systemToProtect = j; } if (MasterScript.systemListConstructor.systemList[j].systemOwnedBy == enemyRace && systemDefence.underInvasion != true) { float tempSIM = systemSIMData.totalSystemSIM; float tempDefence = systemDefence.maxSystemDefence; float simToDefRatio = tempSIM / tempDefence; if (simToDefRatio > invadeSystemValue) { invadeSystemValue = simToDefRatio; systemToInvade = j; } } } if (systemToProtect != -1 && systemToInvade == -1) { SetDestinationSystem(systemToProtect, "Protect"); } if (systemToProtect == -1 && systemToInvade != -1) { SetDestinationSystem(systemToInvade, "Invade"); } if (systemToProtect != -1 && systemToInvade != -1) { systemSIMData = MasterScript.systemListConstructor.systemList[systemToProtect].systemObject.GetComponent <SystemSIMData>(); systemDefence = MasterScript.systemListConstructor.systemList[systemToProtect].systemObject.GetComponent <SystemDefence>(); float tempSIM = systemSIMData.totalSystemSIM; float tempDefence = systemDefence.maxSystemDefence; float simToDefRatio = tempSIM / tempDefence; if (simToDefRatio >= invadeSystemValue) { SetDestinationSystem(systemToProtect, "Protect"); } else { SetDestinationSystem(systemToInvade, "Invade"); } } } } } }
public void TechSwitch(int tech, int planet, ImprovementsBasic tempImprov, TurnInfo player, bool check) { improvements = tempImprov; systemSIMData = MasterScript.systemListConstructor.systemList [tempImprov.system].systemObject.GetComponent <SystemSIMData> (); checkValue = check; thisPlayer = player; improvements.planetToBuildOn.Clear(); improvements.tempCount = 0f; switch (tech) { case 0: //Amplification T1I1(); break; case 1: //Fertile Link T1I2(); break; case 2: //Fortune T1I3(); break; case 3: //Injection T2I1(); break; case 4: //Custodians T2I2(); break; case 5: //Isolation T2I3(planet); break; case 6: //Inertia T3I1(planet); break; case 7: //Nostalgia T3I2(planet); break; case 8: //Redundancy T3I3(); break; case 9: //Convergence T4I1(); break; case 10: //Foundation T4I2(); break; case 11: //Perception T4I3(); break; default: break; } if (thisPlayer.playerRace == "Humans") { humanImprovements.TechSwitch(tech, planet, tempImprov, thisPlayer, checkValue); } if (thisPlayer.playerRace == "Nereides") { nereidesImprovements.TechSwitch(tech, planet, tempImprov, thisPlayer, checkValue); } if (thisPlayer.playerRace == "Selkies") { selkiesImprovements.TechSwitch(tech, planet, tempImprov, thisPlayer, checkValue); } }
public void Protect() { systemSIMData = heroScript.heroLocation.GetComponent <SystemSIMData> (); systemSIMData.protectedBy = heroScript.gameObject; }
public void TechSwitch(int tech, int planet, ImprovementsBasic tempImprov, TurnInfo thisPlayer, bool check) { improvements = tempImprov; systemSIMData = MasterScript.systemListConstructor.systemList [improvements.system].systemObject.GetComponent <SystemSIMData> (); checkValue = check; player = thisPlayer; switch (tech) { case 40: //Recycle TN1I1(); break; case 41: //Volatility TN1I2(); break; case 42: //Rebirth TN1I3(); break; case 43: //Cognisance TN1I4(); break; case 44: //Integration TN1I5(planet); break; case 45: //Value of Vision TN2I1(planet); break; case 46: //Cooperation TN2I2(); break; case 47: //Mastery TN2I3(); break; case 48: //Subterra TN2I4(planet); break; case 49: //Subversion TN2I5(); break; case 50: //Fractal Growth TN3I1(); break; case 51: //Savants TN3I2(planet); break; case 52: //Theory Complete TN3I3(planet); break; case 53: //Enrichement TN3I4(planet); break; case 54: //Hidden Legion TN3I5(); break; case 55: //Enraptue TN4I1(); break; case 56: //Proliferate TN4I2(); break; case 57: //Bathus TN4I3(planet); break; case 58: //Obfuscate TN4I4(); break; case 59: //Pacifism TN4I5(); break; default: break; } }
public void Guard() { systemSIMData = heroScript.heroLocation.GetComponent <SystemSIMData> (); systemSIMData.guardedBy = heroScript.heroOwnedBy; }
public void TechSwitch(int tech, int planet, ImprovementsBasic tempImprov, TurnInfo thisPlayer, bool check) { systemSIMData = MasterScript.systemListConstructor.systemList[improvements.system].systemObject.GetComponent <SystemSIMData>(); improvements = tempImprov; checkValue = check; player = thisPlayer; switch (tech) //The order of these is important { case 60: TS1I1(); break; case 61: TS1I2(); break; case 62: TS1I3(); break; case 63: TS1I4(); break; case 64: TS1I5(); break; case 65: TS2I1(); break; case 66: TS2I2(); break; case 67: TS2I3(); break; case 68: TS2I4(); break; case 69: TS2I5(); break; case 70: TS3I1(); break; case 71: TS3I2(planet); break; case 72: TS3I3(); break; case 73: TS3I4(); break; case 74: TS3I5(); break; case 75: TS4I1(); break; case 76: TS4I2(); break; case 77: TS4I3(); break; case 78: TS4I4(planet); break; case 79: TS4I5(); break; default: break; } }
public void FindSystem(int system) //This function is used to check if the highlighted system can be colonised, and if it can, to colonise it { for (int i = 0; i < MasterScript.systemListConstructor.systemList[system].permanentConnections.Count; ++i) { int j = MasterScript.RefreshCurrentSystem(MasterScript.systemListConstructor.systemList[system].permanentConnections[i]); if (MasterScript.systemListConstructor.systemList[j].systemOwnedBy == MasterScript.playerTurnScript.playerRace) { isOkToColonise = true; } else { continue; } } if (systemSIMData.guardedBy == "" || systemSIMData.guardedBy == MasterScript.playerTurnScript.playerRace) { if (isOkToColonise == true && wealth >= 10.0f) { systemSIMData = MasterScript.systemListConstructor.systemList[system].systemObject.GetComponent <SystemSIMData>(); if (checkFirstContact == true) { for (int i = 0; i < MasterScript.diplomacyScript.relationsList.Count; ++i) { checkFirstContact = false; if (MasterScript.diplomacyScript.relationsList[i].firstContact == false) { checkFirstContact = true; } } for (int i = 0; i < MasterScript.systemListConstructor.systemList[system].permanentConnections.Count; ++i) { int j = MasterScript.RefreshCurrentSystem(MasterScript.systemListConstructor.systemList[system].permanentConnections[i]); for (int k = 0; k < MasterScript.diplomacyScript.relationsList.Count; ++k) { if (MasterScript.diplomacyScript.relationsList[k].playerOne.playerRace == MasterScript.systemListConstructor.systemList[system].systemOwnedBy) { if (MasterScript.diplomacyScript.relationsList[k].playerTwo.playerRace == MasterScript.systemListConstructor.systemList[j].systemOwnedBy) { if (MasterScript.diplomacyScript.relationsList[k].firstContact == false) { MasterScript.diplomacyScript.relationsList[k].firstContact = true; } } } if (MasterScript.diplomacyScript.relationsList[k].playerTwo.playerRace == MasterScript.systemListConstructor.systemList[system].systemOwnedBy) { if (MasterScript.diplomacyScript.relationsList[k].playerOne.playerRace == MasterScript.systemListConstructor.systemList[j].systemOwnedBy) { if (MasterScript.diplomacyScript.relationsList[k].firstContact == false) { MasterScript.diplomacyScript.relationsList[k].firstContact = true; } } } } } } systemSIMData.guardedBy = null; MasterScript.systemListConstructor.systemList[system].systemOwnedBy = playerRace; //voronoiGenerator.voronoiCells[system].renderer.material = materialInUse; //TODO //voronoiGenerator.voronoiCells[system].renderer.material.shader = Shader.Find("Transparent/Diffuse"); MasterScript.playerTurnScript.wealth -= 10.0f; ++MasterScript.turnInfoScript.systemsInPlay; ++systemsColonisedThisTurn; MasterScript.cameraFunctionsScript.coloniseMenu = false; isOkToColonise = false; systemHasBeenColonised = true; } } }
public void TechSwitch(int tech, int planet, ImprovementsBasic tempImprov, TurnInfo thisPlayer, bool check) { systemSIMData = MasterScript.systemListConstructor.systemList [tempImprov.system].systemObject.GetComponent <SystemSIMData> (); improvements = tempImprov; checkValue = check; player = thisPlayer; switch (tech) { case 12: //Earth's Bounty TH1I1(planet); break; case 13: //Expertise TH1I2(); break; case 14: //Summer's Song TH1I3(planet); break; case 15: //Nurture TH1I4(); break; case 16: //Horizon TH1I5(); break; case 17: //Skyward TH2I1(planet); break; case 18: //Deep Source TH2I2(planet); break; case 19: //Winter's Dirge TH2I3(planet); break; case 20: //Overflow TH2I4(); break; case 21: //Rainfall TH2I5(); break; case 22: //Creation TH3I1(); break; case 23: //Autumn's Air TH3I2(planet); break; case 24: //Orbital TH3I3(planet); break; case 25: //Waters of Life TH3I4(); break; case 26: //Enclave TH3I5(); break; case 27: //Insight TH4I1(); break; case 28: //Spring's Serenade TH4I2(planet); break; case 29: //Ascension TH4I3(); break; case 30: //Opulence TH4I4(); break; case 31: //Expulsion TH4I5(); break; default: break; } }
private void MakeNewTradeRoutes(TurnInfo thisPlayer) { float tempSystemSI = 0; int chosenEnemySystem = -1, chosenPlayerSystem = -1; string tempOwner = null; for (int i = 0; i < MasterScript.systemListConstructor.systemList.Count; ++i) //For all systems { if (MasterScript.systemListConstructor.systemList[i].systemOwnedBy == null) //If system is not owned ignore it { continue; } if (MasterScript.systemListConstructor.systemList[i].systemOwnedBy == thisPlayer.playerRace) //If system is owned by the player { for (int j = 0; j < MasterScript.systemListConstructor.systemList[i].permanentConnections.Count; ++j) //For all systems connected to this system { int sys = MasterScript.RefreshCurrentSystem(MasterScript.systemListConstructor.systemList[i].permanentConnections[j]); if (MasterScript.systemListConstructor.systemList[sys].systemOwnedBy == null || MasterScript.systemListConstructor.systemList[sys].systemOwnedBy == thisPlayer.playerRace) //If the system is owned by this player or not at all ignore it { continue; } GameObject enemySystem = MasterScript.systemListConstructor.systemList[sys].systemObject; bool routeExists = false; //Say the proposed route between these systems does not exist for (int k = 0; k < allTradeRoutes.Count; ++k) //For all existing trade routes { if ((allTradeRoutes[k].enemySystem == sys && allTradeRoutes[k].playerSystem == i) || (allTradeRoutes[k].playerSystem == sys && allTradeRoutes[k].enemySystem == i)) //Check to see if the proposed one exists { routeExists = true; } } if (routeExists == false) //If the route doesn't exist { systemSIMData = enemySystem.GetComponent <SystemSIMData>(); //Get a reference to the SI output data float temp = systemSIMData.totalSystemPower + systemSIMData.totalSystemKnowledge; //Calculate the system power plus it's knowledge if (temp > tempSystemSI) //If the calculated value is greater than the stored value, this trade route is more valuable than the cached one { tempSystemSI = temp; //So cache this one over it! chosenEnemySystem = sys; chosenPlayerSystem = i; tempOwner = MasterScript.systemListConstructor.systemList[sys].systemOwnedBy; } } } } } if (chosenEnemySystem != -1) { TradeRoute route = new TradeRoute(); route.playerSystem = chosenPlayerSystem; route.enemySystem = chosenEnemySystem; route.connectorObject = MasterScript.uiObjects.CreateConnectionLine(MasterScript.systemListConstructor.systemList[route.playerSystem].systemObject, MasterScript.systemListConstructor.systemList[route.enemySystem].systemObject); route.enemySystemOwner = tempOwner; for (int i = 0; i < MasterScript.turnInfoScript.allPlayers.Count; ++i) { if (MasterScript.turnInfoScript.allPlayers[i].playerRace == tempOwner) { route.enemyPlayer = MasterScript.turnInfoScript.allPlayers[i]; } } allTradeRoutes.Add(route); } }