Пример #1
0
 public static void CheckDefeated(FactionBase factionBase)
 {
     if (factionBase.Faction != Faction.OfPlayer)
     {
         Map map = factionBase.Map;
         if (map != null && FactionBaseDefeatUtility.IsDefeated(map, factionBase.Faction))
         {
             StringBuilder stringBuilder = new StringBuilder();
             stringBuilder.Append("LetterFactionBaseDefeated".Translate(factionBase.Label, TimedForcedExit.GetForceExitAndRemoveMapCountdownTimeLeftString(60000)));
             if (!FactionBaseDefeatUtility.HasAnyOtherBase(factionBase))
             {
                 factionBase.Faction.defeated = true;
                 stringBuilder.AppendLine();
                 stringBuilder.AppendLine();
                 stringBuilder.Append("LetterFactionBaseDefeated_FactionDestroyed".Translate(factionBase.Faction.Name));
             }
             Find.LetterStack.ReceiveLetter("LetterLabelFactionBaseDefeated".Translate(), stringBuilder.ToString(), LetterDefOf.PositiveEvent, new GlobalTargetInfo(factionBase.Tile), null);
             DestroyedFactionBase destroyedFactionBase = (DestroyedFactionBase)WorldObjectMaker.MakeWorldObject(WorldObjectDefOf.DestroyedFactionBase);
             destroyedFactionBase.Tile = factionBase.Tile;
             Find.WorldObjects.Add(destroyedFactionBase);
             map.info.parent = destroyedFactionBase;
             Find.WorldObjects.Remove(factionBase);
             ((WorldObject)destroyedFactionBase).GetComponent <TimedForcedExit>().StartForceExitAndRemoveMapCountdown();
             TaleRecorder.RecordTale(TaleDefOf.CaravanAssaultSuccessful, map.mapPawns.FreeColonists.RandomElement());
         }
     }
 }
Пример #2
0
 public override void Tick()
 {
     base.Tick();
     FactionBaseDefeatUtility.CheckDefeated(this);
 }