private void CheckState() { lastObjectsCount = objects.WorldObjectsCount; if (!objects.MapParents.Any(x => war.AssaultFactions.Contains(x.Faction))) { foreach (var attacker in war.AssaultFactions) { WarUtility.DeleteCaravansAI(attacker.Faction); } war.EndWar(Winner.Defenders); return; } if (!objects.MapParents.Any(x => war.DefendingFactions.Contains(x.Faction))) { foreach (var defender in war.DefendingFactions) { WarUtility.DeleteCaravansAI(defender.Faction); } war.EndWar(Winner.Assaulters); return; } }
private float FinalizeDefendersPoints() { Faction faction = mapParent.Faction; Tile tile = Find.WorldGrid[mapParent.Tile]; float points = ((WarUtility.ThreatRangeFor(faction.def.techLevel).RandomInRange + GetLeaderPoints(faction)) * WarUtility.GetMultiplierFor(faction.def.techLevel)) * WarUtility.GetMultiplierFor(tile.hilliness); return(points); }
public override void EndWar(Winner winner) { base.EndWar(winner); if (WarUtility.WarWithPlayer(war)) { var playerInteraction = QuestsManager.Communications.FactionManager.PlayerInteraction; if ((winner == Winner.Assaulters && war.DeclaredWarFaction == playerInteraction) || (winner == Winner.Defenders && war.DefendingFaction == playerInteraction)) { Find.LetterStack.ReceiveLetter("WarGoalWorker_Destruction_YouWinTitle".Translate(), "WarGoalWorker_Destruction_YouWinDesc".Translate(war.WarName), LetterDefOf.PositiveEvent); var playerAlliance = QuestsManager.Communications.FactionManager.PlayerAlliance; if (playerAlliance != null) { playerAlliance.GiveTrustToAllFactions(WinTrust); } } else { Find.LetterStack.ReceiveLetter("WarGoalWorker_Destruction_YouLoseTitle".Translate(), "WarGoalWorker_Destruction_YouLoseDesc".Translate(war.WarName), LetterDefOf.NegativeEvent); } } }
private float FinalizeAttackPoints(Caravan caravan) { Faction faction = caravan.Faction; float result = (((CaravanAI)caravan).Threat + GetLeaderPoints(faction)) * WarUtility.GetMultiplierFor(faction.def.techLevel); return(result); }