protected override void RunInt() { Slate slate = QuestGen.slate; float points = QuestGen.slate.Get("points", 0f); GameCondition gameCondition = GameConditionMaker.MakeCondition(this.gameCondition.GetValue(slate), duration.GetValue(slate)); QuestPart_GameCondition questPart_GameCondition = new QuestPart_GameCondition(); questPart_GameCondition.gameCondition = gameCondition; List <Rule> list = new List <Rule>(); Dictionary <string, string> dictionary = new Dictionary <string, string>(); if (targetWorld.GetValue(slate)) { questPart_GameCondition.targetWorld = true; gameCondition.RandomizeSettings(points, null, list, dictionary); } else { Map map = GetMap(QuestGen.slate); questPart_GameCondition.mapParent = map.Parent; gameCondition.RandomizeSettings(points, map, list, dictionary); } questPart_GameCondition.inSignal = (QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal")); QuestGen.quest.AddPart(questPart_GameCondition); if (!storeGameConditionDescriptionFutureAs.GetValue(slate).NullOrEmpty()) { slate.Set(storeGameConditionDescriptionFutureAs.GetValue(slate), gameCondition.def.descriptionFuture); } QuestGen.AddQuestNameRules(list); QuestGen.AddQuestDescriptionRules(list); QuestGen.AddQuestDescriptionConstants(dictionary); }
private static void SupernovaUltra(IncidentParms parms) { GameConditionDef[] conditions = new GameConditionDef[5] { GameConditionDefOfLocal.BoulderMassHit, GameConditionDefOfLocal.SuperHeatWave, GameConditionDefOfLocal.Endlessday, GameConditionDefOfLocal.LeanAtmosphere, GameConditionDefOfLocal.IonizedAtmosphere }; int[] durations = new int[5] { Rand.Range(250000, 350000), Rand.Range(250000, 350000), Rand.Range(250000, 350000), -1, Rand.Range(250000, 350000) }; for (int i = 0; i < conditions.Length; i++) { parms.target.GameConditionManager.RegisterCondition(GameConditionMaker.MakeCondition(conditions[i], durations[i])); } Find.LetterStack.ReceiveLetter(Translator.Translate("Supernova_label"), Translator.Translate("SupernovaExp_ultra"), LetterDefOf.NegativeEvent); }
protected void DoConditionAndLetter(int duration, IIncidentTarget target) { Map map = (Map)target; //Cthulhu.Utility.DebugReport("Generating Map Condition"); GameCondition_AuroraEffect GameCondition = (GameCondition_AuroraEffect)GameConditionMaker.MakeCondition(CultsDefOf.Cults_Aurora, duration); string text3 = ""; //Cthulhu.Utility.DebugReport("Getting coords."); Vector2 coords = Find.WorldGrid.LongLatOf(map.Tile); if (coords.y >= 74) { text3 = "Borealis"; } else { text3 = "Australis"; } //Cthulhu.Utility.DebugReport("Getting label"); string textLabel = "LetterLabelAurora".Translate( text3 ); //Cthulhu.Utility.DebugReport("Registering Conditions"); map.GameConditionManager.RegisterCondition(GameCondition); string textDesc = "LetterIncidentAurora".Translate(); //Cthulhu.Utility.DebugReport("Sending letter"); Find.LetterStack.ReceiveLetter(textLabel, textDesc, LetterDefOf.PositiveEvent, null); map.GetComponent <MapComponent_SacrificeTracker>().lastLocation = IntVec3.Invalid; }
private static bool Prefix(GameConditionManager __instance, GameCondition cond) { var ind = ZUtils.ZTracker.GetZIndexFor(__instance.ownerMap); if (ind == 0 && !(__instance.ownerMap.Parent is MapParent_ZLevel)) { AddCondition = true; foreach (var map in ZUtils.ZTracker.GetAllMaps(__instance.ownerMap.Tile)) { if (map != __instance.ownerMap && (ZUtils.ZTracker.GetZIndexFor(map) < 0 && !blackList.Contains(cond.def) || ZUtils.ZTracker.GetZIndexFor(map) > 0)) { var newCond = GameConditionMaker.MakeCondition(cond.def, cond.Duration); newCond.conditionCauser = cond.conditionCauser; newCond.Permanent = cond.Permanent; newCond.startTick = cond.startTick; newCond.quest = cond.quest; ZLogger.Message("Register: " + newCond + " in the " + ZUtils.ZTracker.GetMapInfo(map), true); map.gameConditionManager.RegisterCondition(newCond); } } AddCondition = false; } else if (ind < 0 && (!AddCondition || blackList.Contains(cond.def))) { return(false); } else if (ind > 0 && !AddCondition) { return(false); } return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { this.ResolveArrivalPoints(parms); Map map = (Map)parms.target; PawnKindDef scp939 = PawnKindDefOf_SCP.SCP_939_PawnKindDef; if (scp939 is null) { return(false); } float num = parms.points; int num2 = GenMath.RoundRandom(num / scp939.combatPower); int numMax = Rand.RangeInclusive(15, 20); num2 = Mathf.Clamp(num2, 1, numMax); int duration = Mathf.RoundToInt(this.def.durationDays.RandomInRange * 60000); GameCondition_SCP939 cond = (GameCondition_SCP939)GameConditionMaker.MakeCondition(this.def.gameCondition, duration); cond.scp939Count = num2; parms.target.GameConditionManager.RegisterCondition(cond); Find.LetterStack.ReceiveLetter("LetterSCP939Enters".Translate().CapitalizeFirst(), "LetterSCP939EntersText".Translate(), LetterDefOf.ThreatBig); return(true); }
public override bool TryExecuteEvent() { Map map = Find.CurrentMap; //int duration = Mathf.RoundToInt(1 * 60000f); // 1 день грозы int duration = Mathf.RoundToInt(1000f); // время шторма в тиках GameConditionDef def = new GameConditionDef { conditionClass = typeof(OC_GameCondition_Storm), canBePermanent = false, preventRain = false, temperatureOffset = 0, }; OC_GameCondition_Storm storm = (OC_GameCondition_Storm)GameConditionMaker.MakeCondition(def, duration); // единственный способ вставить своё время storm.cooldown = 25; // кд в тиках между ударами string label = "Гнев зевса"; string text = ""; Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.NegativeEvent); map.gameConditionManager.RegisterCondition(storm); if (map.weatherManager.curWeather.rainRate > 0.1f) { map.weatherDecider.StartNextWeather(); } return(true); }
private void InitializeVolcanicWinter() { GameConditionManager gameConditionManager = this.gameConditionManager; int duration = Mathf.RoundToInt(this.Duration); GameCondition cond = GameConditionMaker.MakeCondition(GameConditionDefOf.VolcanicWinter, duration); gameConditionManager.RegisterCondition(cond); }
private void InitializeDeathSkies() { GameConditionManager gameConditionManager = this.gameConditionManager; int duration = Mathf.RoundToInt(this.Duration); GameCondition cond2 = GameConditionMaker.MakeCondition(TorannMagicDefOf.DarkClouds, duration); gameConditionManager.RegisterCondition(cond2); }
private void InitializeSolarFlare() { GameConditionManager gameConditionManager = this.gameConditionManager; int duration = Mathf.RoundToInt(this.Duration); GameCondition cond = GameConditionMaker.MakeCondition(GameConditionDefOf.SolarFlare, duration); gameConditionManager.RegisterCondition(cond); }
public void BeginAssaultCondition() { List <GameCondition> currentGameConditions = this.Map.gameConditionManager.ActiveConditions; WeatherDef weatherDef = new WeatherDef(); if (this.rnd < 2) //earth { if (!this.Map.GameConditionManager.ConditionIsActive(GameConditionDefOf.ToxicFallout)) { this.Map.GameConditionManager.RegisterCondition(GameConditionMaker.MakeCondition(GameConditionDefOf.ToxicFallout, 500000, 60)); } this.eventFrequencyMultiplier = 4; } else if (this.rnd < 4) //fire { for (int i = 0; i < currentGameConditions.Count; i++) { if (currentGameConditions[i].def == GameConditionDefOf.ColdSnap) { currentGameConditions[i].Duration = 0; currentGameConditions[i].End(); } } if (!this.Map.GameConditionManager.ConditionIsActive(GameConditionDefOf.HeatWave)) { this.Map.GameConditionManager.RegisterCondition(GameConditionMaker.MakeCondition(GameConditionDefOf.HeatWave, 500000, 60)); } this.eventFrequencyMultiplier = .5f; this.areaRadius = 2; } else if (this.rnd < 6) //water { for (int i = 0; i < currentGameConditions.Count; i++) { if (currentGameConditions[i].def == GameConditionDefOf.HeatWave) { currentGameConditions[i].Duration = 0; currentGameConditions[i].End(); } } if (!this.Map.GameConditionManager.ConditionIsActive(GameConditionDefOf.ColdSnap)) { this.Map.GameConditionManager.RegisterCondition(GameConditionMaker.MakeCondition(GameConditionDefOf.ColdSnap, 500000, 60)); } weatherDef = WeatherDef.Named("SnowHard"); this.Map.weatherManager.TransitionTo(weatherDef); this.eventFrequencyMultiplier = .5f; this.areaRadius = 3; } else //air { weatherDef = WeatherDef.Named("RainyThunderstorm"); this.Map.weatherManager.TransitionTo(weatherDef); this.eventFrequencyMultiplier = .4f; this.areaRadius = 2; } }
private void ChangeIncident() { GameConditionDef def = incidents.RandomElement(); foreach (var map in AffectedMaps) { map.gameConditionManager.RegisterCondition(GameConditionMaker.MakeCondition(def, Rand.Range(4000, 18000))); } }
protected override bool TryExecuteWorker(IncidentParms parms) { GameConditionManager gameConditionManager = parms.target.GameConditionManager; GameCondition cond = GameConditionMaker.MakeCondition(this.def.gameCondition, Ticks, 0); gameConditionManager.RegisterCondition(cond); base.SendStandardLetter(); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { GameConditionManager gameConditionManager = parms.target.GameConditionManager; int duration = Mathf.RoundToInt(base.def.durationDays.RandomInRange * 60000f); GameCondition cond = GameConditionMaker.MakeCondition(base.def.gameCondition, duration, 0); gameConditionManager.RegisterCondition(cond); //base.SendStandardLetter(); //it's that easy! return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; SettlementBase settlementBase = Find.WorldObjects.ObjectsAt(map.Tile).OfType <SettlementBase>().First(); int duration = Mathf.RoundToInt(this.def.durationDays.RandomInRange * GenDate.TicksPerDay); GameCondition cond = GameConditionMaker.MakeCondition(this.def.gameCondition, duration, 0); map.gameConditionManager.RegisterCondition(cond); Find.LetterStack.ReceiveLetter("LetterLabelNewElection".Translate(settlementBase.Label), "LetterNewElection".Translate(settlementBase.Label), LetterDefOf.PositiveEvent, new TargetInfo(map.Center, map, false), null); return(true); }
public static GameCondition CreateConditionOn2(CompCauseGameCondition __instance, Map map) { GameCondition gameCondition = GameConditionMaker.MakeCondition(__instance.ConditionDef); gameCondition.Duration = gameCondition.TransitionTicks; gameCondition.conditionCauser = __instance.parent; map.gameConditionManager.RegisterCondition(gameCondition); causedConditions(__instance).Add(map, gameCondition); SetupCondition2(gameCondition, map); return(gameCondition); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; Find.LetterStack.ReceiveLetter(this.def.letterLabel, def.letterText, LetterDefOf.NeutralEvent); //parms.customLetterDef = LetterDefOf.NeutralEvent; //parms.customLetterLabel = this.def.letterLabel; //parms.customLetterText = def.letterText; map.gameConditionManager.RegisterCondition(GameConditionMaker.MakeCondition(DefDatabase <GameConditionDef> .GetNamed("BlueSnowCondition"))); //return base.TryExecuteWorker(parms); return(true); }
public override void PostMapGenerate(Map map) { base.PostMapGenerate(map); List <Thing> list = map.listerThings.ThingsInGroup(ThingRequestGroup.Plant).ToList <Thing>(); foreach (Thing thing in list) { thing.Destroy(DestroyMode.Vanish); } GameCondition gameCondition = GameConditionMaker.MakeCondition(GameConditionDef.Named("RD_Radiation"), 3000000); map.gameConditionManager.RegisterCondition(gameCondition); }
public override void Generate(Map map, GenStepParams parms) { base.Generate(map, parms); this.baseResolveParams.rect = new CellRect(0, 0, map.Size.x, map.Size.z); BaseGen.symbolStack.Push("toxicFalloutCityBaseLGE", this.baseResolveParams); BaseGen.Generate(); //after generation spawn permanent toxic fallout GameCondition falloutCondition = GameConditionMaker.MakeCondition(GameConditionDefOf.ToxicFallout); falloutCondition.Permanent = true; map.GameConditionManager.RegisterCondition(falloutCondition); }
private void InitializeDarkStorms() { GameConditionManager gameConditionManager = base.CasterPawn.Map.gameConditionManager; int duration = 45000; GameCondition cond = GameConditionMaker.MakeCondition(TorannMagicDefOf.DarkThunderstorm, duration); gameConditionManager.RegisterCondition(cond); GameCondition_DarkThunderstorm gcdt = cond as GameCondition_DarkThunderstorm; if (gcdt != null) { gcdt.faction = base.CasterPawn.Faction; } }
public static bool CreateConditionOn(CompCauseGameCondition __instance, ref GameCondition __result, Map map) { GameCondition gameCondition = GameConditionMaker.MakeCondition(__instance.ConditionDef); gameCondition.Duration = gameCondition.TransitionTicks; gameCondition.conditionCauser = __instance.parent; map.gameConditionManager.RegisterCondition(gameCondition); lock (__instance) { causedConditionsFieldRef(__instance).Add(map, gameCondition); } gameCondition.suppressEndMessage = true; __result = gameCondition; return(false); }
protected override bool TryExecuteWorker(IncidentParms parms) { if (!settings.Active) { return(false); } GameConditionManager gameConditionManager = parms.target.GameConditionManager; int duration = Mathf.RoundToInt(def.durationDays.RandomInRange * 60000f); GameCondition cond = GameConditionMaker.MakeCondition(def.gameCondition, duration); gameConditionManager.RegisterCondition(cond); SendStandardLetter(parms, null); return(true); }
public void DetonateBomb() { RemoveAfterLeave = true; var condition = GameConditionMaker.MakeCondition(GameConditionDefOfLocal.ClimateChaos, Rand.Range(15, 25) * 60000); Find.World.gameConditionManager.RegisterCondition(condition); Find.LetterStack.ReceiveLetter(GameConditionDefOfLocal.ClimateChaos.label, GameConditionDefOfLocal.ClimateChaos.description, LetterDefOf.NegativeEvent); if (HasMap) { Bomb.Detonate(); } else { Find.WorldObjects.Remove(this); } }
private static void SupernovaMedium(IncidentParms parms) { GameConditionDef[] conditions = new GameConditionDef[2] { GameConditionDefOf.HeatWave, GameConditionDefOfLocal.BoulderMassHit }; int[] durations = new int[2] { Rand.Range(10000, 50000), Rand.Range(15000, 50000) }; for (int i = 0; i < conditions.Length; i++) { parms.target.GameConditionManager.RegisterCondition(GameConditionMaker.MakeCondition(conditions[i], durations[i])); } Find.LetterStack.ReceiveLetter(Translator.Translate("Supernova_label"), Translator.Translate("SupernovaExp_medium"), LetterDefOf.NeutralEvent); }
public override void Execute() { List <Map> maps = Current.Game.Maps; foreach (Map map in maps) { if (!map.IsPlayerHome || map.GameConditionManager.ConditionIsActive(GameConditionDefOf.Sanctuary)) { continue; } map.GameConditionManager.RegisterCondition(GameConditionMaker.MakeCondition(GameConditionDefOf.Sanctuary, Rand.Range(2, 6) * 60000)); } Viewer.Charge(storeIncident); Find.LetterStack.ReceiveLetter("TKUtils.SanctuaryLetter.Title".Localize(), "TKUtils.SanctuaryLetter.Description".Localize(), LetterDefOf.PositiveEvent); MessageHelper.SendConfirmation(Viewer.username, "TKUtils.Sanctuary.Complete".Localize()); }
public override void MapComponentTick() { if (Severity > 0.1) // TODO: optimize { if (!map.GameConditionManager.ConditionIsActive(CultsDefOf.Cults_GameCondition_ResidualEnergy)) { map.GameConditionManager.RegisterCondition(GameConditionMaker.MakeCondition(CultsDefOf.Cults_GameCondition_ResidualEnergy)); } } else { GameCondition_ResidualEnergy condition = map.GameConditionManager.GetActiveCondition <GameCondition_ResidualEnergy>(); condition?.End(); } if (counter++ % Tick.hour == 0) { severity -= dispersePerHour; } }
public override void CompTickRare() { base.CompTickRare(); if (!LoadedModManager.GetMod <MonsterHunterRimworldMod>().GetSettings <MonsterHunterRimworldModSettings>().elderDragonWeatherEffects) { return; } if (!(parent is Pawn elderDragon)) { return; } if (!WyvernUtility.IsElderDragon(elderDragon)) { return; } if (elderDragon.Dead) { return; } Map map = elderDragon.Map; if (map == null) { return; } GameConditionManager gameConditionManager = map.GameConditionManager; if (gameConditionManager.ConditionIsActive(GameConditionDefOf.ToxicFallout)) { return; } int duration = Mathf.RoundToInt(0.5f * 60000f); // lasts half a day after elder dragon dies GameCondition cond = GameConditionMaker.MakeCondition(GameConditionDefOf.ToxicFallout, duration); gameConditionManager.RegisterCondition(cond); }
public override void Execute(int amount, string boughtBy) { GameConditionDef conditionDef = DefDatabase <GameConditionDef> .GetNamed(defName); String notificationMessage; // I hope no viewer uses RC with the name "Poll" if (boughtBy == "Poll") { notificationMessage = $"<color=#9147ff>By popular opinion</color>, your channel has triggered {defLabel} for a whole day! Let's hope you get out the other side"; } else { notificationMessage = $"<color=#9147ff>{boughtBy}</color> purchased {defLabel} for a whole day! Let's hope you get out the other side"; } Map map = Find.CurrentMap; GameCondition gameCondition = GameConditionMaker.MakeCondition(conditionDef, 60000); map.gameConditionManager.RegisterCondition(gameCondition); AlertManager.BadEventNotification(notificationMessage); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; map.weatherManager.TransitionTo(WeatherDef.Named("VomitRain")); int duration = Mathf.RoundToInt(this.def.durationDays.RandomInRange * 60000f); GameCondition_VomitRain gameCondition_VomitRain = (GameCondition_VomitRain)GameConditionMaker.MakeCondition(GameConditionDef.Named("VomitRain"), duration); map.gameConditionManager.RegisterCondition(gameCondition_VomitRain); base.SendStandardLetter(parms, new TargetInfo(gameCondition_VomitRain.centerLocation.ToIntVec3, map, false)); if (map.weatherManager.curWeather.rainRate > 0.1f) { map.weatherDecider.StartNextWeather(); } return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { bool tempAllow = false; Map map = (Map)parms.target; MagicMapComponent mmc = map.GetComponent <MagicMapComponent>(); if (mmc != null && mmc.allowAllIncidents) { tempAllow = true; } ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef(); if (settingsRef.demonAssaultChallenge > 0 || tempAllow) { string str = ""; int duration = Mathf.RoundToInt(this.def.durationDays.RandomInRange * 60000f); List <Faction> lichFaction = Find.FactionManager.AllFactions.ToList(); bool factionFlag = false; for (int i = 0; i < lichFaction.Count; i++) { if (lichFaction[i].def.defName == "TM_SkeletalFaction") { Faction.OfPlayer.TrySetRelationKind(lichFaction[i], FactionRelationKind.Hostile, false, null, null); factionFlag = true; } } if (!factionFlag) { return(false); } TM_Action.ForceFactionDiscoveryAndRelation(TorannMagicDefOf.TM_SkeletalFaction); GameCondition_DemonAssault gameCondition_DemonAssault = (GameCondition_DemonAssault)GameConditionMaker.MakeCondition(GameConditionDef.Named("DemonAssault"), duration); map.gameConditionManager.RegisterCondition(gameCondition_DemonAssault); base.SendStandardLetter(parms, gameCondition_DemonAssault.lookTarget, str); //base.SendStandardLetter(new TargetInfo(gameCondition_ElementalAssault.centerLocation.ToIntVec3, map, false), null, new string[0]); return(true); } else { return(false); } }
protected override bool TryExecuteWorker(IncidentParms parms) { ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef(); if (settingsRef.riftChallenge > 0) { Map map = (Map)parms.target; int duration = Mathf.RoundToInt(this.def.durationDays.RandomInRange * 60000f); GameCondition_ElementalAssault gameCondition_ElementalAssault = (GameCondition_ElementalAssault)GameConditionMaker.MakeCondition(GameConditionDef.Named("ElementalAssault"), duration, 0); map.gameConditionManager.RegisterCondition(gameCondition_ElementalAssault); base.SendStandardLetter(new TargetInfo(gameCondition_ElementalAssault.centerLocation.ToIntVec3, map, false), null, new string[0]); return(true); } else { return(false); } }