protected override bool CanFireNowSub(IncidentParms parms) { var map = (Map)parms.target; return(parms.faction != null || CandidateFactions(map).Any() || !NeutralGroupIncidentUtility.AnyBlockingHostileLord(map, parms.faction)); }
protected override bool CanFireNowSub(IncidentParms parms) { if (!base.CanFireNowSub(parms)) { return(false); } Map map = (Map)parms.target; return(parms.faction == null || !NeutralGroupIncidentUtility.AnyBlockingHostileLord(map, parms.faction)); }
protected override bool FactionCanBeGroupSource(Faction f, Map map, bool desperate = false) { return(!f.IsPlayer && !f.defeated && (desperate || f.def.allowedArrivalTemperatureRange.Includes(map.mapTemperature.OutdoorTemp) && f.def.allowedArrivalTemperatureRange.Includes(map.mapTemperature.SeasonalTemp) ) && !f.def.hidden && !f.HostileTo(Faction.OfPlayer) && !NeutralGroupIncidentUtility.AnyBlockingHostileLord(map, f)); }
public override IEnumerable <FloatMenuOption> GetRoyalAidOptions(Map map, Pawn pawn, Faction faction) { if (faction.HostileTo(Faction.OfPlayer)) { yield return(new FloatMenuOption(def.LabelCap + ": " + "CommandCallRoyalAidFactionHostile".Translate(faction.Named("FACTION")), null)); yield break; } if (!faction.def.allowedArrivalTemperatureRange.ExpandedBy(-4f).Includes(pawn.MapHeld.mapTemperature.SeasonalTemp)) { yield return(new FloatMenuOption(def.LabelCap + ": " + "BadTemperature".Translate(), null)); yield break; } if (NeutralGroupIncidentUtility.AnyBlockingHostileLord(pawn.MapHeld, faction)) { yield return(new FloatMenuOption(def.LabelCap + ": " + "HostileVisitorsPresent".Translate(), null)); yield break; } int permitLastUsedTick = pawn.royalty.GetPermitLastUsedTick(def); int num = Math.Max(GenTicks.TicksGame - permitLastUsedTick, 0); Action action = null; bool num2 = permitLastUsedTick < 0 || num >= def.CooldownTicks; int numTicks = (permitLastUsedTick > 0) ? Math.Max(def.CooldownTicks - num, 0) : 0; string t = def.LabelCap + ": "; if (num2) { t += "CommandCallRoyalAidFreeOption".Translate(); action = delegate { CallAid(pawn, map, faction, free: true); }; } else { if (pawn.royalty.GetFavor(faction) >= def.royalAid.favorCost) { action = delegate { CallAid(pawn, map, faction, free: false); }; } t += "CommandCallRoyalAidFavorOption".Translate(numTicks.TicksToDays().ToString("0.0"), def.royalAid.favorCost, faction.Named("FACTION")); } yield return(new FloatMenuOption(t, action, faction.def.FactionIcon, faction.Color)); }
public static DiaOption RequestStrongQuickReactionReinforcements(Map map, Faction faction, Pawn negotiator) { int silverToPay = 900; int goodWillNeeded = 25; string text = "RequestHeavyPaidMilitaryAidRH".Translate(silverToPay); DiaOption result; if (faction.PlayerRelationKind != FactionRelationKind.Ally && faction.PlayerGoodwill < goodWillNeeded) { DiaOption diaOption = new DiaOption(text); diaOption.Disable("NeedGoodwill".Translate(goodWillNeeded.ToString("F0"))); result = diaOption; } else if (ReinforcementDialogMakerRC.AmountSendableSilver(map) < silverToPay) { DiaOption diaOption3 = new DiaOption(text); diaOption3.Disable("NeedSilverLaunchable".Translate(silverToPay.ToString())); result = diaOption3; } else if (!faction.def.allowedArrivalTemperatureRange.ExpandedBy(-4f).Includes(map.mapTemperature.SeasonalTemp)) { DiaOption diaOption2 = new DiaOption(text); diaOption2.Disable("BadTemperature".Translate()); result = diaOption2; } else { int num = faction.lastMilitaryAidRequestTick + 90000 - Find.TickManager.TicksGame; if (num > 0) { DiaOption diaOption3 = new DiaOption(text); diaOption3.Disable("WaitTime".Translate(num.ToStringTicksToPeriod())); result = diaOption3; } else if (NeutralGroupIncidentUtility.AnyBlockingHostileLord(map, faction)) { DiaOption diaOption4 = new DiaOption(text); diaOption4.Disable("HostileVisitorsPresent".Translate()); result = diaOption4; } else { DiaOption diaOption5 = new DiaOption(text); IEnumerable <Faction> source = (from x in map.attackTargetsCache.TargetsHostileToColony where GenHostility.IsActiveThreatToPlayer(x) select((Thing)x).Faction into x where x != null && !x.HostileTo(faction) select x).Distinct <Faction>(); if (source.Any <Faction>()) { DiaNode diaNode = new DiaNode("MilitaryAidConfirmMutualEnemy".Translate(faction.Name, (from fa in source select fa.Name).ToCommaList(true))); DiaOption diaOption6 = new DiaOption("CallConfirm".Translate()) { action = delegate() { ReinforcementDialogMakerRC.CallForStrongAid(map, faction); }, resolveTree = true }; DiaOption diaOption7 = new DiaOption("CallCancel".Translate()) { linkLateBind = ReinforcementDialogMakerRC.ResetToRoot(faction, negotiator) }; diaNode.options.Add(diaOption6); diaNode.options.Add(diaOption7); diaOption5.link = diaNode; } else { diaOption5.action = delegate() { TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, silverToPay, map, null); ReinforcementDialogMakerRC.CallForStrongAid(map, faction); }; diaOption5.resolveTree = true; } result = diaOption5; } } return(result); }