public string AnalyzeOffer(Offer ToUs, Offer FromUs, Empire them, Offer.Attitude attitude) { if (ToUs.Alliance) { if (!ToUs.IsBlank() || !FromUs.IsBlank()) { return "OFFER_ALLIANCE_TOO_COMPLICATED"; } if (this.empire.GetRelations()[them].Trust < 90f || this.empire.GetRelations()[them].TotalAnger >= 20f || this.empire.GetRelations()[them].TurnsKnown <= 100) { return "AI_ALLIANCE_REJECT"; } this.SetAlliance(true, them); return "AI_ALLIANCE_ACCEPT"; } if (ToUs.PeaceTreaty) { GSAI.PeaceAnswer answer = this.AnalyzePeaceOffer(ToUs, FromUs, them, attitude); if (!answer.peace) { return answer.answer; } this.AcceptOffer(ToUs, FromUs, this.empire, them); this.empire.GetRelations()[them].Treaty_Peace = true; this.empire.GetRelations()[them].PeaceTurnsRemaining = 100; them.GetRelations()[this.empire].Treaty_Peace = true; them.GetRelations()[this.empire].PeaceTurnsRemaining = 100; return answer.answer; } Empire us = this.empire; float TotalTrustRequiredFromUS = 0f; DTrait dt = us.data.DiplomaticPersonality; if (FromUs.TradeTreaty) { TotalTrustRequiredFromUS = TotalTrustRequiredFromUS + (float)dt.Trade; } if (FromUs.OpenBorders) { TotalTrustRequiredFromUS = TotalTrustRequiredFromUS + ((float)dt.NAPact + 7.5f); } if (FromUs.NAPact) { TotalTrustRequiredFromUS = TotalTrustRequiredFromUS + (float)dt.NAPact; int numWars = 0; foreach (KeyValuePair<Empire, Ship_Game.Gameplay.Relationship> Relationship in us.GetRelations()) { if (Relationship.Key.isFaction || !Relationship.Value.AtWar) { continue; } numWars++; } if (numWars > 0 && !us.GetRelations()[them].AtWar) { TotalTrustRequiredFromUS = TotalTrustRequiredFromUS - (float)dt.NAPact; } else if (us.GetRelations()[them].Threat >= 20f) { TotalTrustRequiredFromUS = TotalTrustRequiredFromUS - (float)dt.NAPact; } } foreach (string tech in FromUs.TechnologiesOffered) { TotalTrustRequiredFromUS = TotalTrustRequiredFromUS + ResourceManager.TechTree[tech].Cost / 50f; } float ValueFromUs = 0f; float ValueToUs = 0f; if (FromUs.OpenBorders) { ValueFromUs = ValueFromUs + 5f; } if (ToUs.OpenBorders) { ValueToUs = ValueToUs + 0.01f; } if (FromUs.NAPact) { ValueFromUs = ValueFromUs + 5f; } if (ToUs.NAPact) { ValueToUs = ValueToUs + 5f; } if (FromUs.TradeTreaty) { ValueFromUs = ValueFromUs + 5f; } if (ToUs.TradeTreaty) { ValueToUs = ValueToUs + 5f; if ((double)this.empire.EstimateIncomeAtTaxRate(0.5f) < 1) { ValueToUs = ValueToUs + 20f; } } foreach (string tech in FromUs.TechnologiesOffered) { ValueFromUs = ValueFromUs + (us.data.EconomicPersonality.Name == "Technologists" ? ResourceManager.TechTree[tech].Cost / 50f * 0.25f + ResourceManager.TechTree[tech].Cost / 50f : ResourceManager.TechTree[tech].Cost / 50f); } foreach (string artifactsOffered in FromUs.ArtifactsOffered) { ValueFromUs = ValueFromUs + 15f; } foreach (string str in ToUs.ArtifactsOffered) { ValueToUs = ValueToUs + 15f; } foreach (string tech in ToUs.TechnologiesOffered) { ValueToUs = ValueToUs + (us.data.EconomicPersonality.Name == "Technologists" ? ResourceManager.TechTree[tech].Cost / 50f * 0.25f + ResourceManager.TechTree[tech].Cost / 50f : ResourceManager.TechTree[tech].Cost / 50f); } if (us.GetPlanets().Count - FromUs.ColoniesOffered.Count + ToUs.ColoniesOffered.Count < 1) { us.GetRelations()[them].DamageRelationship(us, them, "Insulted", 25f, null); return "OfferResponse_Reject_Insulting"; } foreach (string planetName in FromUs.ColoniesOffered) { foreach (Planet p in us.GetPlanets()) { if (p.Name != planetName) { continue; } float value = p.Population / 1000f + p.FoodHere / 25f + p.ProductionHere / 25f + p.Fertility + p.MineralRichness + p.MaxPopulation / 1000f; foreach (Building b in p.BuildingList) { value = value + b.Cost / 25f; if (b.Name != "Capital City") { continue; } value = value + 100f; } float multiplier = 0f; foreach (Planet other in p.system.PlanetList) { if (other.Owner != p.Owner) { continue; } multiplier = multiplier + 1.25f; } value = value * multiplier; if (value < 15f) { value = 15f; } ValueFromUs = ValueFromUs + (us.data.EconomicPersonality.Name == "Expansionists" ? value + value : value + 0.5f * value); } } foreach (string planetName in ToUs.ColoniesOffered) { foreach (Planet p in them.GetPlanets()) { if (p.Name != planetName) { continue; } float value = p.Population / 1000f + p.FoodHere / 50f + p.ProductionHere / 50f + p.Fertility + p.MineralRichness + p.MaxPopulation / 2000f; foreach (Building b in p.BuildingList) { value = value + b.Cost / 50f; } int multiplier = 1; foreach (Planet other in p.system.PlanetList) { if (other.Owner != p.Owner) { continue; } multiplier++; } value = value * (float)multiplier; ValueToUs = ValueToUs + (us.data.EconomicPersonality.Name == "Expansionists" ? value * 0.5f + value : value); } } ValueToUs = ValueToUs + them.data.Traits.DiplomacyMod * ValueToUs; if (ValueFromUs == 0f && ValueToUs > 0f) { us.GetRelations()[them].ImproveRelations(ValueToUs, ValueToUs); this.AcceptOffer(ToUs, FromUs, us, them); return "OfferResponse_Accept_Gift"; } ValueToUs = ValueToUs - ValueToUs * us.GetRelations()[them].TotalAnger / 100f; float offerdifferential = ValueToUs / (ValueFromUs + 0.01f); string OfferQuality = ""; if (offerdifferential < 0.6f) { OfferQuality = "Insulting"; } else if (offerdifferential < 0.9f && offerdifferential >= 0.6f) { OfferQuality = "Poor"; } else if (offerdifferential >= 0.9f && offerdifferential < 1.1f) { OfferQuality = "Fair"; } else if ((double)offerdifferential >= 1.1 && (double)offerdifferential < 1.45) { OfferQuality = "Good"; } else if (offerdifferential >= 1.45f) { OfferQuality = "Great"; } if (ValueToUs == ValueFromUs) { OfferQuality = "Fair"; } switch (attitude) { case Offer.Attitude.Pleading: { if (TotalTrustRequiredFromUS > us.GetRelations()[them].Trust) { if (OfferQuality != "Great") { return "OfferResponse_InsufficientTrust"; } us.GetRelations()[them].ImproveRelations(ValueToUs - ValueFromUs, ValueToUs - ValueFromUs); this.AcceptOffer(ToUs, FromUs, us, them); return "OfferResponse_AcceptGreatOffer_LowTrust"; } if (offerdifferential < 0.6f) { OfferQuality = "Insulting"; } else if (offerdifferential < 0.8f && offerdifferential > 0.65f) { OfferQuality = "Poor"; } else if (offerdifferential >= 0.8f && offerdifferential < 1.1f) { OfferQuality = "Fair"; } else if ((double)offerdifferential >= 1.1 && (double)offerdifferential < 1.45) { OfferQuality = "Good"; } else if (offerdifferential >= 1.45f) { OfferQuality = "Great"; } if (OfferQuality == "Poor") { return "OfferResponse_Reject_PoorOffer_EnoughTrust"; } if (OfferQuality == "Insulting") { us.GetRelations()[them].DamageRelationship(us, them, "Insulted", ValueFromUs - ValueToUs, null); return "OfferResponse_Reject_Insulting"; } if (OfferQuality == "Fair") { us.GetRelations()[them].ImproveRelations(ValueToUs - ValueFromUs, ValueToUs - ValueFromUs); this.AcceptOffer(ToUs, FromUs, us, them); return "OfferResponse_Accept_Fair_Pleading"; } if (OfferQuality == "Good") { us.GetRelations()[them].ImproveRelations(ValueToUs - ValueFromUs, ValueToUs - ValueFromUs); this.AcceptOffer(ToUs, FromUs, us, them); return "OfferResponse_Accept_Good"; } if (OfferQuality != "Great") { break; } us.GetRelations()[them].ImproveRelations(ValueToUs - ValueFromUs, ValueToUs - ValueFromUs); this.AcceptOffer(ToUs, FromUs, us, them); return "OfferResponse_Accept_Great"; } case Offer.Attitude.Respectful: { if (TotalTrustRequiredFromUS + us.GetRelations()[them].TrustUsed <= us.GetRelations()[them].Trust) { if (OfferQuality == "Poor") { return "OfferResponse_Reject_PoorOffer_EnoughTrust"; } if (OfferQuality == "Insulting") { us.GetRelations()[them].DamageRelationship(us, them, "Insulted", ValueFromUs - ValueToUs, null); return "OfferResponse_Reject_Insulting"; } if (OfferQuality == "Fair") { us.GetRelations()[them].ImproveRelations(ValueToUs - ValueFromUs, ValueToUs - ValueFromUs); this.AcceptOffer(ToUs, FromUs, us, them); return "OfferResponse_Accept_Fair"; } if (OfferQuality == "Good") { us.GetRelations()[them].ImproveRelations(ValueToUs - ValueFromUs, ValueToUs - ValueFromUs); this.AcceptOffer(ToUs, FromUs, us, them); return "OfferResponse_Accept_Good"; } if (OfferQuality != "Great") { break; } us.GetRelations()[them].ImproveRelations(ValueToUs - ValueFromUs, ValueToUs - ValueFromUs); this.AcceptOffer(ToUs, FromUs, us, them); return "OfferResponse_Accept_Great"; } else { if (OfferQuality == "Great") { us.GetRelations()[them].ImproveRelations(ValueToUs - ValueFromUs, ValueToUs); this.AcceptOffer(ToUs, FromUs, us, them); return "OfferResponse_AcceptGreatOffer_LowTrust"; } if (OfferQuality == "Poor") { return "OfferResponse_Reject_PoorOffer_LowTrust"; } if (OfferQuality == "Fair" || OfferQuality == "Good") { return "OfferResponse_InsufficientTrust"; } if (OfferQuality != "Insulting") { break; } us.GetRelations()[them].DamageRelationship(us, them, "Insulted", ValueFromUs - ValueToUs, null); return "OfferResponse_Reject_Insulting"; } } case Offer.Attitude.Threaten: { if (dt.Name == "Ruthless") { return "OfferResponse_InsufficientFear"; } us.GetRelations()[them].DamageRelationship(us, them, "Insulted", ValueFromUs - ValueToUs, null); if (OfferQuality == "Great") { this.AcceptThreat(ToUs, FromUs, us, them); return "OfferResponse_AcceptGreatOffer_LowTrust"; } if (offerdifferential < 0.95f) { OfferQuality = "Poor"; } else if (offerdifferential >= 0.95f) { OfferQuality = "Fair"; } if (us.GetRelations()[them].Threat <= ValueFromUs || us.GetRelations()[them].FearUsed + ValueFromUs >= us.GetRelations()[them].Threat) { return "OfferResponse_InsufficientFear"; } if (OfferQuality == "Poor") { this.AcceptThreat(ToUs, FromUs, us, them); return "OfferResponse_Accept_Bad_Threatening"; } if (OfferQuality != "Fair") { break; } this.AcceptThreat(ToUs, FromUs, us, them); return "OfferResponse_Accept_Fair_Threatening"; } } return ""; }
private void DoXenophobicRelations() { foreach (KeyValuePair<Empire, Ship_Game.Gameplay.Relationship> Relationship in this.empire.GetRelations()) { if (!Relationship.Value.Known || Relationship.Key.isFaction || Relationship.Key.data.Defeated) { continue; } float usedTrust = 0f; foreach (TrustEntry te in Relationship.Value.TrustEntries) { usedTrust = usedTrust + te.TrustCost; } this.AssessDiplomaticAnger(Relationship); switch (Relationship.Value.Posture) { case Posture.Friendly: { if (Relationship.Value.TurnsKnown <= this.SecondDemand || Relationship.Value.Trust - usedTrust <= (float)this.empire.data.DiplomaticPersonality.Trade || Relationship.Value.Treaty_Trade || Relationship.Value.HaveRejected_TRADE || Relationship.Value.turnsSinceLastContact <= this.SecondDemand || Relationship.Value.HaveRejected_TRADE) { continue; } Offer NAPactOffer = new Offer() { TradeTreaty = true, AcceptDL = "Trade Accepted", RejectDL = "Trade Rejected" }; Ship_Game.Gameplay.Relationship value = Relationship.Value; NAPactOffer.ValueToModify = new Ref<bool>(() => value.HaveRejected_TRADE, (bool x) => value.HaveRejected_TRADE = x); Offer OurOffer = new Offer() { TradeTreaty = true }; if (Relationship.Key != EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) { Relationship.Key.GetGSAI().AnalyzeOffer(OurOffer, NAPactOffer, this.empire, Offer.Attitude.Respectful); continue; } else { this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "Offer Trade", new Offer(), NAPactOffer)); continue; } } case Posture.Neutral: { if (Relationship.Value.TurnsKnown >= this.FirstDemand && !Relationship.Value.Treaty_NAPact && !Relationship.Value.HaveRejected_Demand_Tech && !Relationship.Value.XenoDemandedTech) { List<string> PotentialDemands = new List<string>(); foreach (KeyValuePair<string, TechEntry> tech in Relationship.Key.GetTDict()) { //Added by McShooterz: prevent root nodes from being demanded, and secret but not discovered if (!tech.Value.Unlocked || this.empire.GetTDict()[tech.Key].Unlocked || tech.Value.GetTech().RootNode == 1 || (tech.Value.GetTech().Secret && !tech.Value.GetTech().Discovered)) { continue; } PotentialDemands.Add(tech.Key); } if (PotentialDemands.Count > 0) { int Random = (int)RandomMath.RandomBetween(0f, (float)PotentialDemands.Count + 0.75f); if (Random > PotentialDemands.Count - 1) { Random = PotentialDemands.Count - 1; } string TechToDemand = PotentialDemands[Random]; Offer DemandTech = new Offer(); DemandTech.TechnologiesOffered.Add(TechToDemand); Relationship.Value.XenoDemandedTech = true; Offer TheirDemand = new Offer() { AcceptDL = "Xeno Demand Tech Accepted", RejectDL = "Xeno Demand Tech Rejected" }; Ship_Game.Gameplay.Relationship relationship = Relationship.Value; TheirDemand.ValueToModify = new Ref<bool>(() => relationship.HaveRejected_Demand_Tech, (bool x) => relationship.HaveRejected_Demand_Tech = x); Relationship.Value.turnsSinceLastContact = 0; if (Relationship.Key != EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) { Relationship.Key.GetGSAI().AnalyzeOffer(DemandTech, TheirDemand, this.empire, Offer.Attitude.Threaten); } else { this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "Xeno Demand Tech", DemandTech, TheirDemand)); } } } if (!Relationship.Value.HaveRejected_Demand_Tech) { continue; } Relationship.Value.Posture = Posture.Hostile; continue; } default: { continue; } } } }
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); }
private void DoPacifistRelations() { foreach (KeyValuePair<Empire, Relationship> Relationship in this.empire.GetRelations()) { if (Relationship.Value.Known && !Relationship.Key.isFaction && !Relationship.Key.data.Defeated) { float usedTrust = 0.0f; foreach (TrustEntry trustEntry in (List<TrustEntry>)Relationship.Value.TrustEntries) usedTrust += trustEntry.TrustCost; switch (Relationship.Value.Posture) { case Posture.Friendly: if (Relationship.Value.TurnsKnown > this.SecondDemand && !Relationship.Value.Treaty_Trade && (!Relationship.Value.HaveRejected_TRADE && (double)Relationship.Value.Trust - (double)usedTrust > (double)this.empire.data.DiplomaticPersonality.Trade) && (!Relationship.Value.Treaty_Trade && Relationship.Value.turnsSinceLastContact > this.SecondDemand && !Relationship.Value.HaveRejected_TRADE)) { Offer offer1 = new Offer(); offer1.TradeTreaty = true; offer1.AcceptDL = "Trade Accepted"; offer1.RejectDL = "Trade Rejected"; Relationship r = Relationship.Value; offer1.ValueToModify = new Ref<bool>((Func<bool>)(() => r.HaveRejected_TRADE), (Action<bool>)(x => r.HaveRejected_TRADE = x)); Offer offer2 = new Offer(); offer2.TradeTreaty = true; if (Relationship.Key == EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) this.empire.GetUS().ScreenManager.AddScreen((GameScreen)new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "Offer Trade", offer2, offer1)); else Relationship.Key.GetGSAI().AnalyzeOffer(offer2, offer1, this.empire, Offer.Attitude.Respectful); } this.AssessAngerPacifist(Relationship, Posture.Friendly, usedTrust); if (Relationship.Value.TurnsAbove95 > 100 && Relationship.Value.turnsSinceLastContact > 10 && (!Relationship.Value.Treaty_Alliance && Relationship.Value.Treaty_Trade) && (Relationship.Value.Treaty_NAPact && !Relationship.Value.HaveRejected_Alliance && (double)Relationship.Value.TotalAnger < 20.0)) { Offer offer1 = new Offer(); offer1.Alliance = true; offer1.AcceptDL = "ALLIANCE_ACCEPTED"; offer1.RejectDL = "ALLIANCE_REJECTED"; Relationship r = Relationship.Value; offer1.ValueToModify = new Ref<bool>((Func<bool>)(() => r.HaveRejected_Alliance), (Action<bool>)(x => { r.HaveRejected_Alliance = x; this.SetAlliance(!r.HaveRejected_Alliance); })); Offer offer2 = new Offer(); if (Relationship.Key == EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) { this.empire.GetUS().ScreenManager.AddScreen((GameScreen)new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "OFFER_ALLIANCE", offer2, offer1)); continue; } else { Relationship.Key.GetGSAI().AnalyzeOffer(offer2, offer1, this.empire, Offer.Attitude.Respectful); continue; } } else continue; case Posture.Neutral: if (Relationship.Value.TurnsKnown == this.FirstDemand && !Relationship.Value.Treaty_NAPact) { Offer offer1 = new Offer(); offer1.NAPact = true; offer1.AcceptDL = "NAPact Accepted"; offer1.RejectDL = "NAPact Rejected"; Relationship r = Relationship.Value; offer1.ValueToModify = new Ref<bool>((Func<bool>)(() => r.HaveRejected_NAPACT), (Action<bool>)(x => r.HaveRejected_NAPACT = x)); Relationship.Value.turnsSinceLastContact = 0; Offer offer2 = new Offer(); offer2.NAPact = true; if (Relationship.Key == EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) this.empire.GetUS().ScreenManager.AddScreen((GameScreen)new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "Offer NAPact", offer2, offer1)); else Relationship.Key.GetGSAI().AnalyzeOffer(offer2, offer1, this.empire, Offer.Attitude.Respectful); } if (Relationship.Value.TurnsKnown > this.FirstDemand && Relationship.Value.Treaty_NAPact) Relationship.Value.Posture = Posture.Friendly; else if (Relationship.Value.TurnsKnown > this.FirstDemand && Relationship.Value.HaveRejected_NAPACT) Relationship.Value.Posture = Posture.Neutral; this.AssessAngerPacifist(Relationship, Posture.Neutral, usedTrust); if ((double)Relationship.Value.Trust > 50.0 && (double)Relationship.Value.TotalAnger < 10.0) { Relationship.Value.Posture = Posture.Friendly; continue; } else continue; case Posture.Hostile: if (Relationship.Value.ActiveWar != null) { List<Empire> list = new List<Empire>(); foreach (KeyValuePair<Empire, Relationship> keyValuePair in this.empire.GetRelations()) { if (keyValuePair.Value.Treaty_Alliance && keyValuePair.Key.GetRelations()[Relationship.Key].Known && !keyValuePair.Key.GetRelations()[Relationship.Key].AtWar) list.Add(keyValuePair.Key); } foreach (Empire Ally in list) { if (!Relationship.Value.ActiveWar.AlliesCalled.Contains(Ally.data.Traits.Name) && this.empire.GetRelations()[Ally].turnsSinceLastContact > 10) { this.CallAllyToWar(Ally, Relationship.Key); Relationship.Value.ActiveWar.AlliesCalled.Add(Ally.data.Traits.Name); } } if ((double)Relationship.Value.ActiveWar.TurnsAtWar % 100.0 == 0.0) { switch (Relationship.Value.ActiveWar.WarType) { case WarType.BorderConflict: if ((double)(Relationship.Value.Anger_FromShipsInOurBorders + Relationship.Value.Anger_TerritorialConflict) > (double)this.empire.data.DiplomaticPersonality.Territorialism) return; switch (Relationship.Value.ActiveWar.GetBorderConflictState()) { case WarState.WinningSlightly: this.OfferPeace(Relationship, "OFFERPEACE_FAIR"); continue; case WarState.Dominating: this.OfferPeace(Relationship, "OFFERPEACE_WINNINGBC"); continue; case WarState.LosingSlightly: case WarState.LosingBadly: this.OfferPeace(Relationship, "OFFERPEACE_LOSINGBC"); continue; default: continue; } case WarType.ImperialistWar: switch (Relationship.Value.ActiveWar.GetWarScoreState()) { case WarState.WinningSlightly: this.OfferPeace(Relationship, "OFFERPEACE_FAIR"); continue; case WarState.Dominating: this.OfferPeace(Relationship, "OFFERPEACE_FAIR_WINNING"); continue; case WarState.EvenlyMatched: this.OfferPeace(Relationship, "OFFERPEACE_EVENLY_MATCHED"); continue; case WarState.LosingSlightly: case WarState.LosingBadly: this.OfferPeace(Relationship, "OFFERPEACE_PLEADING"); continue; default: continue; } case WarType.DefensiveWar: switch (Relationship.Value.ActiveWar.GetBorderConflictState()) { case WarState.WinningSlightly: this.OfferPeace(Relationship, "OFFERPEACE_FAIR"); continue; case WarState.Dominating: this.OfferPeace(Relationship, "OFFERPEACE_FAIR_WINNING"); continue; case WarState.EvenlyMatched: this.OfferPeace(Relationship, "OFFERPEACE_EVENLY_MATCHED"); continue; case WarState.LosingSlightly: case WarState.LosingBadly: this.OfferPeace(Relationship, "OFFERPEACE_PLEADING"); continue; default: continue; } default: continue; } } else continue; } else continue; default: continue; } } } }
private void DoRuthlessRelations() { int numberofWars = 0; List<Empire> PotentialTargets = new List<Empire>(); foreach (KeyValuePair<Empire, Ship_Game.Gameplay.Relationship> Relationship in this.empire.GetRelations()) { if (!Relationship.Value.AtWar || Relationship.Key.data.Defeated) { continue; } numberofWars++; } //Label0: foreach (KeyValuePair<Empire, Ship_Game.Gameplay.Relationship> Relationship in this.empire.GetRelations()) { if (!Relationship.Value.Known || Relationship.Key.isFaction || Relationship.Key.data.Defeated) { continue; } if (Relationship.Key.data.DiplomaticPersonality != null && !Relationship.Value.HaveRejected_TRADE && !Relationship.Value.Treaty_Trade && !Relationship.Value.AtWar && (Relationship.Key.data.DiplomaticPersonality.Name != "Aggressive" || Relationship.Key.data.DiplomaticPersonality.Name != "Ruthless")) { Offer NAPactOffer = new Offer() { TradeTreaty = true, AcceptDL = "Trade Accepted", RejectDL = "Trade Rejected" }; Ship_Game.Gameplay.Relationship value = Relationship.Value; NAPactOffer.ValueToModify = new Ref<bool>(() => value.HaveRejected_TRADE, (bool x) => value.HaveRejected_TRADE = x); Offer OurOffer = new Offer() { TradeTreaty = true }; Relationship.Key.GetGSAI().AnalyzeOffer(OurOffer, NAPactOffer, this.empire, Offer.Attitude.Respectful); } float usedTrust = 0f; foreach (TrustEntry te in Relationship.Value.TrustEntries) { usedTrust = usedTrust + te.TrustCost; } this.AssessAngerAggressive(Relationship, Relationship.Value.Posture, usedTrust); Relationship.Value.Posture = Posture.Hostile; if (!Relationship.Value.Known || Relationship.Value.AtWar) { continue; } Relationship.Value.Posture = Posture.Hostile; if (Relationship.Key == EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty) && Relationship.Value.Threat <= -15f && !Relationship.Value.HaveInsulted_Military && Relationship.Value.TurnsKnown > this.FirstDemand) { Relationship.Value.HaveInsulted_Military = true; this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "Insult Military")); } if (Relationship.Value.Threat > 0f || Relationship.Value.TurnsKnown <= this.SecondDemand || Relationship.Value.Treaty_Alliance) { if (Relationship.Value.Threat > -45f || numberofWars != 0) { continue; } PotentialTargets.Add(Relationship.Key); } else { int i = 0; while (i < 5) { if (i >= this.DesiredPlanets.Count) { //goto Label0; //this tried to restart the loop it's in => bad mojo break; } if (this.DesiredPlanets[i].Owner != Relationship.Key) { i++; } else { PotentialTargets.Add(Relationship.Key); //goto Label0; break; } } } } if (PotentialTargets.Count > 0 && numberofWars <= 1) { IOrderedEnumerable<Empire> sortedList = from target in PotentialTargets orderby Vector2.Distance(this.empire.GetWeightedCenter(), target.GetWeightedCenter()) select target; bool foundwar = false; foreach (Empire e in PotentialTargets) { Empire ToAttack = e; if (this.empire.GetRelations()[e].Treaty_NAPact) { continue; } this.empire.GetRelations()[ToAttack].PreparingForWar = true; foundwar = true; } if (!foundwar) { Empire ToAttack = sortedList.First<Empire>(); this.empire.GetRelations()[ToAttack].PreparingForWar = true; } } }
private void AssessAngerPacifist(KeyValuePair<Empire, Ship_Game.Gameplay.Relationship> Relationship, Posture posture, float usedTrust) { if (posture != Posture.Friendly) { this.AssessDiplomaticAnger(Relationship); } else if (!Relationship.Value.Treaty_OpenBorders && (Relationship.Value.Treaty_Trade || Relationship.Value.Treaty_NAPact) && !Relationship.Value.HaveRejected_OpenBorders) { if (Relationship.Value.Trust >= 50f) { if (Relationship.Value.Trust - usedTrust > (float)(this.empire.data.DiplomaticPersonality.Territorialism / 2)) { Offer NAPactOffer = new Offer() { OpenBorders = true, AcceptDL = "Open Borders Accepted", RejectDL = "Open Borders Friends Rejected" }; Ship_Game.Gameplay.Relationship value = Relationship.Value; NAPactOffer.ValueToModify = new Ref<bool>(() => value.HaveRejected_OpenBorders, (bool x) => value.HaveRejected_OpenBorders = x); Offer OurOffer = new Offer() { OpenBorders = true }; if (Relationship.Key != EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) { Relationship.Key.GetGSAI().AnalyzeOffer(OurOffer, NAPactOffer, this.empire, Offer.Attitude.Pleading); return; } this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "Offer Open Borders Friends", OurOffer, NAPactOffer)); return; } } else if (Relationship.Value.Trust >= 20f && Relationship.Value.Anger_TerritorialConflict + Relationship.Value.Anger_FromShipsInOurBorders >= 0.75f * (float)this.empire.data.DiplomaticPersonality.Territorialism && Relationship.Value.Trust - usedTrust > (float)(this.empire.data.DiplomaticPersonality.Territorialism / 2)) { Offer NAPactOffer = new Offer() { OpenBorders = true, AcceptDL = "Open Borders Accepted", RejectDL = "Open Borders Rejected" }; Ship_Game.Gameplay.Relationship relationship = Relationship.Value; NAPactOffer.ValueToModify = new Ref<bool>(() => relationship.HaveRejected_OpenBorders, (bool x) => relationship.HaveRejected_OpenBorders = x); Offer OurOffer = new Offer() { OpenBorders = true }; if (Relationship.Key != EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) { Relationship.Key.GetGSAI().AnalyzeOffer(OurOffer, NAPactOffer, this.empire, Offer.Attitude.Pleading); return; } this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "Offer Open Borders", OurOffer, NAPactOffer)); return; } } else if (Relationship.Value.turnsSinceLastContact >= 10) { if (Relationship.Value.Known && Relationship.Key == EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) { Ship_Game.Gameplay.Relationship r = Relationship.Value; if (r.Anger_FromShipsInOurBorders > (float)(this.empire.data.DiplomaticPersonality.Territorialism / 4) && !r.AtWar && !r.WarnedAboutShips && r.turnsSinceLastContact > 10) { if (!r.WarnedAboutColonizing) { this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, Relationship.Key, "Warning Ships")); } else { this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, Relationship.Key, "Warning Colonized then Ships", r.GetContestedSystem())); } r.WarnedAboutShips = true; return; } } } else if (Relationship.Value.HaveRejected_OpenBorders || Relationship.Value.TotalAnger > 50f && Relationship.Value.Trust < Relationship.Value.TotalAnger) { Relationship.Value.Posture = Posture.Neutral; return; } }
private void DoAggressiveRelations() { int numberofWars = 0; List<Empire> PotentialTargets = new List<Empire>(); foreach (KeyValuePair<Empire, Ship_Game.Gameplay.Relationship> Relationship in this.empire.GetRelations()) { if (Relationship.Key.data.Defeated || !Relationship.Value.AtWar && !Relationship.Value.PreparingForWar) { continue; } numberofWars++; } foreach (KeyValuePair<Empire, Ship_Game.Gameplay.Relationship> Relationship in this.empire.GetRelations()) { if (!Relationship.Value.Known || Relationship.Value.AtWar || Relationship.Key.isFaction || Relationship.Key.data.Defeated) { continue; } if (Relationship.Key.data.DiplomaticPersonality != null && !Relationship.Value.HaveRejected_TRADE && !Relationship.Value.Treaty_Trade && !Relationship.Value.AtWar && (Relationship.Key.data.DiplomaticPersonality.Name != "Aggressive" || Relationship.Key.data.DiplomaticPersonality.Name != "Ruthless")) { Offer NAPactOffer = new Offer() { TradeTreaty = true, AcceptDL = "Trade Accepted", RejectDL = "Trade Rejected" }; Ship_Game.Gameplay.Relationship value = Relationship.Value; NAPactOffer.ValueToModify = new Ref<bool>(() => value.HaveRejected_TRADE, (bool x) => value.HaveRejected_TRADE = x); Offer OurOffer = new Offer() { TradeTreaty = true }; Relationship.Key.GetGSAI().AnalyzeOffer(OurOffer, NAPactOffer, this.empire, Offer.Attitude.Respectful); } float usedTrust = 0f; foreach (TrustEntry te in Relationship.Value.TrustEntries) { usedTrust = usedTrust + te.TrustCost; } Relationship.Value.Posture = Posture.Neutral; if (Relationship.Value.Threat <= -25f) { if (!Relationship.Value.HaveInsulted_Military && Relationship.Value.TurnsKnown > this.FirstDemand) { Relationship.Value.HaveInsulted_Military = true; if (Relationship.Key == EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) { this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "Insult Military")); } } Relationship.Value.Posture = Posture.Hostile; } else if (Relationship.Value.Threat > 25f && Relationship.Value.TurnsKnown > this.FirstDemand) { if (!Relationship.Value.HaveComplimented_Military && Relationship.Value.HaveInsulted_Military && Relationship.Value.TurnsKnown > this.FirstDemand && Relationship.Key == EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) { Relationship.Value.HaveComplimented_Military = true; if (!Relationship.Value.HaveInsulted_Military || Relationship.Value.TurnsKnown <= this.SecondDemand) { this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "Compliment Military")); } else { this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "Compliment Military Better")); } } Relationship.Value.Posture = Posture.Friendly; } switch (Relationship.Value.Posture) { case Posture.Friendly: { if (Relationship.Value.TurnsKnown > this.SecondDemand && Relationship.Value.Trust - usedTrust > (float)this.empire.data.DiplomaticPersonality.Trade && !Relationship.Value.HaveRejected_TRADE && !Relationship.Value.Treaty_Trade) { Offer NAPactOffer = new Offer() { TradeTreaty = true, AcceptDL = "Trade Accepted", RejectDL = "Trade Rejected" }; Ship_Game.Gameplay.Relationship relationship = Relationship.Value; NAPactOffer.ValueToModify = new Ref<bool>(() => relationship.HaveRejected_TRADE, (bool x) => relationship.HaveRejected_TRADE = x); Offer OurOffer = new Offer() { TradeTreaty = true }; if (Relationship.Key != EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) { Relationship.Key.GetGSAI().AnalyzeOffer(OurOffer, NAPactOffer, this.empire, Offer.Attitude.Respectful); } else { this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "Offer Trade", OurOffer, NAPactOffer)); } } this.AssessAngerAggressive(Relationship, Relationship.Value.Posture, usedTrust); if (Relationship.Value.TurnsAbove95 <= 100 || Relationship.Value.turnsSinceLastContact <= 10 || Relationship.Value.Treaty_Alliance || !Relationship.Value.Treaty_Trade || !Relationship.Value.Treaty_NAPact || Relationship.Value.HaveRejected_Alliance || Relationship.Value.TotalAnger >= 20f) { continue; } Offer OfferAlliance = new Offer() { Alliance = true, AcceptDL = "ALLIANCE_ACCEPTED", RejectDL = "ALLIANCE_REJECTED" }; Ship_Game.Gameplay.Relationship value1 = Relationship.Value; OfferAlliance.ValueToModify = new Ref<bool>(() => value1.HaveRejected_Alliance, (bool x) => { value1.HaveRejected_Alliance = x; this.SetAlliance(!value1.HaveRejected_Alliance); }); Offer OurOffer0 = new Offer(); if (Relationship.Key != EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) { Relationship.Key.GetGSAI().AnalyzeOffer(OurOffer0, OfferAlliance, this.empire, Offer.Attitude.Respectful); continue; } else { this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), "OFFER_ALLIANCE", OurOffer0, OfferAlliance)); continue; } } case Posture.Neutral: { this.AssessAngerAggressive(Relationship, Relationship.Value.Posture, usedTrust); continue; } case Posture.Hostile: { if (Relationship.Value.Threat < -15f && Relationship.Value.TurnsKnown > this.SecondDemand && !Relationship.Value.Treaty_Alliance) { if (Relationship.Value.TotalAnger < 75f) { int i = 0; while (i < 5) { if (i >= this.DesiredPlanets.Count) { break; } if (this.DesiredPlanets[i].Owner != Relationship.Key) { i++; } else { PotentialTargets.Add(Relationship.Key); break; } } } else { PotentialTargets.Add(Relationship.Key); } } else if (Relationship.Value.Threat <= -45f && Relationship.Value.TotalAnger > 20f) { PotentialTargets.Add(Relationship.Key); } //Label0: this.AssessAngerAggressive(Relationship, Relationship.Value.Posture, usedTrust); continue; } default: { continue; //this doesn't actually do anything, since it's at the end of the loop anyways } } } if (PotentialTargets.Count > 0 && numberofWars <= 1) { Empire ToAttack = PotentialTargets.First<Empire>(); this.empire.GetRelations()[ToAttack].PreparingForWar = true; } }
public void CallAllyToWar(Empire Ally, Empire Enemy) { Offer offer = new Offer() { AcceptDL = "HelpUS_War_Yes", RejectDL = "HelpUS_War_No" }; string dialogue = "HelpUS_War"; Offer OurOffer = new Offer() { ValueToModify = new Ref<bool>(() => Ally.GetRelations()[Enemy].AtWar, (bool x) => { if (x) { Ally.GetGSAI().DeclareWarOnViaCall(Enemy, WarType.ImperialistWar); return; } float Amount = 30f; if (this.empire.data.DiplomaticPersonality != null && this.empire.data.DiplomaticPersonality.Name == "Honorable") { Amount = 60f; offer.RejectDL = "HelpUS_War_No_BreakAlliance"; this.empire.GetRelations()[Ally].Treaty_Alliance = false; Ally.GetRelations()[this.empire].Treaty_Alliance = false; this.empire.GetRelations()[Ally].Treaty_OpenBorders = false; this.empire.GetRelations()[Ally].Treaty_NAPact = false; } Relationship item = this.empire.GetRelations()[Ally]; item.Trust = item.Trust - Amount; Relationship angerDiplomaticConflict = this.empire.GetRelations()[Ally]; angerDiplomaticConflict.Anger_DiplomaticConflict = angerDiplomaticConflict.Anger_DiplomaticConflict + Amount; }) }; if (Ally == EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) { this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), dialogue, OurOffer, offer, Enemy)); } }
public void OfferPeace(KeyValuePair<Empire, Ship_Game.Gameplay.Relationship> Relationship, string whichPeace) { Offer OfferPeace = new Offer() { PeaceTreaty = true, AcceptDL = "OFFERPEACE_ACCEPTED", RejectDL = "OFFERPEACE_REJECTED" }; Ship_Game.Gameplay.Relationship value = Relationship.Value; OfferPeace.ValueToModify = new Ref<bool>(() => false, (bool x) => value.SetImperialistWar()); string dialogue = whichPeace; Offer OurOffer = new Offer() { PeaceTreaty = true }; if (Relationship.Key != EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty)) { Relationship.Key.GetGSAI().AnalyzeOffer(OurOffer, OfferPeace, this.empire, Offer.Attitude.Respectful); return; } this.empire.GetUS().ScreenManager.AddScreen(new DiplomacyScreen(this.empire, EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty), dialogue, new Offer(), OfferPeace)); }
public override void HandleInput(InputState input) { if (HelperFunctions.CheckIntersection(new Rectangle(this.TrustRect.X - (int)Fonts.Pirulen16.MeasureString("Trust").X, this.TrustRect.Y, (int)Fonts.Pirulen16.MeasureString("Trust").X + this.TrustRect.Width, 14), input.CursorPosition)) ToolTip.CreateTooltip(47, this.ScreenManager); if (HelperFunctions.CheckIntersection(new Rectangle(this.AngerRect.X - (int)Fonts.Pirulen16.MeasureString("Anger").X, this.AngerRect.Y, (int)Fonts.Pirulen16.MeasureString("Anger").X + this.AngerRect.Width, 14), input.CursorPosition)) ToolTip.CreateTooltip(48, this.ScreenManager); if (HelperFunctions.CheckIntersection(new Rectangle(this.FearRect.X - (int)Fonts.Pirulen16.MeasureString("Fear").X, this.FearRect.Y, (int)Fonts.Pirulen16.MeasureString("Fear").X + this.FearRect.Width, 14), input.CursorPosition)) ToolTip.CreateTooltip(49, this.ScreenManager); if (this.Exit.HandleInput(input) && this.dState != DiplomacyScreen.DialogState.TheirOffer) { this.ExitScreen(); return; } if (this.dState == DiplomacyScreen.DialogState.End) return; if (this.dState != DiplomacyScreen.DialogState.TheirOffer) { if (!this.playerEmpire.GetRelations()[this.them].Treaty_Peace) { if (this.DeclareWar != null && this.DeclareWar.HandleInput(input)) { this.StatementsSL.Reset(); this.dState = DiplomacyScreen.DialogState.End; if (this.playerEmpire.GetRelations()[this.them].Treaty_NAPact) { this.TheirText = this.GetDialogueByName("WarDeclared_FeelsBetrayed"); this.playerEmpire.GetGSAI().DeclareWarOn(this.them, WarType.ImperialistWar); this.them.GetGSAI().GetWarDeclaredOnUs(this.playerEmpire, WarType.ImperialistWar); } else { this.TheirText = this.GetDialogueByName("WarDeclared_Generic"); this.playerEmpire.GetGSAI().DeclareWarOn(this.them, WarType.ImperialistWar); this.them.GetGSAI().GetWarDeclaredOnUs(this.playerEmpire, WarType.ImperialistWar); } this.playerEmpire.GetGSAI().DeclareWarOn(this.them, WarType.ImperialistWar); } } else if (this.DeclareWar != null && HelperFunctions.CheckIntersection(this.DeclareWar.R, input.CursorPosition)) ToolTip.CreateTooltip(128, this.ScreenManager); if (this.Discuss != null && this.Discuss.HandleInput(input)) { this.StatementsSL.Entries.Clear(); this.StatementsSL.indexAtTop = 0; this.dState = DiplomacyScreen.DialogState.Discuss; foreach (StatementSet statementSet in ResourceManager.DDDict["SharedDiplomacy"].StatementSets) { if (statementSet.Name == "Ordinary Discussion") { int n = 1; Vector2 Cursor = this.TextCursor; foreach (DialogOption dialogOption1 in statementSet.DialogOptions) { string str = dialogOption1.words; if (!string.IsNullOrEmpty(dialogOption1.SpecialInquiry)) str = this.GetDialogueByName(dialogOption1.SpecialInquiry); DialogOption dialogOption2 = new DialogOption(n, str, Cursor, Fonts.Consolas18); dialogOption2.words = this.parseText(str, (float)(this.DialogRect.Width - 20), Fonts.Consolas18); this.StatementsSL.AddItem((object)dialogOption2); dialogOption2.Response = dialogOption1.Response; Cursor.Y += (float)(Fonts.Consolas18.LineSpacing + 5); ++n; } } } } if (this.dState == DiplomacyScreen.DialogState.Discuss) { this.StatementsSL.HandleInput(input); foreach (ScrollList.Entry entry in (List<ScrollList.Entry>)this.StatementsSL.Entries) { if ((entry.item as DialogOption).HandleInput(input) != null) { this.Respond(entry.item as DialogOption); break; } } } if (this.dState == DiplomacyScreen.DialogState.Negotiate) { if ((!this.TheirOffer.IsBlank() || !this.OurOffer.IsBlank() || this.TheirOffer.Alliance) && this.SendOffer.HandleInput(input)) { this.DoNegotiationResponse(this.them.GetGSAI().AnalyzeOffer(this.OurOffer, this.TheirOffer, this.playerEmpire, this.Attitude)); this.OurOffer = new Offer(); this.TheirOffer = new Offer(); this.TheirOffer.Them = this.them; } this.OfferTextSL.HandleInput(input); this.OurItemsSL.HandleInput(input); //string str = (string)null; foreach (ScrollList.Entry e in (List<ScrollList.Entry>)this.OurItemsSL.Copied) { switch ((e.item as ItemToOffer).HandleInput(input, e)) { case "NAPact": this.OurOffer.NAPact = !this.OurOffer.NAPact; this.TheirOffer.NAPact = this.OurOffer.NAPact; using (List<ScrollList.Entry>.Enumerator enumerator = this.TheirItemsSL.Copied.GetEnumerator()) { while (enumerator.MoveNext()) { ScrollList.Entry current = enumerator.Current; if ((current.item as ItemToOffer).Response == "NAPact") (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected; } continue; } case "We Declare War": this.OurOffer.NAPact = !this.OurOffer.NAPact; this.TheirOffer.NAPact = this.OurOffer.NAPact; using (List<ScrollList.Entry>.Enumerator enumerator = this.TheirItemsSL.Copied.GetEnumerator()) { while (enumerator.MoveNext()) { ScrollList.Entry current = enumerator.Current; if ((current.item as ItemToOffer).Response == "NAPact") (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected; } continue; } case "Peace Treaty": this.OurOffer.PeaceTreaty = !this.OurOffer.PeaceTreaty; this.TheirOffer.PeaceTreaty = this.OurOffer.PeaceTreaty; using (List<ScrollList.Entry>.Enumerator enumerator = this.TheirItemsSL.Copied.GetEnumerator()) { while (enumerator.MoveNext()) { ScrollList.Entry current = enumerator.Current; if ((current.item as ItemToOffer).Response == "Peace Treaty") (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected; } continue; } case "OfferAlliance": this.OurOffer.Alliance = !this.OurOffer.Alliance; this.TheirOffer.Alliance = this.OurOffer.Alliance; using (List<ScrollList.Entry>.Enumerator enumerator = this.TheirItemsSL.Copied.GetEnumerator()) { while (enumerator.MoveNext()) { ScrollList.Entry current = enumerator.Current; if ((current.item as ItemToOffer).Response == "OfferAlliance") (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected; } continue; } case "OpenBorders": this.OurOffer.OpenBorders = !this.OurOffer.OpenBorders; continue; case "Tech": if ((e.item as ItemToOffer).Selected) { this.OurOffer.TechnologiesOffered.Add((e.item as ItemToOffer).SpecialInquiry); continue; } else { this.OurOffer.TechnologiesOffered.Remove((e.item as ItemToOffer).SpecialInquiry); continue; } case "Artifacts": if ((e.item as ItemToOffer).Selected) { this.OurOffer.ArtifactsOffered.Add((e.item as ItemToOffer).SpecialInquiry); continue; } else { this.OurOffer.ArtifactsOffered.Remove((e.item as ItemToOffer).SpecialInquiry); continue; } case "Colony": if ((e.item as ItemToOffer).Selected) { this.OurOffer.ColoniesOffered.Add((e.item as ItemToOffer).SpecialInquiry); continue; } else { this.OurOffer.ColoniesOffered.Remove((e.item as ItemToOffer).SpecialInquiry); continue; } case "TradeTreaty": this.OurOffer.TradeTreaty = !this.OurOffer.TradeTreaty; this.TheirOffer.TradeTreaty = this.OurOffer.TradeTreaty; using (List<ScrollList.Entry>.Enumerator enumerator = this.TheirItemsSL.Copied.GetEnumerator()) { while (enumerator.MoveNext()) { ScrollList.Entry current = enumerator.Current; if ((current.item as ItemToOffer).Response == "TradeTreaty") (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected; } continue; } default: continue; } } this.OurItemsSL.Update(); this.TheirItemsSL.HandleInput(input); //str = (string)null; foreach (ScrollList.Entry e in (List<ScrollList.Entry>)this.TheirItemsSL.Copied) { switch ((e.item as ItemToOffer).HandleInput(input, e)) { case "NAPact": this.TheirOffer.NAPact = !this.TheirOffer.NAPact; this.OurOffer.NAPact = this.TheirOffer.NAPact; using (List<ScrollList.Entry>.Enumerator enumerator = this.OurItemsSL.Copied.GetEnumerator()) { while (enumerator.MoveNext()) { ScrollList.Entry current = enumerator.Current; if ((current.item as ItemToOffer).Response == "NAPact") (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected; } continue; } case "Declare War": if ((e.item as ItemToOffer).Selected) { this.TheirOffer.EmpiresToWarOn.Add((e.item as ItemToOffer).SpecialInquiry); continue; } else { this.TheirOffer.EmpiresToWarOn.Remove((e.item as ItemToOffer).SpecialInquiry); continue; } case "Peace Treaty": this.TheirOffer.PeaceTreaty = !this.TheirOffer.PeaceTreaty; this.OurOffer.PeaceTreaty = this.TheirOffer.PeaceTreaty; using (List<ScrollList.Entry>.Enumerator enumerator = this.OurItemsSL.Copied.GetEnumerator()) { while (enumerator.MoveNext()) { ScrollList.Entry current = enumerator.Current; if ((current.item as ItemToOffer).Response == "Peace Treaty") (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected; } continue; } case "OfferAlliance": this.TheirOffer.Alliance = !this.TheirOffer.Alliance; this.OurOffer.Alliance = this.TheirOffer.Alliance; using (List<ScrollList.Entry>.Enumerator enumerator = this.OurItemsSL.Copied.GetEnumerator()) { while (enumerator.MoveNext()) { ScrollList.Entry current = enumerator.Current; if ((current.item as ItemToOffer).Response == "OfferAlliance") (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected; } continue; } case "Colony": if ((e.item as ItemToOffer).Selected) { this.TheirOffer.ColoniesOffered.Add((e.item as ItemToOffer).SpecialInquiry); continue; } else { this.TheirOffer.ColoniesOffered.Remove((e.item as ItemToOffer).SpecialInquiry); continue; } case "Tech": if ((e.item as ItemToOffer).Selected) { this.TheirOffer.TechnologiesOffered.Add((e.item as ItemToOffer).SpecialInquiry); continue; } else { this.TheirOffer.TechnologiesOffered.Remove((e.item as ItemToOffer).SpecialInquiry); continue; } case "Artifacts": if ((e.item as ItemToOffer).Selected) { this.TheirOffer.ArtifactsOffered.Add((e.item as ItemToOffer).SpecialInquiry); continue; } else { this.TheirOffer.ArtifactsOffered.Remove((e.item as ItemToOffer).SpecialInquiry); continue; } case "OpenBorders": this.TheirOffer.OpenBorders = !this.TheirOffer.OpenBorders; continue; case "TradeTreaty": this.TheirOffer.TradeTreaty = !this.TheirOffer.TradeTreaty; this.OurOffer.TradeTreaty = this.TheirOffer.TradeTreaty; using (List<ScrollList.Entry>.Enumerator enumerator = this.OurItemsSL.Copied.GetEnumerator()) { while (enumerator.MoveNext()) { ScrollList.Entry current = enumerator.Current; if ((current.item as ItemToOffer).Response == "TradeTreaty") (current.item as ItemToOffer).Selected = (e.item as ItemToOffer).Selected; } continue; } default: continue; } } this.TheirItemsSL.Update(); if (this.ap.HandleInput(input)) { this.ap.ToggleOn = true; this.ar.ToggleOn = false; this.at.ToggleOn = false; this.Attitude = Offer.Attitude.Pleading; } if (this.ar.HandleInput(input)) { this.ar.ToggleOn = true; this.ap.ToggleOn = false; this.at.ToggleOn = false; this.Attitude = Offer.Attitude.Respectful; } if (this.at.HandleInput(input)) { this.at.ToggleOn = true; this.ap.ToggleOn = false; this.ar.ToggleOn = false; this.Attitude = Offer.Attitude.Threaten; } } if (this.Negotiate.HandleInput(input)) { this.dState = DiplomacyScreen.DialogState.Negotiate; this.OurOffer = new Offer(); this.TheirOffer = new Offer(); this.TheirOffer.Them = this.them; this.FillOurItems(); this.FillTheirItems(); } } if (this.dState == DiplomacyScreen.DialogState.TheirOffer) { if (this.Accept.HandleInput(input)) { if (this.TheirOffer.ValueToModify != null) this.TheirOffer.ValueToModify.Value = false; if (this.OurOffer.ValueToModify != null) this.OurOffer.ValueToModify.Value = true; this.dState = DiplomacyScreen.DialogState.End; this.TheirText = this.GetDialogueByName(this.TheirOffer.AcceptDL); this.playerEmpire.GetGSAI().AcceptOffer(this.TheirOffer, this.OurOffer, this.playerEmpire, this.them); } if (this.Reject.HandleInput(input)) { if (this.TheirOffer.ValueToModify != null) this.TheirOffer.ValueToModify.Value = true; if (this.OurOffer.ValueToModify != null) this.OurOffer.ValueToModify.Value = false; this.dState = DiplomacyScreen.DialogState.End; this.TheirText = this.GetDialogueByName(this.TheirOffer.RejectDL); } } if (input.Escaped) this.ExitScreen(); base.HandleInput(input); }
public GSAI.PeaceAnswer AnalyzePeaceOffer(Offer ToUs, Offer FromUs, Empire them, Offer.Attitude attitude) { WarState state; Empire us = this.empire; DTrait dt = us.data.DiplomaticPersonality; float ValueToUs = 0f; float ValueFromUs = 0f; foreach (string tech in FromUs.TechnologiesOffered) { ValueFromUs = ValueFromUs + (us.data.EconomicPersonality.Name == "Technologists" ? ResourceManager.TechTree[tech].Cost / 100f * 0.25f + ResourceManager.TechTree[tech].Cost / 100f : ResourceManager.TechTree[tech].Cost / 100f); } foreach (string artifactsOffered in FromUs.ArtifactsOffered) { ValueFromUs = ValueFromUs + 15f; } foreach (string str in ToUs.ArtifactsOffered) { ValueToUs = ValueToUs + 15f; } foreach (string tech in ToUs.TechnologiesOffered) { ValueToUs = ValueToUs + (us.data.EconomicPersonality.Name == "Technologists" ? ResourceManager.TechTree[tech].Cost / 100f * 0.25f + ResourceManager.TechTree[tech].Cost / 100f : ResourceManager.TechTree[tech].Cost / 100f); } foreach (string planetName in FromUs.ColoniesOffered) { foreach (Planet p in us.GetPlanets()) { if (p.Name != planetName) { continue; } 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; } ValueFromUs = ValueFromUs + (us.data.EconomicPersonality.Name == "Expansionists" ? value + value : value + 0.5f * value); } } List<Planet> PlanetsToUs = new List<Planet>(); foreach (string planetName in ToUs.ColoniesOffered) { foreach (Planet p in them.GetPlanets()) { if (p.Name != planetName) { continue; } PlanetsToUs.Add(p); 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; if (b.NameTranslationIndex != 409) { continue; } value = value + 1000000f; } ValueToUs = ValueToUs + (us.data.EconomicPersonality.Name == "Expansionists" ? value * 0.5f + value : value); } } string name = dt.Name; string str1 = name; if (name != null) { if (str1 == "Pacifist") { switch (us.GetRelations()[them].ActiveWar.WarType) { case WarType.BorderConflict: { switch (us.GetRelations()[them].ActiveWar.GetBorderConflictState(PlanetsToUs)) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 10f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 5f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 5f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 10f; break; } } break; } case WarType.ImperialistWar: { switch (us.GetRelations()[them].ActiveWar.GetWarScoreState()) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 10f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 5f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 5f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 10f; break; } } break; } case WarType.DefensiveWar: { switch (us.GetRelations()[them].ActiveWar.GetWarScoreState()) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 10f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 5f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 5f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 10f; break; } } break; } } } else if (str1 == "Honorable") { switch (us.GetRelations()[them].ActiveWar.WarType) { case WarType.BorderConflict: { switch (us.GetRelations()[them].ActiveWar.GetBorderConflictState(PlanetsToUs)) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 15f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 8f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 8f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 15f; break; } } break; } case WarType.ImperialistWar: { switch (us.GetRelations()[them].ActiveWar.GetWarScoreState()) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 15f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 8f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 8f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 15f; break; } } break; } case WarType.DefensiveWar: { switch (us.GetRelations()[them].ActiveWar.GetWarScoreState()) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 10f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 5f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 5f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 10f; break; } } break; } } } else if (str1 == "Cunning") { switch (us.GetRelations()[them].ActiveWar.WarType) { case WarType.BorderConflict: { switch (us.GetRelations()[them].ActiveWar.GetBorderConflictState(PlanetsToUs)) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 10f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 5f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 5f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 10f; break; } } break; } case WarType.ImperialistWar: { switch (us.GetRelations()[them].ActiveWar.GetWarScoreState()) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 10f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 5f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 5f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 10f; break; } } break; } case WarType.DefensiveWar: { switch (us.GetRelations()[them].ActiveWar.GetWarScoreState()) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 10f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 5f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 5f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 10f; break; } } break; } } } else if (str1 == "Xenophobic") { switch (us.GetRelations()[them].ActiveWar.WarType) { case WarType.BorderConflict: { switch (us.GetRelations()[them].ActiveWar.GetBorderConflictState(PlanetsToUs)) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 15f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 8f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 8f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 15f; break; } } break; } case WarType.ImperialistWar: { switch (us.GetRelations()[them].ActiveWar.GetWarScoreState()) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 15f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 8f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 8f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 15f; break; } } break; } case WarType.DefensiveWar: { switch (us.GetRelations()[them].ActiveWar.GetWarScoreState()) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 10f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 5f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 5f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 10f; break; } } break; } } } else if (str1 == "Aggressive") { switch (us.GetRelations()[them].ActiveWar.WarType) { case WarType.BorderConflict: { switch (us.GetRelations()[them].ActiveWar.GetBorderConflictState(PlanetsToUs)) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 10f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 5f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 75f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 200f; break; } } break; } case WarType.ImperialistWar: { switch (us.GetRelations()[them].ActiveWar.GetWarScoreState()) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 10f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 5f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 75f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 200f; break; } } break; } case WarType.DefensiveWar: { switch (us.GetRelations()[them].ActiveWar.GetWarScoreState()) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 10f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 5f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 75f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 200f; break; } } break; } } } else if (str1 == "Ruthless") { switch (us.GetRelations()[them].ActiveWar.WarType) { case WarType.BorderConflict: { switch (us.GetRelations()[them].ActiveWar.GetBorderConflictState(PlanetsToUs)) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 5f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 1f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 120f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 300f; break; } } break; } case WarType.ImperialistWar: { switch (us.GetRelations()[them].ActiveWar.GetWarScoreState()) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 5f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 1f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 120f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 300f; break; } } break; } case WarType.DefensiveWar: { switch (us.GetRelations()[them].ActiveWar.GetWarScoreState()) { case WarState.LosingBadly: { ValueToUs = ValueToUs + 5f; break; } case WarState.LosingSlightly: { ValueToUs = ValueToUs + 1f; break; } case WarState.WinningSlightly: { ValueFromUs = ValueFromUs + 120f; break; } case WarState.Dominating: { ValueFromUs = ValueFromUs + 300f; break; } } break; } } } } ValueToUs = ValueToUs + them.data.Traits.DiplomacyMod * ValueToUs; float offerdifferential = ValueToUs / (ValueFromUs + 0.0001f); string OfferQuality = ""; if (offerdifferential < 0.6f) { OfferQuality = "Insulting"; } else if (offerdifferential < 0.9f && offerdifferential > 0.65f) { OfferQuality = "Poor"; } else if (offerdifferential >= 0.9f && offerdifferential < 1.1f) { OfferQuality = "Fair"; } else if ((double)offerdifferential >= 1.1 && (double)offerdifferential < 1.45) { OfferQuality = "Good"; } else if (offerdifferential >= 1.45f) { OfferQuality = "Great"; } if (ValueToUs == ValueFromUs && ValueToUs > 0f) { OfferQuality = "Fair"; } GSAI.PeaceAnswer response = new GSAI.PeaceAnswer() { peace = false, answer = "REJECT_OFFER_PEACE_POOROFFER" }; switch (us.GetRelations()[them].ActiveWar.WarType) { case WarType.BorderConflict: { state = us.GetRelations()[them].ActiveWar.GetBorderConflictState(PlanetsToUs); if (state == WarState.WinningSlightly) { if (OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else if ((OfferQuality == "Fair" || OfferQuality == "Good") && us.GetRelations()[them].ActiveWar.StartingNumContestedSystems > 0) { response.answer = "REJECT_OFFER_PEACE_UNWILLING_BC"; return response; } else if (OfferQuality == "Fair" || OfferQuality == "Good") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } else if (state == WarState.Dominating) { if (OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } else if (state == WarState.ColdWar) { if (OfferQuality != "Great") { response.answer = "REJECT_OFFER_PEACE_UNWILLING_BC"; return response; } else { response.answer = "ACCEPT_PEACE_COLDWAR"; response.peace = true; return response; } } else if (state != WarState.EvenlyMatched) { if (state != WarState.LosingSlightly) { if (state != WarState.LosingBadly) { return response; } if (OfferQuality == "Fair" || OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else if (OfferQuality != "Poor") { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } else { response.answer = "ACCEPT_OFFER_PEACE_RELUCTANT"; response.peace = true; return response; } } else if (OfferQuality == "Fair" || OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } else if (OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else if ((OfferQuality == "Fair" || OfferQuality == "Good") && us.GetRelations()[them].ActiveWar.StartingNumContestedSystems > 0) { response.answer = "REJECT_OFFER_PEACE_UNWILLING_BC"; return response; } else if (OfferQuality == "Fair" || OfferQuality == "Good") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } case WarType.ImperialistWar: { state = us.GetRelations()[them].ActiveWar.GetWarScoreState(); if (state == WarState.WinningSlightly) { if (OfferQuality == "Fair" || OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } else if (state == WarState.Dominating) { if (OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } else if (state == WarState.EvenlyMatched) { if (OfferQuality == "Fair" || OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } else if (state == WarState.ColdWar) { string name1 = this.empire.data.DiplomaticPersonality.Name; str1 = name1; if (name1 != null && str1 == "Pacifist") { if (OfferQuality == "Fair" || OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } else if (OfferQuality != "Great") { response.answer = "REJECT_PEACE_RUTHLESS"; return response; } else { response.answer = "ACCEPT_PEACE_COLDWAR"; response.peace = true; return response; } } else if (state != WarState.LosingSlightly) { if (state != WarState.LosingBadly) { return response; } if (OfferQuality == "Fair" || OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else if (OfferQuality != "Poor") { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } else { response.answer = "ACCEPT_OFFER_PEACE_RELUCTANT"; response.peace = true; return response; } } else if (OfferQuality == "Fair" || OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } case WarType.GenocidalWar: { return response; } case WarType.DefensiveWar: { state = us.GetRelations()[them].ActiveWar.GetWarScoreState(); if (state == WarState.WinningSlightly) { if (OfferQuality == "Fair" || OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } else if (state == WarState.Dominating) { if (OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } else if (state == WarState.EvenlyMatched) { if (OfferQuality == "Fair" || OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } else if (state == WarState.ColdWar) { string name2 = this.empire.data.DiplomaticPersonality.Name; str1 = name2; if (name2 != null && str1 == "Pacifist") { if (OfferQuality == "Fair" || OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } else if (OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_PEACE_COLDWAR"; response.peace = true; return response; } else { response.answer = "REJECT_PEACE_RUTHLESS"; return response; } } else if (state != WarState.LosingSlightly) { if (state != WarState.LosingBadly) { return response; } if (OfferQuality == "Fair" || OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else if (OfferQuality != "Poor") { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } else { response.answer = "ACCEPT_OFFER_PEACE_RELUCTANT"; response.peace = true; return response; } } else if (OfferQuality == "Fair" || OfferQuality == "Good" || OfferQuality == "Great") { response.answer = "ACCEPT_OFFER_PEACE"; response.peace = true; return response; } else { response.answer = "REJECT_OFFER_PEACE_POOROFFER"; return response; } } default: { return response; } } }
public DiplomacyScreen(Empire e, Empire us, string which, Offer OurOffer, Offer TheirOffer, Empire taremp) { e.GetRelations()[us].turnsSinceLastContact = 0; this.them = e; this.playerEmpire = us; this.empToDiscuss = taremp; this.whichDialogue = which; base.IsPopup = true; this.dState = DiplomacyScreen.DialogState.TheirOffer; this.TheirText = this.GetDialogueByName(which); this.OurOffer = OurOffer; this.TheirOffer = TheirOffer; base.TransitionOnTime = TimeSpan.FromSeconds(1); }
public string DoRespectfulText(Offer.Attitude a, Offer TheirOffer) { this.OfferText = ""; if (this.PeaceTreaty) { Offer offer = this; offer.OfferText = string.Concat(offer.OfferText, Localizer.Token(3000)); Offer offer1 = this; offer1.OfferText = string.Concat(offer1.OfferText, "\n\n"); } if (this.Alliance) { Offer offer2 = this; offer2.OfferText = string.Concat(offer2.OfferText, Localizer.Token(3001)); Offer offer3 = this; offer3.OfferText = string.Concat(offer3.OfferText, "\n\n"); } if (this.OpenBorders) { if (!TheirOffer.OpenBorders) { Offer offer4 = this; offer4.OfferText = string.Concat(offer4.OfferText, Localizer.Token(3003)); } else { Offer offer5 = this; offer5.OfferText = string.Concat(offer5.OfferText, Localizer.Token(3002)); } if (this.NAPact) { Offer offer6 = this; offer6.OfferText = string.Concat(offer6.OfferText, Localizer.Token(3004)); } } else if (TheirOffer.OpenBorders) { Offer offer7 = this; offer7.OfferText = string.Concat(offer7.OfferText, Localizer.Token(3005)); if (this.NAPact) { Offer offer8 = this; offer8.OfferText = string.Concat(offer8.OfferText, Localizer.Token(3006)); } } else if (this.NAPact) { Offer offer9 = this; offer9.OfferText = string.Concat(offer9.OfferText, Localizer.Token(3007)); } if (this.TradeTreaty) { if (this.NAPact || this.OpenBorders || TheirOffer.OpenBorders) { Offer offer10 = this; offer10.OfferText = string.Concat(offer10.OfferText, "\n"); Offer offer11 = this; offer11.OfferText = string.Concat(offer11.OfferText, Localizer.Token(3008)); } else { Offer offer12 = this; offer12.OfferText = string.Concat(offer12.OfferText, Localizer.Token(3009)); } } if (this.TradeTreaty || this.OpenBorders || TheirOffer.OpenBorders || this.NAPact) { Offer offer13 = this; offer13.OfferText = string.Concat(offer13.OfferText, "\n"); } if (this.ArtifactsOffered.Count > 0) { Offer offer14 = this; offer14.OfferText = string.Concat(offer14.OfferText, Localizer.Token(3010)); if (this.ArtifactsOffered.Count == 1) { Offer offer15 = this; offer15.OfferText = string.Concat(offer15.OfferText, this.ArtifactsOffered[0], ". "); } else if (this.ArtifactsOffered.Count != 2) { for (int i = 0; i < this.ArtifactsOffered.Count; i++) { if (i >= this.ArtifactsOffered.Count - 1) { Offer offer16 = this; offer16.OfferText = string.Concat(offer16.OfferText, "and "); Offer offer17 = this; offer17.OfferText = string.Concat(offer17.OfferText, this.ArtifactsOffered[i], ". "); } else { Offer offer18 = this; offer18.OfferText = string.Concat(offer18.OfferText, this.ArtifactsOffered[i], ", "); } } } else { Offer offer19 = this; offer19.OfferText = string.Concat(offer19.OfferText, this.ArtifactsOffered[0], Localizer.Token(3011)); Offer offer20 = this; offer20.OfferText = string.Concat(offer20.OfferText, this.ArtifactsOffered[1], ". "); } } if (TheirOffer.ArtifactsOffered.Count > 0) { Offer offer21 = this; offer21.OfferText = string.Concat(offer21.OfferText, Localizer.Token(3012)); if (TheirOffer.ArtifactsOffered.Count == 1) { Offer offer22 = this; offer22.OfferText = string.Concat(offer22.OfferText, TheirOffer.ArtifactsOffered[0], ". "); } else if (TheirOffer.ArtifactsOffered.Count != 2) { for (int i = 0; i < TheirOffer.ArtifactsOffered.Count; i++) { if (i >= TheirOffer.ArtifactsOffered.Count - 1) { Offer offer23 = this; offer23.OfferText = string.Concat(offer23.OfferText, Localizer.Token(3013)); Offer offer24 = this; offer24.OfferText = string.Concat(offer24.OfferText, TheirOffer.ArtifactsOffered[i], ". "); } else { Offer offer25 = this; offer25.OfferText = string.Concat(offer25.OfferText, TheirOffer.ArtifactsOffered[i], ", "); } } } else { Offer offer26 = this; offer26.OfferText = string.Concat(offer26.OfferText, TheirOffer.ArtifactsOffered[0], Localizer.Token(3011)); Offer offer27 = this; offer27.OfferText = string.Concat(offer27.OfferText, TheirOffer.ArtifactsOffered[1], ". "); } } if (this.TechnologiesOffered.Count > 0 && TheirOffer.TechnologiesOffered.Count == 0) { Offer offer28 = this; offer28.OfferText = string.Concat(offer28.OfferText, Localizer.Token(3014)); if (this.TechnologiesOffered.Count == 1) { Offer offer29 = this; offer29.OfferText = string.Concat(offer29.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[0]].NameIndex), ". "); } else if (this.TechnologiesOffered.Count != 2) { for (int i = 0; i < this.TechnologiesOffered.Count; i++) { if (i >= this.TechnologiesOffered.Count - 1) { Offer offer30 = this; offer30.OfferText = string.Concat(offer30.OfferText, Localizer.Token(3013)); Offer offer31 = this; offer31.OfferText = string.Concat(offer31.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[i]].NameIndex), ". "); } else { Offer offer32 = this; offer32.OfferText = string.Concat(offer32.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[i]].NameIndex), ", "); } } } else { Offer offer33 = this; offer33.OfferText = string.Concat(offer33.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[0]].NameIndex), Localizer.Token(3011)); Offer offer34 = this; offer34.OfferText = string.Concat(offer34.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[1]].NameIndex), ". "); } } else if (this.TechnologiesOffered.Count == 0 && TheirOffer.TechnologiesOffered.Count > 0) { Offer offer35 = this; offer35.OfferText = string.Concat(offer35.OfferText, Localizer.Token(3015)); if (TheirOffer.TechnologiesOffered.Count == 1) { Offer offer36 = this; offer36.OfferText = string.Concat(offer36.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[0]].NameIndex), ". "); } else if (TheirOffer.TechnologiesOffered.Count != 2) { for (int i = 0; i < TheirOffer.TechnologiesOffered.Count; i++) { if (i >= this.TechnologiesOffered.Count - 1) { Offer offer37 = this; offer37.OfferText = string.Concat(offer37.OfferText, Localizer.Token(3013)); Offer offer38 = this; offer38.OfferText = string.Concat(offer38.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[i]].NameIndex), ". "); } else { Offer offer39 = this; offer39.OfferText = string.Concat(offer39.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[i]].NameIndex), ", "); } } } else { Offer offer40 = this; offer40.OfferText = string.Concat(offer40.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[0]].NameIndex), Localizer.Token(3011)); Offer offer41 = this; offer41.OfferText = string.Concat(offer41.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[1]].NameIndex), ". "); } } else if (this.TechnologiesOffered.Count > 0 && TheirOffer.TechnologiesOffered.Count > 0) { Offer offer42 = this; offer42.OfferText = string.Concat(offer42.OfferText, Localizer.Token(3016)); if (TheirOffer.TechnologiesOffered.Count == 1) { Offer offer43 = this; offer43.OfferText = string.Concat(offer43.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[0]].NameIndex), ". "); } else if (TheirOffer.TechnologiesOffered.Count != 2) { for (int i = 0; i < TheirOffer.TechnologiesOffered.Count; i++) { if (i >= this.TechnologiesOffered.Count - 1) { Offer offer44 = this; offer44.OfferText = string.Concat(offer44.OfferText, Localizer.Token(3013)); Offer offer45 = this; offer45.OfferText = string.Concat(offer45.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[i]].NameIndex), ". "); } else { Offer offer46 = this; offer46.OfferText = string.Concat(offer46.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[i]].NameIndex), ", "); } } } else { Offer offer47 = this; offer47.OfferText = string.Concat(offer47.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[0]].NameIndex), Localizer.Token(3011)); Offer offer48 = this; offer48.OfferText = string.Concat(offer48.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[1]].NameIndex), ". "); } Offer offer49 = this; offer49.OfferText = string.Concat(offer49.OfferText, Localizer.Token(3017)); if (this.TechnologiesOffered.Count == 1) { Offer offer50 = this; offer50.OfferText = string.Concat(offer50.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[0]].NameIndex), ". "); } else if (this.TechnologiesOffered.Count != 2) { for (int i = 0; i < this.TechnologiesOffered.Count; i++) { if (i >= this.TechnologiesOffered.Count - 1) { Offer offer51 = this; offer51.OfferText = string.Concat(offer51.OfferText, Localizer.Token(3013)); Offer offer52 = this; offer52.OfferText = string.Concat(offer52.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[i]].NameIndex), ". "); } else { Offer offer53 = this; offer53.OfferText = string.Concat(offer53.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[i]].NameIndex), ", "); } } } else { Offer offer54 = this; offer54.OfferText = string.Concat(offer54.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[0]].NameIndex), Localizer.Token(3011)); Offer offer55 = this; offer55.OfferText = string.Concat(offer55.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[1]].NameIndex), ". "); } } if (TheirOffer.ColoniesOffered.Count > 0 && this.ColoniesOffered.Count == 0) { Offer offer56 = this; offer56.OfferText = string.Concat(offer56.OfferText, Localizer.Token(3018)); if (TheirOffer.ColoniesOffered.Count == 1) { Offer offer57 = this; offer57.OfferText = string.Concat(offer57.OfferText, TheirOffer.ColoniesOffered[0], ". "); } else if (TheirOffer.ColoniesOffered.Count != 2) { for (int i = 0; i < TheirOffer.ColoniesOffered.Count; i++) { if (i >= TheirOffer.ColoniesOffered.Count - 1) { Offer offer58 = this; offer58.OfferText = string.Concat(offer58.OfferText, Localizer.Token(3013)); Offer offer59 = this; offer59.OfferText = string.Concat(offer59.OfferText, TheirOffer.ColoniesOffered[i], ". "); } else { Offer offer60 = this; offer60.OfferText = string.Concat(offer60.OfferText, TheirOffer.ColoniesOffered[i], ", "); } } } else { Offer offer61 = this; offer61.OfferText = string.Concat(offer61.OfferText, TheirOffer.ColoniesOffered[0], Localizer.Token(3011)); Offer offer62 = this; offer62.OfferText = string.Concat(offer62.OfferText, TheirOffer.ColoniesOffered[1], ". "); } } else if (TheirOffer.ColoniesOffered.Count > 0 && this.ColoniesOffered.Count > 0) { Offer offer63 = this; offer63.OfferText = string.Concat(offer63.OfferText, Localizer.Token(3019)); if (TheirOffer.ColoniesOffered.Count == 1) { Offer offer64 = this; offer64.OfferText = string.Concat(offer64.OfferText, TheirOffer.ColoniesOffered[0], ". "); } else if (TheirOffer.ColoniesOffered.Count != 2) { for (int i = 0; i < TheirOffer.ColoniesOffered.Count; i++) { if (i >= TheirOffer.ColoniesOffered.Count - 1) { Offer offer65 = this; offer65.OfferText = string.Concat(offer65.OfferText, Localizer.Token(3013)); Offer offer66 = this; offer66.OfferText = string.Concat(offer66.OfferText, TheirOffer.ColoniesOffered[i], ". "); } else { Offer offer67 = this; offer67.OfferText = string.Concat(offer67.OfferText, TheirOffer.ColoniesOffered[i], ", "); } } } else { Offer offer68 = this; offer68.OfferText = string.Concat(offer68.OfferText, TheirOffer.ColoniesOffered[0], Localizer.Token(3011)); Offer offer69 = this; offer69.OfferText = string.Concat(offer69.OfferText, TheirOffer.ColoniesOffered[1], ". "); } Offer offer70 = this; offer70.OfferText = string.Concat(offer70.OfferText, Localizer.Token(3020)); if (this.ColoniesOffered.Count == 1) { Offer offer71 = this; offer71.OfferText = string.Concat(offer71.OfferText, this.ColoniesOffered[0], ". "); } else if (this.ColoniesOffered.Count != 2) { for (int i = 0; i < this.ColoniesOffered.Count; i++) { if (i >= this.ColoniesOffered.Count - 1) { Offer offer72 = this; offer72.OfferText = string.Concat(offer72.OfferText, Localizer.Token(3013)); Offer offer73 = this; offer73.OfferText = string.Concat(offer73.OfferText, this.ColoniesOffered[i], ". "); } else { Offer offer74 = this; offer74.OfferText = string.Concat(offer74.OfferText, this.ColoniesOffered[i], ", "); } } } else { Offer offer75 = this; offer75.OfferText = string.Concat(offer75.OfferText, this.ColoniesOffered[0], Localizer.Token(3011)); Offer offer76 = this; offer76.OfferText = string.Concat(offer76.OfferText, this.ColoniesOffered[1], ". "); } } else if (this.ColoniesOffered.Count > 0) { Offer offer77 = this; offer77.OfferText = string.Concat(offer77.OfferText, Localizer.Token(3021)); if (this.ColoniesOffered.Count == 1) { Offer offer78 = this; offer78.OfferText = string.Concat(offer78.OfferText, this.ColoniesOffered[0], ". "); } else if (this.ColoniesOffered.Count != 2) { for (int i = 0; i < this.ColoniesOffered.Count; i++) { if (i >= this.ColoniesOffered.Count - 1) { Offer offer79 = this; offer79.OfferText = string.Concat(offer79.OfferText, Localizer.Token(3013)); Offer offer80 = this; offer80.OfferText = string.Concat(offer80.OfferText, this.ColoniesOffered[i], ". "); } else { Offer offer81 = this; offer81.OfferText = string.Concat(offer81.OfferText, this.ColoniesOffered[i], ", "); } } } else { Offer offer82 = this; offer82.OfferText = string.Concat(offer82.OfferText, this.ColoniesOffered[0], Localizer.Token(3011)); Offer offer83 = this; offer83.OfferText = string.Concat(offer83.OfferText, this.ColoniesOffered[1], ". "); } } if (TheirOffer.EmpiresToWarOn.Count > 0) { if (!EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetRelations()[TheirOffer.Them].Treaty_Alliance) { if (this.GetNumberOfDemands(this) > 0 && this.GetNumberOfDemands(TheirOffer) == 1) { Offer offer84 = this; offer84.OfferText = string.Concat(offer84.OfferText, "In exchange for this, we want you to declare war upon: "); } else if (this.GetNumberOfDemands(TheirOffer) + this.GetNumberOfDemands(this) > 2) { Offer offer85 = this; offer85.OfferText = string.Concat(offer85.OfferText, "Finally, we are requesting that you declare war upon: "); } else if (this.GetNumberOfDemands(TheirOffer) <= 1) { this.OfferText = "We believe it would be prudent of you to declare war upon: "; } else { Offer offer86 = this; offer86.OfferText = string.Concat(offer86.OfferText, "Furthermore, we are requesting that you declare war upon: "); } if (TheirOffer.EmpiresToWarOn.Count == 1) { Offer offer87 = this; offer87.OfferText = string.Concat(offer87.OfferText, TheirOffer.EmpiresToWarOn[0]); } else if (TheirOffer.EmpiresToWarOn.Count == 2) { Offer offer88 = this; offer88.OfferText = string.Concat(offer88.OfferText, TheirOffer.EmpiresToWarOn[0], " and ", TheirOffer.EmpiresToWarOn[1]); } else if (TheirOffer.EmpiresToWarOn.Count > 2) { for (int i = 0; i < TheirOffer.EmpiresToWarOn.Count; i++) { if (i >= TheirOffer.EmpiresToWarOn.Count - 1) { Offer offer89 = this; offer89.OfferText = string.Concat(offer89.OfferText, " and ", TheirOffer.EmpiresToWarOn[i]); } else { Offer offer90 = this; offer90.OfferText = string.Concat(offer90.OfferText, TheirOffer.EmpiresToWarOn[i]); Offer offer91 = this; offer91.OfferText = string.Concat(offer91.OfferText, ", "); } } } } else { if (this.GetNumberOfDemands(this) > 1 && this.GetNumberOfDemands(TheirOffer) == 1) { Offer offer92 = this; offer92.OfferText = string.Concat(offer92.OfferText, "We give you this gift, friend, and now call upon our alliance in requesting that you declare war upon: "); } else if (this.GetNumberOfDemands(TheirOffer) + this.GetNumberOfDemands(this) > 2) { Offer offer93 = this; offer93.OfferText = string.Concat(offer93.OfferText, "Finally, we call upon our alliance and request that you declare war upon: "); } else if (this.GetNumberOfDemands(TheirOffer) <= 1) { Offer offer94 = this; offer94.OfferText = string.Concat(offer94.OfferText, "Friend, it is time for us to call upon our allies to join us in war. You must declare war upon: "); } else { Offer offer95 = this; offer95.OfferText = string.Concat(offer95.OfferText, "Furthermore, we call upon our alliance and request that you declare war upon: "); } if (TheirOffer.EmpiresToWarOn.Count == 1) { Offer offer96 = this; offer96.OfferText = string.Concat(offer96.OfferText, TheirOffer.EmpiresToWarOn[0]); } else if (TheirOffer.EmpiresToWarOn.Count == 2) { Offer offer97 = this; offer97.OfferText = string.Concat(offer97.OfferText, TheirOffer.EmpiresToWarOn[0], " and ", TheirOffer.EmpiresToWarOn[1]); } else if (TheirOffer.EmpiresToWarOn.Count > 2) { for (int i = 0; i < TheirOffer.EmpiresToWarOn.Count; i++) { if (i >= TheirOffer.EmpiresToWarOn.Count - 1) { Offer offer98 = this; offer98.OfferText = string.Concat(offer98.OfferText, " and ", TheirOffer.EmpiresToWarOn[i]); } else { Offer offer99 = this; offer99.OfferText = string.Concat(offer99.OfferText, TheirOffer.EmpiresToWarOn[i]); Offer offer100 = this; offer100.OfferText = string.Concat(offer100.OfferText, ", "); } } } } } return this.OfferText; }
public string DoPleadingText(Offer.Attitude a, Offer TheirOffer) { this.OfferText = ""; if (this.PeaceTreaty) { Offer offer = this; offer.OfferText = string.Concat(offer.OfferText, Localizer.Token(3022)); Offer offer1 = this; offer1.OfferText = string.Concat(offer1.OfferText, "\n\n"); } if (this.Alliance) { Offer offer2 = this; offer2.OfferText = string.Concat(offer2.OfferText, Localizer.Token(3023)); Offer offer3 = this; offer3.OfferText = string.Concat(offer3.OfferText, "\n\n"); } if (this.OpenBorders) { if (!TheirOffer.OpenBorders) { Offer offer4 = this; offer4.OfferText = string.Concat(offer4.OfferText, Localizer.Token(3025)); } else { Offer offer5 = this; offer5.OfferText = string.Concat(offer5.OfferText, Localizer.Token(3024)); } if (this.NAPact) { Offer offer6 = this; offer6.OfferText = string.Concat(offer6.OfferText, Localizer.Token(3026)); } } else if (TheirOffer.OpenBorders) { Offer offer7 = this; offer7.OfferText = string.Concat(offer7.OfferText, Localizer.Token(3027)); if (this.NAPact) { Offer offer8 = this; offer8.OfferText = string.Concat(offer8.OfferText, Localizer.Token(3028)); } } else if (this.NAPact) { Offer offer9 = this; offer9.OfferText = string.Concat(offer9.OfferText, Localizer.Token(3029)); } if (this.ArtifactsOffered.Count > 0) { Offer offer10 = this; offer10.OfferText = string.Concat(offer10.OfferText, Localizer.Token(3030)); if (this.ArtifactsOffered.Count == 1) { Offer offer11 = this; offer11.OfferText = string.Concat(offer11.OfferText, this.ArtifactsOffered[0], ". "); } else if (this.ArtifactsOffered.Count != 2) { for (int i = 0; i < this.ArtifactsOffered.Count; i++) { if (i >= this.ArtifactsOffered.Count - 1) { Offer offer12 = this; offer12.OfferText = string.Concat(offer12.OfferText, Localizer.Token(3013)); Offer offer13 = this; offer13.OfferText = string.Concat(offer13.OfferText, this.ArtifactsOffered[i], ". "); } else { Offer offer14 = this; offer14.OfferText = string.Concat(offer14.OfferText, this.ArtifactsOffered[i], ", "); } } } else { Offer offer15 = this; offer15.OfferText = string.Concat(offer15.OfferText, this.ArtifactsOffered[0], Localizer.Token(3011)); Offer offer16 = this; offer16.OfferText = string.Concat(offer16.OfferText, this.ArtifactsOffered[1], ". "); } } if (TheirOffer.ArtifactsOffered.Count > 0) { Offer offer17 = this; offer17.OfferText = string.Concat(offer17.OfferText, Localizer.Token(3031)); if (TheirOffer.ArtifactsOffered.Count == 1) { Offer offer18 = this; offer18.OfferText = string.Concat(offer18.OfferText, TheirOffer.ArtifactsOffered[0], ". "); } else if (TheirOffer.ArtifactsOffered.Count != 2) { for (int i = 0; i < TheirOffer.ArtifactsOffered.Count; i++) { if (i >= TheirOffer.ArtifactsOffered.Count - 1) { Offer offer19 = this; offer19.OfferText = string.Concat(offer19.OfferText, Localizer.Token(3013)); Offer offer20 = this; offer20.OfferText = string.Concat(offer20.OfferText, TheirOffer.ArtifactsOffered[i], ". "); } else { Offer offer21 = this; offer21.OfferText = string.Concat(offer21.OfferText, TheirOffer.ArtifactsOffered[i], ", "); } } } else { Offer offer22 = this; offer22.OfferText = string.Concat(offer22.OfferText, TheirOffer.ArtifactsOffered[0], Localizer.Token(3032)); Offer offer23 = this; offer23.OfferText = string.Concat(offer23.OfferText, TheirOffer.ArtifactsOffered[1], ". "); } } if (this.TradeTreaty) { if (this.NAPact || this.OpenBorders || TheirOffer.OpenBorders) { Offer offer24 = this; offer24.OfferText = string.Concat(offer24.OfferText, "\n\n"); Offer offer25 = this; offer25.OfferText = string.Concat(offer25.OfferText, Localizer.Token(3033)); } else { Offer offer26 = this; offer26.OfferText = string.Concat(offer26.OfferText, Localizer.Token(3034)); } } if (this.TradeTreaty || this.OpenBorders || TheirOffer.OpenBorders || this.NAPact) { Offer offer27 = this; offer27.OfferText = string.Concat(offer27.OfferText, "\n\n"); } if (this.TechnologiesOffered.Count > 0 && TheirOffer.TechnologiesOffered.Count == 0) { Offer offer28 = this; offer28.OfferText = string.Concat(offer28.OfferText, Localizer.Token(3035)); if (this.TechnologiesOffered.Count == 1) { Offer offer29 = this; offer29.OfferText = string.Concat(offer29.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[0]].NameIndex), ". "); } else if (this.TechnologiesOffered.Count != 2) { for (int i = 0; i < this.TechnologiesOffered.Count; i++) { if (i >= this.TechnologiesOffered.Count - 1) { Offer offer30 = this; offer30.OfferText = string.Concat(offer30.OfferText, Localizer.Token(3013)); Offer offer31 = this; offer31.OfferText = string.Concat(offer31.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[i]].NameIndex), ". "); } else { Offer offer32 = this; offer32.OfferText = string.Concat(offer32.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[i]].NameIndex), ", "); } } } else { Offer offer33 = this; offer33.OfferText = string.Concat(offer33.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[0]].NameIndex), Localizer.Token(3011)); Offer offer34 = this; offer34.OfferText = string.Concat(offer34.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[1]].NameIndex), ". "); } } else if (this.TechnologiesOffered.Count == 0 && TheirOffer.TechnologiesOffered.Count > 0) { Offer offer35 = this; offer35.OfferText = string.Concat(offer35.OfferText, Localizer.Token(3036)); if (TheirOffer.TechnologiesOffered.Count == 1) { Offer offer36 = this; offer36.OfferText = string.Concat(offer36.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[0]].NameIndex), "? "); } else if (TheirOffer.TechnologiesOffered.Count != 2) { for (int i = 0; i < TheirOffer.TechnologiesOffered.Count; i++) { if (i >= this.TechnologiesOffered.Count - 1) { Offer offer37 = this; offer37.OfferText = string.Concat(offer37.OfferText, Localizer.Token(3013)); Offer offer38 = this; offer38.OfferText = string.Concat(offer38.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[i]].NameIndex), "? "); } else { Offer offer39 = this; offer39.OfferText = string.Concat(offer39.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[i]].NameIndex), ", "); } } } else { Offer offer40 = this; offer40.OfferText = string.Concat(offer40.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[0]].NameIndex), Localizer.Token(3011)); Offer offer41 = this; offer41.OfferText = string.Concat(offer41.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[1]].NameIndex), "? "); } } else if (this.TechnologiesOffered.Count > 0 && TheirOffer.TechnologiesOffered.Count > 0) { Offer offer42 = this; offer42.OfferText = string.Concat(offer42.OfferText, Localizer.Token(3037)); if (TheirOffer.TechnologiesOffered.Count == 1) { Offer offer43 = this; offer43.OfferText = string.Concat(offer43.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[0]].NameIndex), ". "); } else if (TheirOffer.TechnologiesOffered.Count != 2) { for (int i = 0; i < TheirOffer.TechnologiesOffered.Count; i++) { if (i >= this.TechnologiesOffered.Count - 1) { Offer offer44 = this; offer44.OfferText = string.Concat(offer44.OfferText, Localizer.Token(3013)); Offer offer45 = this; offer45.OfferText = string.Concat(offer45.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[i]].NameIndex), ". "); } else { Offer offer46 = this; offer46.OfferText = string.Concat(offer46.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[i]].NameIndex), ", "); } } } else { Offer offer47 = this; offer47.OfferText = string.Concat(offer47.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[0]].NameIndex), Localizer.Token(3011)); Offer offer48 = this; offer48.OfferText = string.Concat(offer48.OfferText, Localizer.Token(ResourceManager.TechTree[TheirOffer.TechnologiesOffered[1]].NameIndex), ". "); } Offer offer49 = this; offer49.OfferText = string.Concat(offer49.OfferText, Localizer.Token(3038)); if (this.TechnologiesOffered.Count == 1) { Offer offer50 = this; offer50.OfferText = string.Concat(offer50.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[0]].NameIndex), ". "); } else if (this.TechnologiesOffered.Count != 2) { for (int i = 0; i < this.TechnologiesOffered.Count; i++) { if (i >= this.TechnologiesOffered.Count - 1) { Offer offer51 = this; offer51.OfferText = string.Concat(offer51.OfferText, Localizer.Token(3013)); Offer offer52 = this; offer52.OfferText = string.Concat(offer52.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[i]].NameIndex), ". "); } else { Offer offer53 = this; offer53.OfferText = string.Concat(offer53.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[i]].NameIndex), ", "); } } } else { Offer offer54 = this; offer54.OfferText = string.Concat(offer54.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[0]].NameIndex), Localizer.Token(3011)); Offer offer55 = this; offer55.OfferText = string.Concat(offer55.OfferText, Localizer.Token(ResourceManager.TechTree[this.TechnologiesOffered[1]].NameIndex), ". "); } } if (TheirOffer.ColoniesOffered.Count > 0 && this.ColoniesOffered.Count == 0) { Offer offer56 = this; offer56.OfferText = string.Concat(offer56.OfferText, Localizer.Token(3039)); if (TheirOffer.ColoniesOffered.Count == 1) { Offer offer57 = this; offer57.OfferText = string.Concat(offer57.OfferText, TheirOffer.ColoniesOffered[0], ". "); } else if (TheirOffer.ColoniesOffered.Count != 2) { for (int i = 0; i < TheirOffer.ColoniesOffered.Count; i++) { if (i >= TheirOffer.ColoniesOffered.Count - 1) { Offer offer58 = this; offer58.OfferText = string.Concat(offer58.OfferText, Localizer.Token(3013)); Offer offer59 = this; offer59.OfferText = string.Concat(offer59.OfferText, TheirOffer.ColoniesOffered[i], ". "); } else { Offer offer60 = this; offer60.OfferText = string.Concat(offer60.OfferText, TheirOffer.ColoniesOffered[i], ", "); } } } else { Offer offer61 = this; offer61.OfferText = string.Concat(offer61.OfferText, TheirOffer.ColoniesOffered[0], Localizer.Token(3011)); Offer offer62 = this; offer62.OfferText = string.Concat(offer62.OfferText, TheirOffer.ColoniesOffered[1], ". "); } } else if (TheirOffer.ColoniesOffered.Count > 0 && this.ColoniesOffered.Count > 0) { Offer offer63 = this; offer63.OfferText = string.Concat(offer63.OfferText, Localizer.Token(3040)); if (TheirOffer.ColoniesOffered.Count == 1) { Offer offer64 = this; offer64.OfferText = string.Concat(offer64.OfferText, TheirOffer.ColoniesOffered[0], ". "); } else if (TheirOffer.ColoniesOffered.Count != 2) { for (int i = 0; i < TheirOffer.ColoniesOffered.Count; i++) { if (i >= TheirOffer.ColoniesOffered.Count - 1) { Offer offer65 = this; offer65.OfferText = string.Concat(offer65.OfferText, Localizer.Token(3013)); Offer offer66 = this; offer66.OfferText = string.Concat(offer66.OfferText, TheirOffer.ColoniesOffered[i], ". "); } else { Offer offer67 = this; offer67.OfferText = string.Concat(offer67.OfferText, TheirOffer.ColoniesOffered[i], ", "); } } } else { Offer offer68 = this; offer68.OfferText = string.Concat(offer68.OfferText, TheirOffer.ColoniesOffered[0], Localizer.Token(3011)); Offer offer69 = this; offer69.OfferText = string.Concat(offer69.OfferText, TheirOffer.ColoniesOffered[1], ". "); } Offer offer70 = this; offer70.OfferText = string.Concat(offer70.OfferText, Localizer.Token(3041)); if (this.ColoniesOffered.Count == 1) { Offer offer71 = this; offer71.OfferText = string.Concat(offer71.OfferText, this.ColoniesOffered[0], ". "); } else if (this.ColoniesOffered.Count != 2) { for (int i = 0; i < this.ColoniesOffered.Count; i++) { if (i >= this.ColoniesOffered.Count - 1) { Offer offer72 = this; offer72.OfferText = string.Concat(offer72.OfferText, Localizer.Token(3013)); Offer offer73 = this; offer73.OfferText = string.Concat(offer73.OfferText, this.ColoniesOffered[i], ". "); } else { Offer offer74 = this; offer74.OfferText = string.Concat(offer74.OfferText, this.ColoniesOffered[i], ", "); } } } else { Offer offer75 = this; offer75.OfferText = string.Concat(offer75.OfferText, this.ColoniesOffered[0], Localizer.Token(3011)); Offer offer76 = this; offer76.OfferText = string.Concat(offer76.OfferText, this.ColoniesOffered[1], ". "); } } else if (this.ColoniesOffered.Count > 0) { Offer offer77 = this; offer77.OfferText = string.Concat(offer77.OfferText, Localizer.Token(3042)); if (this.ColoniesOffered.Count == 1) { Offer offer78 = this; offer78.OfferText = string.Concat(offer78.OfferText, this.ColoniesOffered[0], ". "); } else if (this.ColoniesOffered.Count != 2) { for (int i = 0; i < this.ColoniesOffered.Count; i++) { if (i >= this.ColoniesOffered.Count - 1) { Offer offer79 = this; offer79.OfferText = string.Concat(offer79.OfferText, Localizer.Token(3013)); Offer offer80 = this; offer80.OfferText = string.Concat(offer80.OfferText, this.ColoniesOffered[i], ". "); } else { Offer offer81 = this; offer81.OfferText = string.Concat(offer81.OfferText, this.ColoniesOffered[i], ", "); } } } else { Offer offer82 = this; offer82.OfferText = string.Concat(offer82.OfferText, this.ColoniesOffered[0], Localizer.Token(3011)); Offer offer83 = this; offer83.OfferText = string.Concat(offer83.OfferText, this.ColoniesOffered[1], ". "); } } if (TheirOffer.EmpiresToWarOn.Count > 0) { if (!EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetRelations()[TheirOffer.Them].Treaty_Alliance) { if (this.GetNumberOfDemands(this) > 0 && this.GetNumberOfDemands(TheirOffer) == 1) { Offer offer84 = this; offer84.OfferText = string.Concat(offer84.OfferText, "In exchange for our leavings, and to avoid your own certain doom, you must declare war upon: "); } else if (this.GetNumberOfDemands(TheirOffer) + this.GetNumberOfDemands(this) > 2) { Offer offer85 = this; offer85.OfferText = string.Concat(offer85.OfferText, "Finally, we will crush you and your pathetic empire unless you declare war upon: "); } else if (this.GetNumberOfDemands(TheirOffer) <= 1) { this.OfferText = "Unless you wish for us to crush your pathetic empire, you will declare war upon: "; } else { Offer offer86 = this; offer86.OfferText = string.Concat(offer86.OfferText, "Furthermore, we will crush you and your pathetic empire unless you declare war upon: "); } if (TheirOffer.EmpiresToWarOn.Count == 1) { Offer offer87 = this; offer87.OfferText = string.Concat(offer87.OfferText, TheirOffer.EmpiresToWarOn[0]); } else if (TheirOffer.EmpiresToWarOn.Count == 2) { Offer offer88 = this; offer88.OfferText = string.Concat(offer88.OfferText, TheirOffer.EmpiresToWarOn[0], " and ", TheirOffer.EmpiresToWarOn[1]); } else if (TheirOffer.EmpiresToWarOn.Count > 2) { for (int i = 0; i < TheirOffer.EmpiresToWarOn.Count; i++) { if (i >= TheirOffer.EmpiresToWarOn.Count - 1) { Offer offer89 = this; offer89.OfferText = string.Concat(offer89.OfferText, " and ", TheirOffer.EmpiresToWarOn[i]); } else { Offer offer90 = this; offer90.OfferText = string.Concat(offer90.OfferText, TheirOffer.EmpiresToWarOn[i]); Offer offer91 = this; offer91.OfferText = string.Concat(offer91.OfferText, ", "); } } } } else { if (this.GetNumberOfDemands(this) > 1 && this.GetNumberOfDemands(TheirOffer) == 1) { Offer offer92 = this; offer92.OfferText = string.Concat(offer92.OfferText, "We offer you these gifts in the hope that you might join us in war against: "); } else if (this.GetNumberOfDemands(TheirOffer) + this.GetNumberOfDemands(this) > 2) { Offer offer93 = this; offer93.OfferText = string.Concat(offer93.OfferText, "Finally, we should not have to remind you that we can crush you like a bug. But we can. Therefore, to avoid annihilation, you must declare war on: "); } else if (this.GetNumberOfDemands(TheirOffer) <= 1) { Offer offer94 = this; offer94.OfferText = string.Concat(offer94.OfferText, "The time to do our bidding has come, ally. You must declare war upon: "); } else { Offer offer95 = this; offer95.OfferText = string.Concat(offer95.OfferText, "Furthermore, we should not have to remind you that we can crush you like a bug. But we can. Therefore, to avoid annihilation, you must declare war on: "); } if (TheirOffer.EmpiresToWarOn.Count == 1) { Offer offer96 = this; offer96.OfferText = string.Concat(offer96.OfferText, TheirOffer.EmpiresToWarOn[0]); } else if (TheirOffer.EmpiresToWarOn.Count == 2) { Offer offer97 = this; offer97.OfferText = string.Concat(offer97.OfferText, TheirOffer.EmpiresToWarOn[0], " and ", TheirOffer.EmpiresToWarOn[1]); } else if (TheirOffer.EmpiresToWarOn.Count > 2) { for (int i = 0; i < TheirOffer.EmpiresToWarOn.Count; i++) { if (i >= TheirOffer.EmpiresToWarOn.Count - 1) { Offer offer98 = this; offer98.OfferText = string.Concat(offer98.OfferText, " and ", TheirOffer.EmpiresToWarOn[i]); } else { Offer offer99 = this; offer99.OfferText = string.Concat(offer99.OfferText, TheirOffer.EmpiresToWarOn[i]); Offer offer100 = this; offer100.OfferText = string.Concat(offer100.OfferText, ", "); } } } } } return this.OfferText; }
public int GetNumberOfDemands(Offer which) { int num = 0; if (which.NAPact) { num++; } if (which.PeaceTreaty) { num++; } if (which.OpenBorders) { num++; } if (which.TradeTreaty) { num++; } if (which.TechnologiesOffered.Count > 0) { num++; } if (which.ColoniesOffered.Count > 0) { num++; } if (which.ArtifactsOffered.Count > 0) { num++; } if (which.EmpiresToMakePeaceWith.Count > 0) { num++; } if (which.EmpiresToWarOn.Count > 0) { num++; } return num; }
public string FormulateOfferText(Offer.Attitude a, Offer TheirOffer) { switch (a) { case Offer.Attitude.Pleading: { return this.DoPleadingText(a, TheirOffer); } case Offer.Attitude.Respectful: { return this.DoRespectfulText(a, TheirOffer); } case Offer.Attitude.Threaten: { return this.DoThreateningText(a, TheirOffer); } } return this.OfferText; }