Exemplo n.º 1
0
 private void Outcome_Disaster(Caravan caravan)
 {
     LongEventHandler.QueueLongEvent(delegate
     {
         FactionRelationKind playerRelationKind = base.Faction.PlayerRelationKind;
         int randomInRange = DiplomacyTuning.Goodwill_PeaceTalksDisasterRange.RandomInRange;
         base.Faction.TryAffectGoodwillWith(Faction.OfPlayer, randomInRange, canSendMessage: false, canSendHostilityLetter: false);
         base.Faction.TrySetRelationKind(Faction.OfPlayer, FactionRelationKind.Hostile, canSendLetter: false);
         IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatBig, caravan);
         incidentParms.faction       = base.Faction;
         PawnGroupMakerParms defaultPawnGroupMakerParms  = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(PawnGroupKindDefOf.Combat, incidentParms, ensureCanGenerateAtLeastOnePawn: true);
         defaultPawnGroupMakerParms.generateFightersOnly = true;
         List <Pawn> list = PawnGroupMakerUtility.GeneratePawns(defaultPawnGroupMakerParms).ToList();
         Map map          = CaravanIncidentUtility.SetupCaravanAttackMap(caravan, list, sendLetterIfRelatedPawns: false);
         if (list.Any())
         {
             LordMaker.MakeNewLord(incidentParms.faction, new LordJob_AssaultColony(base.Faction), map, list);
         }
         Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
         GlobalTargetInfo target  = (list.Any() ? new GlobalTargetInfo(list[0].Position, map) : GlobalTargetInfo.Invalid);
         TaggedString letterLabel = "LetterLabelPeaceTalks_Disaster".Translate();
         TaggedString letterText  = GetLetterText("LetterPeaceTalks_Disaster".Translate(base.Faction.def.pawnsPlural.CapitalizeFirst(), base.Faction.NameColored, Mathf.RoundToInt(randomInRange)), caravan, playerRelationKind);
         PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(list, ref letterLabel, ref letterText, "LetterRelatedPawnsGroupGeneric".Translate(Faction.OfPlayer.def.pawnsPlural), informEvenIfSeenBefore: true);
         Find.LetterStack.ReceiveLetter(letterLabel, letterText, LetterDefOf.ThreatBig, target, base.Faction);
     }, "GeneratingMapForNewEncounter", doAsynchronously: false, null);
 }
 private void Outcome_Disaster(Caravan caravan)
 {
     LongEventHandler.QueueLongEvent(delegate()
     {
         FactionRelationKind playerRelationKind = this.Faction.PlayerRelationKind;
         int randomInRange = DiplomacyTuning.Goodwill_PeaceTalksDisasterRange.RandomInRange;
         this.Faction.TryAffectGoodwillWith(Faction.OfPlayer, randomInRange, false, false, null, null);
         this.Faction.TrySetRelationKind(Faction.OfPlayer, FactionRelationKind.Hostile, false, null, null);
         IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatBig, caravan);
         incidentParms.faction       = this.Faction;
         PawnGroupMakerParms defaultPawnGroupMakerParms  = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(PawnGroupKindDefOf.Combat, incidentParms, true);
         defaultPawnGroupMakerParms.generateFightersOnly = true;
         List <Pawn> list = PawnGroupMakerUtility.GeneratePawns(defaultPawnGroupMakerParms, true).ToList <Pawn>();
         Map map          = CaravanIncidentUtility.SetupCaravanAttackMap(caravan, list, false);
         if (list.Any <Pawn>())
         {
             LordMaker.MakeNewLord(incidentParms.faction, new LordJob_AssaultColony(this.Faction, true, true, false, false, true), map, list);
         }
         Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
         GlobalTargetInfo target = (!list.Any <Pawn>()) ? GlobalTargetInfo.Invalid : new GlobalTargetInfo(list[0].Position, map, false);
         string label            = "LetterLabelPeaceTalks_Disaster".Translate();
         string letterText       = this.GetLetterText("LetterPeaceTalks_Disaster".Translate(new object[]
         {
             this.Faction.def.pawnsPlural.CapitalizeFirst(),
             this.Faction.Name,
             Mathf.RoundToInt((float)randomInRange)
         }), caravan, playerRelationKind);
         PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(list, ref label, ref letterText, "LetterRelatedPawnsGroupGeneric".Translate(new object[]
         {
             Faction.OfPlayer.def.pawnsPlural
         }), true, true);
         Find.LetterStack.ReceiveLetter(label, letterText, LetterDefOf.ThreatBig, target, this.Faction, null);
     }, "GeneratingMapForNewEncounter", false, null);
 }
Exemplo n.º 3
0
 private void Outcome_Disaster(Caravan caravan)
 {
     LongEventHandler.QueueLongEvent(delegate
     {
         float randomInRange = PeaceTalks.DisasterFactionRelationOffset.RandomInRange;
         base.Faction.AffectGoodwillWith(Faction.OfPlayer, randomInRange);
         if (!base.Faction.HostileTo(Faction.OfPlayer))
         {
             base.Faction.SetHostileTo(Faction.OfPlayer, true);
         }
         IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow(Find.Storyteller.def, IncidentCategory.ThreatBig, caravan);
         incidentParms.faction       = base.Faction;
         PawnGroupMakerParms defaultPawnGroupMakerParms  = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(incidentParms, true);
         defaultPawnGroupMakerParms.generateFightersOnly = true;
         List <Pawn> list = PawnGroupMakerUtility.GeneratePawns(PawnGroupKindDefOf.Normal, defaultPawnGroupMakerParms, true).ToList();
         Map map          = CaravanIncidentUtility.SetupCaravanAttackMap(caravan, list);
         if (list.Any())
         {
             LordMaker.MakeNewLord(incidentParms.faction, new LordJob_AssaultColony(base.Faction, true, true, false, false, true), map, list);
         }
         Find.TickManager.CurTimeSpeed = TimeSpeed.Paused;
         GlobalTargetInfo lookTarget   = (!list.Any()) ? GlobalTargetInfo.Invalid : new GlobalTargetInfo(list[0].Position, map, false);
         Find.LetterStack.ReceiveLetter("LetterLabelPeaceTalks_Disaster".Translate(), this.GetLetterText("LetterPeaceTalks_Disaster".Translate(base.Faction.def.pawnsPlural.CapitalizeFirst(), base.Faction.Name, Mathf.RoundToInt(randomInRange)), caravan), LetterDefOf.ThreatBig, lookTarget, null);
     }, "GeneratingMapForNewEncounter", false, null);
 }