protected override string GetLetterText(Pawn anyPawn, IncidentParms parms) { Caravan caravan = parms.target as Caravan; return(string.Format(def.letterText, (caravan != null) ? caravan.Name : "yourCaravan".TranslateSimple(), anyPawn.GetKindLabelPlural()).CapitalizeFirst()); }
protected abstract string GetLetterText(IncidentParms parms, List <Pawn> pawns);
protected abstract void ResolveRaidPoints(IncidentParms parms);
protected override void ResolveParmsPoints(IncidentParms parms) { parms.points = TraderCaravanUtility.GenerateGuardPoints(); IncidentParmsUtility.AdjustPointsForGroupArrivalParams(parms); }
public abstract void ResolveRaidStrategy(IncidentParms parms, PawnGroupKindDef groupKind);
protected override string GetRelatedPawnsInfoLetterText(IncidentParms parms) { return("LetterRelatedPawnsRaidFriendly".Translate(Faction.OfPlayer.def.pawnsPlural, parms.faction.def.pawnsPlural)); }
protected override bool CanFireNowSub(IncidentParms parms) { Faction faction; return(CaravanIncidentUtility.CanFireIncidentWhichWantsToGenerateMapAt(parms.target.Tile) && PawnGroupMakerUtility.TryGetRandomFactionForCombatPawnGroup(parms.points, out faction, null, false, false, false, true)); }
protected IEnumerable <IncidentDef> UsableIncidentsInCategory(IncidentCategoryDef cat, IncidentParms parms) { return(this.UsableIncidentsInCategory(cat, (IncidentDef x) => parms)); }
protected abstract IEnumerable <Pawn> ActualVictims(IncidentParms parms);
protected override bool CanFireNowSub(IncidentParms parms) { Map map = (Map)parms.target; return(this.Candidates(map).Any <Pawn>()); }
public override void Arrive(List <Pawn> pawns, IncidentParms parms) { PawnsArrivalModeWorkerUtility.DropInDropPodsNearSpawnCenter(parms, pawns); }
public override void Arrive(List <Pawn> pawns, IncidentParms parms) { }
public override bool TryResolveRaidSpawnCenter(IncidentParms parms) { return(true); }
protected override LordJob CreateLordJob(List <Pawn> generatedPawns, IncidentParms parms) { return(new LordJob_AssaultColony(parms.faction, canKidnap: true, canTimeoutOrFlee: false)); }
// Token: 0x06000EA7 RID: 3751 RVA: 0x0006C290 File Offset: 0x0006A690 protected override bool CanFireNowSub(IncidentParms parms) { Map map = (Map)parms.target; return(map.listerThings.ThingsOfDef(this.def.shipPart).Count <= 0); }
protected override bool CanFireNowSub(IncidentParms parms) { return(this.PotentialVictims(parms.target).Any <Pawn>()); }
protected override string GetLetterLabel(IncidentParms parms) { return(parms.raidStrategy.letterLabelFriendly + ": " + parms.faction.Name); }
protected override bool CanFireNowSub(IncidentParms parms) { Faction faction; return(base.CanFireNowSub(parms) && PawnGroupMakerUtility.TryGetRandomFactionForCombatPawnGroup(parms.points, out faction, null, false, false, false, true)); }
private static DiaOption RequestTraderOption(Map map, Faction faction, Pawn negotiator) { TaggedString taggedString = "RequestTrader".Translate(15); if (faction.PlayerRelationKind != FactionRelationKind.Ally) { DiaOption diaOption = new DiaOption(taggedString); diaOption.Disable("MustBeAlly".Translate()); return(diaOption); } if (!faction.def.allowedArrivalTemperatureRange.ExpandedBy(-4f).Includes(map.mapTemperature.SeasonalTemp)) { DiaOption diaOption2 = new DiaOption(taggedString); diaOption2.Disable("BadTemperature".Translate()); return(diaOption2); } int num = faction.lastTraderRequestTick + 240000 - Find.TickManager.TicksGame; if (num > 0) { DiaOption diaOption3 = new DiaOption(taggedString); diaOption3.Disable("WaitTime".Translate(num.ToStringTicksToPeriod())); return(diaOption3); } DiaOption diaOption4 = new DiaOption(taggedString); DiaNode diaNode = new DiaNode("TraderSent".Translate(faction.leader).CapitalizeFirst()); diaNode.options.Add(OKToRoot(faction, negotiator)); DiaNode diaNode2 = new DiaNode("ChooseTraderKind".Translate(faction.leader)); foreach (TraderKindDef item in faction.def.caravanTraderKinds.Where((TraderKindDef x) => x.requestable)) { TraderKindDef localTk = item; DiaOption diaOption5 = new DiaOption(localTk.LabelCap); if (localTk.TitleRequiredToTrade != null && (negotiator.royalty == null || localTk.TitleRequiredToTrade.seniority > negotiator.GetCurrentTitleSeniorityIn(faction))) { DiaNode diaNode3 = new DiaNode("TradeCaravanRequestDeniedDueTitle".Translate(negotiator.Named("NEGOTIATOR"), localTk.TitleRequiredToTrade.GetLabelCapFor(negotiator).Named("TITLE"), faction.Named("FACTION"))); DiaOption diaOption6 = new DiaOption("GoBack".Translate()); diaNode3.options.Add(diaOption6); diaOption5.link = diaNode3; diaOption6.link = diaNode2; } else { diaOption5.action = delegate { IncidentParms parms = new IncidentParms { target = map, faction = faction, traderKind = localTk, forced = true }; Find.Storyteller.incidentQueue.Add(IncidentDefOf.TraderCaravanArrival, Find.TickManager.TicksGame + 120000, parms, 240000); faction.lastTraderRequestTick = Find.TickManager.TicksGame; faction.TryAffectGoodwillWith(Faction.OfPlayer, -15, canSendMessage: false, canSendHostilityLetter: true, "GoodwillChangedReason_RequestedTrader".Translate()); }; diaOption5.link = diaNode; } diaNode2.options.Add(diaOption5); } DiaOption diaOption7 = new DiaOption("GoBack".Translate()); diaOption7.linkLateBind = ResetToRoot(faction, negotiator); diaNode2.options.Add(diaOption7); diaOption4.link = diaNode2; return(diaOption4); }
protected override LordJob CreateLordJob(List <Pawn> generatedPawns, IncidentParms parms) { return(new LordJob_AssaultColony(parms.faction, true, false, false, false, true)); }
protected override bool TryExecuteWorker(IncidentParms parms) { parms.points *= IncidentWorker_CaravanDemand.IncidentPointsFactorRange.RandomInRange; Caravan caravan = (Caravan)parms.target; if (!PawnGroupMakerUtility.TryGetRandomFactionForCombatPawnGroup(parms.points, out parms.faction, null, false, false, false, true)) { return(false); } List <ThingCount> demands = this.GenerateDemands(caravan); if (demands.NullOrEmpty <ThingCount>()) { return(false); } PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(PawnGroupKindDefOf.Combat, parms, false); defaultPawnGroupMakerParms.generateFightersOnly = true; defaultPawnGroupMakerParms.dontUseSingleUseRocketLaunchers = true; List <Pawn> attackers = PawnGroupMakerUtility.GeneratePawns(defaultPawnGroupMakerParms, true).ToList <Pawn>(); if (attackers.Count == 0) { Log.Error(string.Concat(new object[] { "Caravan demand incident couldn't generate any enemies even though min points have been checked. faction=", defaultPawnGroupMakerParms.faction, "(", (defaultPawnGroupMakerParms.faction == null) ? "null" : defaultPawnGroupMakerParms.faction.def.ToString(), ") parms=", parms }), false); return(false); } CameraJumper.TryJumpAndSelect(caravan); DiaNode diaNode = new DiaNode(this.GenerateMessageText(parms.faction, attackers.Count, demands, caravan)); DiaOption diaOption = new DiaOption("CaravanDemand_Give".Translate()); diaOption.action = delegate { this.ActionGive(caravan, demands, attackers); }; diaOption.resolveTree = true; diaNode.options.Add(diaOption); DiaOption diaOption2 = new DiaOption("CaravanDemand_Fight".Translate()); diaOption2.action = delegate { this.ActionFight(caravan, attackers); }; diaOption2.resolveTree = true; diaNode.options.Add(diaOption2); string text = "CaravanDemandTitle".Translate(parms.faction.Name); WindowStack arg_202_0 = Find.WindowStack; DiaNode nodeRoot = diaNode; Faction faction = parms.faction; bool delayInteractivity = true; string title = text; arg_202_0.Add(new Dialog_NodeTreeWithFactionInfo(nodeRoot, faction, delayInteractivity, false, title)); Find.Archive.Add(new ArchivedDialog(diaNode.text, text, parms.faction)); return(true); }
protected override string GetLetterText(Pawn anyPawn, IncidentParms parms) { Caravan caravan = parms.target as Caravan; return(string.Format(this.def.letterText, (caravan == null) ? "yourCaravan".Translate() : caravan.Name, parms.faction.def.pawnsPlural, parms.faction.Name).CapitalizeFirst()); }
protected abstract bool TryResolveRaidFaction(IncidentParms parms);
protected abstract void DoConditionAndLetter(IncidentParms parms, Map map, int duration, Gender gender, float points);
protected abstract string GetLetterLabel(IncidentParms parms);
// Token: 0x06000E54 RID: 3668 RVA: 0x0006B310 File Offset: 0x00069710 protected override bool CanFireNowSub(IncidentParms parms) { Map map = (Map)parms.target; return(!map.gameConditionManager.ConditionIsActive(OGGameConditionDefOf.OG_Warpstorm)); }
protected abstract string GetRelatedPawnsInfoLetterText(IncidentParms parms);
public static IncidentParms DefaultParmsNow(StorytellerDef tellerDef, IncidentCategory incCat, IIncidentTarget target) { IncidentParms incidentParms = new IncidentParms(); incidentParms.target = target; if (incCat == IncidentCategory.ThreatSmall || incCat == IncidentCategory.ThreatBig || incCat == IncidentCategory.RaidBeacon) { float num = target.PlayerWealthForStoryteller; num -= 2000f; num = Mathf.Max(num, 0f); float num2 = num / 1000f * 10f; float num3 = 0f; foreach (Pawn current in target.FreeColonistsForStoryteller) { float num4 = 1f; if (current.ParentHolder != null && current.ParentHolder is Building_CryptosleepCasket) { num4 *= 0.3f; } num4 = Mathf.Lerp(num4, num4 * current.health.summaryHealth.SummaryHealthPercent, 0.5f); num3 += 42f * num4; } incidentParms.points = num2 + num3; incidentParms.points *= Find.StoryWatcher.watcherRampUp.TotalThreatPointsFactor; incidentParms.points *= Find.Storyteller.difficulty.threatScale; incidentParms.points *= target.IncidentPointsRandomFactorRange.RandomInRange; switch (Find.StoryWatcher.statsRecord.numThreatBigs) { case 0: incidentParms.points = 35f; incidentParms.raidForceOneIncap = true; incidentParms.raidNeverFleeIndividual = true; break; case 1: incidentParms.points *= 0.5f; break; case 2: incidentParms.points *= 0.7f; break; case 3: incidentParms.points *= 0.8f; break; case 4: incidentParms.points *= 0.9f; break; default: incidentParms.points *= 1f; break; } if (incidentParms.points < 0f) { incidentParms.points = 0f; } if (incidentParms.points > 1000f) { if (incidentParms.points > 2000f) { incidentParms.points = 2000f + (incidentParms.points - 2000f) * 0.5f; } incidentParms.points = 1000f + (incidentParms.points - 1000f) * 0.5f; } } return(incidentParms); }
protected override bool TryExecuteWorker(IncidentParms parms) { ResolveRaidPoints(parms); if (!TryResolveRaidFaction(parms)) { return(false); } PawnGroupKindDef combat = PawnGroupKindDefOf.Combat; ResolveRaidStrategy(parms, combat); ResolveRaidArriveMode(parms); parms.raidStrategy.Worker.TryGenerateThreats(parms); if (!parms.raidArrivalMode.Worker.TryResolveRaidSpawnCenter(parms)) { return(false); } parms.points = AdjustedRaidPoints(parms.points, parms.raidArrivalMode, parms.raidStrategy, parms.faction, combat); List <Pawn> list = parms.raidStrategy.Worker.SpawnThreats(parms); if (list == null) { list = PawnGroupMakerUtility.GeneratePawns(IncidentParmsUtility.GetDefaultPawnGroupMakerParms(combat, parms)).ToList(); if (list.Count == 0) { Log.Error("Got no pawns spawning raid from parms " + parms); return(false); } parms.raidArrivalMode.Worker.Arrive(list, parms); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Points = " + parms.points.ToString("F0")); foreach (Pawn item in list) { string str = (item.equipment != null && item.equipment.Primary != null) ? item.equipment.Primary.LabelCap : "unarmed"; stringBuilder.AppendLine(item.KindLabel + " - " + str); } TaggedString letterLabel = GetLetterLabel(parms); TaggedString letterText = GetLetterText(parms, list); PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(list, ref letterLabel, ref letterText, GetRelatedPawnsInfoLetterText(parms), informEvenIfSeenBefore: true); List <TargetInfo> list2 = new List <TargetInfo>(); if (parms.pawnGroups != null) { List <List <Pawn> > list3 = IncidentParmsUtility.SplitIntoGroups(list, parms.pawnGroups); List <Pawn> list4 = list3.MaxBy((List <Pawn> x) => x.Count); if (list4.Any()) { list2.Add(list4[0]); } for (int i = 0; i < list3.Count; i++) { if (list3[i] != list4 && list3[i].Any()) { list2.Add(list3[i][0]); } } } else if (list.Any()) { foreach (Pawn item2 in list) { list2.Add(item2); } } SendStandardLetter(letterLabel, letterText, GetLetterDef(), parms, list2); parms.raidStrategy.Worker.MakeLords(parms, list); LessonAutoActivator.TeachOpportunity(ConceptDefOf.EquippingWeapons, OpportunityType.Critical); if (!PlayerKnowledgeDatabase.IsComplete(ConceptDefOf.ShieldBelts)) { for (int j = 0; j < list.Count; j++) { if (list[j].apparel.WornApparel.Any((Apparel ap) => ap is ShieldBelt)) { LessonAutoActivator.TeachOpportunity(ConceptDefOf.ShieldBelts, OpportunityType.Critical); break; } } } return(true); }
protected override void SendAmbushLetter(Pawn anyPawn, IncidentParms parms) { base.SendStandardLetter(anyPawn, parms.faction.def.pawnsPlural, parms.faction.Name); }