public void AcceptThreat(Offer ToUs, Offer FromUs, Empire us, Empire Them) { if (ToUs.PeaceTreaty) { this.empire.GetRelations()[Them].AtWar = false; this.empire.GetRelations()[Them].PreparingForWar = false; this.empire.GetRelations()[Them].ActiveWar.EndStarDate = this.empire.GetUS().StarDate; this.empire.GetRelations()[Them].WarHistory.Add(this.empire.GetRelations()[Them].ActiveWar); this.empire.GetRelations()[Them].Posture = Posture.Neutral; if (this.empire.GetRelations()[Them].Anger_FromShipsInOurBorders > (float)(this.empire.data.DiplomaticPersonality.Territorialism / 3)) { this.empire.GetRelations()[Them].Anger_FromShipsInOurBorders = (float)(this.empire.data.DiplomaticPersonality.Territorialism / 3); } if (this.empire.GetRelations()[Them].Anger_TerritorialConflict > (float)(this.empire.data.DiplomaticPersonality.Territorialism / 3)) { this.empire.GetRelations()[Them].Anger_TerritorialConflict = (float)(this.empire.data.DiplomaticPersonality.Territorialism / 3); } this.empire.GetRelations()[Them].Anger_MilitaryConflict = 0f; this.empire.GetRelations()[Them].WarnedAboutShips = false; this.empire.GetRelations()[Them].WarnedAboutColonizing = false; this.empire.GetRelations()[Them].HaveRejected_Demand_Tech = false; this.empire.GetRelations()[Them].HaveRejected_OpenBorders = false; this.empire.GetRelations()[Them].HaveRejected_TRADE = false; this.empire.GetRelations()[Them].HasDefenseFleet = false; if (this.empire.GetRelations()[Them].DefenseFleet != -1) { this.empire.GetFleetsDict()[this.empire.GetRelations()[Them].DefenseFleet].Task.EndTask(); } lock (GlobalStats.TaskLocker) { foreach (MilitaryTask task in this.TaskList) { if (task.GetTargetPlanet() == null || task.GetTargetPlanet().Owner == null || task.GetTargetPlanet().Owner != Them) { continue; } task.EndTask(); } } this.empire.GetRelations()[Them].ActiveWar = null; Them.GetRelations()[this.empire].AtWar = false; Them.GetRelations()[this.empire].PreparingForWar = false; Them.GetRelations()[this.empire].ActiveWar.EndStarDate = Them.GetUS().StarDate; Them.GetRelations()[this.empire].WarHistory.Add(Them.GetRelations()[this.empire].ActiveWar); Them.GetRelations()[this.empire].Posture = Posture.Neutral; if (EmpireManager.GetEmpireByName(Them.GetUS().PlayerLoyalty) != Them) { if (Them.GetRelations()[this.empire].Anger_FromShipsInOurBorders > (float)(Them.data.DiplomaticPersonality.Territorialism / 3)) { Them.GetRelations()[this.empire].Anger_FromShipsInOurBorders = (float)(Them.data.DiplomaticPersonality.Territorialism / 3); } if (Them.GetRelations()[this.empire].Anger_TerritorialConflict > (float)(Them.data.DiplomaticPersonality.Territorialism / 3)) { Them.GetRelations()[this.empire].Anger_TerritorialConflict = (float)(Them.data.DiplomaticPersonality.Territorialism / 3); } Them.GetRelations()[this.empire].Anger_MilitaryConflict = 0f; Them.GetRelations()[this.empire].WarnedAboutShips = false; Them.GetRelations()[this.empire].WarnedAboutColonizing = false; Them.GetRelations()[this.empire].HaveRejected_Demand_Tech = false; Them.GetRelations()[this.empire].HaveRejected_OpenBorders = false; Them.GetRelations()[this.empire].HaveRejected_TRADE = false; if (Them.GetRelations()[this.empire].DefenseFleet != -1) { Them.GetFleetsDict()[Them.GetRelations()[this.empire].DefenseFleet].Task.EndTask(); } lock (GlobalStats.TaskLocker) { foreach (MilitaryTask task in Them.GetGSAI().TaskList) { if (task.GetTargetPlanet() == null || task.GetTargetPlanet().Owner == null || task.GetTargetPlanet().Owner != this.empire) { continue; } task.EndTask(); } } } Them.GetRelations()[this.empire].ActiveWar = null; } if (ToUs.NAPact) { us.GetRelations()[Them].Treaty_NAPact = true; FearEntry te = new FearEntry(); if (EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty) != us) { string name = us.data.DiplomaticPersonality.Name; string str = name; if (name != null) { if (str == "Pacifist") { te.FearCost = 0f; } else if (str == "Cunning") { te.FearCost = 0f; } else if (str == "Xenophobic") { te.FearCost = 15f; } else if (str == "Aggressive") { te.FearCost = 35f; } else if (str == "Honorable") { te.FearCost = 5f; } else if (str == "Ruthless") { te.FearCost = 50f; } } } us.GetRelations()[Them].FearEntries.Add(te); } if (FromUs.NAPact) { Them.GetRelations()[us].Treaty_NAPact = true; if (EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty) != Them) { FearEntry te = new FearEntry(); string name1 = Them.data.DiplomaticPersonality.Name; string str1 = name1; if (name1 != null) { if (str1 == "Pacifist") { te.FearCost = 0f; } else if (str1 == "Cunning") { te.FearCost = 0f; } else if (str1 == "Xenophobic") { te.FearCost = 15f; } else if (str1 == "Aggressive") { te.FearCost = 35f; } else if (str1 == "Honorable") { te.FearCost = 5f; } else if (str1 == "Ruthless") { te.FearCost = 50f; } } Them.GetRelations()[us].FearEntries.Add(te); } } if (ToUs.TradeTreaty) { us.GetRelations()[Them].Treaty_Trade = true; us.GetRelations()[Them].Treaty_Trade_TurnsExisted = 0; FearEntry te = new FearEntry() { FearCost = 5f }; us.GetRelations()[Them].FearEntries.Add(te); } if (FromUs.TradeTreaty) { Them.GetRelations()[us].Treaty_Trade = true; Them.GetRelations()[us].Treaty_Trade_TurnsExisted = 0; FearEntry te = new FearEntry() { FearCost = 0.1f }; Them.GetRelations()[us].FearEntries.Add(te); } if (ToUs.OpenBorders) { us.GetRelations()[Them].Treaty_OpenBorders = true; FearEntry te = new FearEntry() { FearCost = 5f }; us.GetRelations()[Them].FearEntries.Add(te); } if (FromUs.OpenBorders) { Them.GetRelations()[us].Treaty_OpenBorders = true; FearEntry te = new FearEntry() { FearCost = 5f }; Them.GetRelations()[us].FearEntries.Add(te); } foreach (string tech in FromUs.TechnologiesOffered) { Them.UnlockTech(tech); if (EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty) == us) { continue; } FearEntry te = new FearEntry() { FearCost = (us.data.EconomicPersonality.Name == "Technologists" ? ResourceManager.TechTree[tech].Cost / 100f * 0.25f + ResourceManager.TechTree[tech].Cost / 100f : ResourceManager.TechTree[tech].Cost / 100f), TurnTimer = 40 }; us.GetRelations()[Them].FearEntries.Add(te); } foreach (string tech in ToUs.TechnologiesOffered) { us.UnlockTech(tech); if (EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty) == Them) { continue; } FearEntry te = new FearEntry() { FearCost = (Them.data.EconomicPersonality.Name == "Technologists" ? ResourceManager.TechTree[tech].Cost / 100f * 0.25f + ResourceManager.TechTree[tech].Cost / 100f : ResourceManager.TechTree[tech].Cost / 100f) }; Them.GetRelations()[us].FearEntries.Add(te); } foreach (string Art in FromUs.ArtifactsOffered) { Artifact toGive = ResourceManager.ArtifactsDict[Art]; foreach (Artifact arti in us.data.OwnedArtifacts) { if (arti.Name != Art) { continue; } toGive = arti; } us.RemoveArtifact(toGive); Them.AddArtifact(toGive); } foreach (string Art in ToUs.ArtifactsOffered) { Artifact toGive = ResourceManager.ArtifactsDict[Art]; foreach (Artifact arti in Them.data.OwnedArtifacts) { if (arti.Name != Art) { continue; } toGive = arti; } Them.RemoveArtifact(toGive); us.AddArtifact(toGive); } foreach (string planetName in FromUs.ColoniesOffered) { List<Planet> toRemove = new List<Planet>(); List<Ship> TroopShips = new List<Ship>(); foreach (Planet p in us.GetPlanets()) { if (p.Name != planetName) { continue; } foreach (PlanetGridSquare pgs in p.TilesList) { if (pgs.TroopsHere.Count <= 0 || pgs.TroopsHere[0].GetOwner() != this.empire) { continue; } TroopShips.Add(pgs.TroopsHere[0].Launch()); } toRemove.Add(p); p.Owner = Them; Them.AddPlanet(p); p.system.OwnerList.Clear(); foreach (Planet pl in p.system.PlanetList) { if (pl.Owner == null || p.system.OwnerList.Contains(pl.Owner)) { continue; } p.system.OwnerList.Add(pl.Owner); } float value = p.Population / 1000f + p.FoodHere / 50f + p.ProductionHere / 50f + p.Fertility + p.MineralRichness + p.MaxPopulation / 10000f; foreach (Building b in p.BuildingList) { value = value + b.Cost / 50f; } FearEntry te = new FearEntry(); if (value < 15f) { value = 15f; } te.FearCost = (us.data.EconomicPersonality.Name == "Expansionists" ? value + value : value + 0.5f * value); te.TurnTimer = 40; us.GetRelations()[Them].FearEntries.Add(te); } foreach (Planet p in toRemove) { us.GetPlanets().Remove(p); } foreach (Ship ship in TroopShips) { ship.GetAI().OrderRebaseToNearest(); } } foreach (string planetName in ToUs.ColoniesOffered) { List<Planet> toRemove = new List<Planet>(); List<Ship> TroopShips = new List<Ship>(); foreach (Planet p in Them.GetPlanets()) { if (p.Name != planetName) { continue; } toRemove.Add(p); p.Owner = us; us.AddPlanet(p); p.system.OwnerList.Clear(); foreach (Planet pl in p.system.PlanetList) { if (pl.Owner == null || p.system.OwnerList.Contains(pl.Owner)) { continue; } p.system.OwnerList.Add(pl.Owner); } float value = p.Population / 1000f + p.FoodHere / 50f + p.ProductionHere / 50f + p.Fertility + p.MineralRichness + p.MaxPopulation / 10000f; foreach (Building b in p.BuildingList) { value = value + b.Cost / 50f; } foreach (PlanetGridSquare pgs in p.TilesList) { if (pgs.TroopsHere.Count <= 0 || pgs.TroopsHere[0].GetOwner() != Them) { continue; } TroopShips.Add(pgs.TroopsHere[0].Launch()); } if (EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty) == Them) { continue; } FearEntry te = new FearEntry() { FearCost = (Them.data.EconomicPersonality.Name == "Expansionists" ? value + value : value + 0.5f * value), TurnTimer = 40 }; Them.GetRelations()[us].FearEntries.Add(te); } foreach (Planet p in toRemove) { Them.GetPlanets().Remove(p); } foreach (Ship ship in TroopShips) { ship.GetAI().OrderRebaseToNearest(); } } us.GetRelations()[Them].UpdateRelationship(us, Them); }