public override bool IsPossible() { List <string> animals = new List <string>() { "Bear_Grizzly", "Bear_Polar", "Rhinoceros", "Elephant", "Megasloth", "Thrumbo" }; animals.Shuffle(); ThingDef def = ThingDef.Named(animals[0]); float averagePower = 0; if (def != null && def.race != null) { foreach (Tool t in def.tools) { averagePower += t.power; } averagePower = averagePower / def.tools.Count; } float animalCount = 2.5f; if (averagePower > 18) { animalCount = 2.0f; } worker = new IncidentWorker_SpecificAnimalsWanderIn("TwitchStoriesLetterLabelPredators", PawnKindDef.Named(animals[0]), false, (int)animalCount, true, true); worker.def = IncidentDef.Named("HerdMigration"); parms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatBig, target); return(worker.CanFireNow(parms)); }
public override bool IsPossible(string message, Viewer viewer, bool separateChannel = false) { this.separateChannel = separateChannel; this.viewer = viewer; string[] command = message.Split(' '); if (command.Length < 4) { Toolkit.client.SendMessage($"@{viewer.username} syntax is {this.storeIncident.syntax}", separateChannel); return(false); } if (!VariablesHelpers.PointsWagerIsValid( command[3], viewer, ref pointsWager, ref storeIncident, separateChannel )) { return(false); } string animalKind = command[2].ToLower(); List <PawnKindDef> allAnimals = DefDatabase <PawnKindDef> .AllDefs.Where( s => s.RaceProps.Animal && string.Join("", s.defName.Split(' ')).ToLower() == animalKind ).ToList(); if (allAnimals.Count < 1) { Toolkit.client.SendMessage($"@{viewer.username} no animal {animalKind} found.", separateChannel); return(false); } target = Current.Game.AnyPlayerHomeMap; if (target == null) { return(false); } float points = IncidentHelper_PointsHelper.RollProportionalGamePoints(storeIncident, pointsWager, StorytellerUtility.DefaultThreatPointsNow(target)); pawnKind = allAnimals[0]; int num = ManhunterPackIncidentUtility.GetAnimalsCount(pawnKind, points); worker = new IncidentWorker_SpecificAnimalsWanderIn(null, pawnKind, true, num, false, true); worker.def = IncidentDef.Named("FarmAnimalsWanderIn"); float defaultThreatPoints = StorytellerUtility.DefaultSiteThreatPointsNow(); parms = StorytellerUtility.DefaultParmsNow(worker.def.category, target); parms.points = points; return(worker.CanFireNow(parms)); }
private void TryExecuteAnimal(ThingDef animal, int count) { string letter = Helper.ReplacePlaceholder("TwitchStoriesDescription80".Translate(), from: Viewer.username, amount: quantity.ToString(), item: item.abr.CapitalizeFirst()); IncidentWorker worker = new IncidentWorker_SpecificAnimalsWanderIn(animal.LabelCap + "'s join", PawnKindDef.Named(animal.defName), true, count, false, true); worker.def = IncidentDef.Named("FarmAnimalsWanderIn"); worker.TryExecute(StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.Misc, Helper.AnyPlayerMap)); EndCarePackage(); }
public override bool IsPossible() { PawnKindDef animalKind = PawnKindDef.Named("YorkshireTerrier"); int num = AnimalsCount.RandomInRange; worker = new IncidentWorker_SpecificAnimalsWanderIn(null, animalKind, true, num, false, true); worker.def = IncidentDef.Named("SelfTame"); parms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.Misc, target); return(worker.CanFireNow(parms)); }
public override bool IsPossible() { PawnKindDef animalKind = PawnKindDef.Named("YorkshireTerrier"); int num = AnimalsCount.RandomInRange; num = Mathf.Max(num, Mathf.CeilToInt(4f / animalKind.RaceProps.baseBodySize)); worker = new IncidentWorker_SpecificAnimalsWanderIn(null, animalKind, true, num, false, true); worker.def = IncidentDef.Named("FarmAnimalsWanderIn"); Map map = Helper.AnyPlayerMap; if (map != null) { parms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.Misc, map); return(worker.CanFireNow(parms)); } return(false); }
public override bool IsPossible() { PawnKindDef animalKind = PawnKindDef.Named("YorkshireTerrier"); int num = AnimalsCount.RandomInRange; num = Mathf.Max(num, Mathf.CeilToInt(4f / animalKind.RaceProps.baseBodySize)); worker = new IncidentWorker_SpecificAnimalsWanderIn(null, animalKind, true, num, false, true); worker.def = IncidentDef.Named("FarmAnimalsWanderIn"); parms = new IncidentParms(); List <Map> allMaps = Current.Game.Maps; foreach (Map map in allMaps) { parms.target = map; if (worker.CanFireNow(parms)) { return(true); } } return(false); }
public override bool IsPossible(string message, Viewer viewer, bool separateChannel = false) { this.separateChannel = separateChannel; this.Viewer = viewer; string[] command = message.Split(' '); if (command.Length < 3) { VariablesHelpers.ViewerDidWrongSyntax(viewer.username, storeIncident.syntax); return(false); } if (!VariablesHelpers.PointsWagerIsValid( command[2], viewer, ref pointsWager, ref storeIncident, separateChannel )) { return(false); } target = Current.Game.AnyPlayerHomeMap; if (target == null) { return(false); } parms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatSmall, target); parms.points = IncidentHelper_PointsHelper.RollProportionalGamePoints(storeIncident, pointsWager, parms.points); List <string> animals = new List <string>() { "Bear_Grizzly", "Bear_Polar", "Rhinoceros", "Elephant", "Megasloth", "Thrumbo" }; animals.Shuffle(); ThingDef def = ThingDef.Named(animals[0]); float averagePower = 0; if (def != null && def.race != null) { foreach (Tool t in def.tools) { averagePower += t.power; } averagePower = averagePower / def.tools.Count; } float animalCount = 2.5f; if (averagePower > 18) { animalCount = 2.0f; } worker = new IncidentWorker_SpecificAnimalsWanderIn("TwitchStoriesLetterLabelPredators", PawnKindDef.Named(animals[0]), false, (int)animalCount, true, true); worker.def = IncidentDef.Named("HerdMigration"); return(worker.CanFireNow(parms)); }