public override void StartEvent() { if (Settings.GeneralSettings.DebugMode) { InformationManager.DisplayMessage(new InformationMessage($"Starting {this.RandomEventData.EventType}", RandomEventsSubmodule.textColor)); } int prisonerAmount = MBRandom.RandomInt(minPrisonerGain, maxPrisonerGain); Settlement settlement = GetRandomSettlement(); MobileParty prisoners = PartySetup.CreateBanditParty(); prisoners.MemberRoster.Clear(); PartySetup.AddRandomCultureUnits(prisoners, prisonerAmount, GetCultureToSpawn()); settlement.Party.AddPrisoners(prisoners.MemberRoster); prisoners.RemoveParty(); InformationManager.ShowInquiry( new InquiryData("Bunch of Prisoners", $"You receive word that your guards have expertly stopped a force inciting violence at {settlement.Name}, they have been put in cells", true, false, "Done", null, null, null ), true); StopEvent(); }
private void SpawnBandits(bool shouldFlee) { try { MobileParty banditParty = PartySetup.CreateBanditParty(); banditParty.MemberRoster.Clear(); if (shouldFlee) { banditParty.Aggressiveness = 0.2f; } else { banditParty.Aggressiveness = 10f; banditParty.SetMoveEngageParty(MobileParty.MainParty); } int numberToSpawn = Math.Min((int)(MobileParty.MainParty.MemberRoster.TotalManCount * 0.50f), banditCap); PartySetup.AddRandomCultureUnits(banditParty, 10 + numberToSpawn); } catch (Exception ex) { MessageBox.Show($"Error while running \"{this.RandomEventData.EventType}\" event :\n\n {ex.Message} \n\n { ex.StackTrace}"); } }
private void SpawnLooters(int spawnCount) { MobileParty looterParty = PartySetup.CreateBanditParty("looters"); looterParty.MemberRoster.Clear(); looterParty.Aggressiveness = 10f; looterParty.SetMoveEngageParty(MobileParty.MainParty); PartySetup.AddRandomCultureUnits(looterParty, spawnCount); }
public override void StartEvent() { if (Settings.GeneralSettings.DebugMode) { InformationManager.DisplayMessage(new InformationMessage($"Starting {this.RandomEventData.EventType}", RandomEventsSubmodule.textColor)); } int realMaxTroopGain = Math.Min(MobileParty.MainParty.Party.PartySizeLimit - MobileParty.MainParty.MemberRoster.TotalHealthyCount, maxTroopGain); int numberToAdd = MBRandom.RandomInt(minTroopGain, realMaxTroopGain); List <Settlement> settlements = Settlement.FindAll((s) => { return(!s.IsHideout()); }).ToList(); Settlement closestSettlement = settlements.MinBy((s) => { return(MobileParty.MainParty.GetPosition().DistanceSquared(s.GetPosition())); }); List <InquiryElement> inquiryElements = new List <InquiryElement>(); inquiryElements.Add(new InquiryElement("a", "Accept", null)); inquiryElements.Add(new InquiryElement("b", "Decline", null)); MultiSelectionInquiryData msid = new MultiSelectionInquiryData( eventTitle, // Title $"You come across {numberToAdd} troops that are eager for battle and glory. They want to join your ranks!", // Description inquiryElements, // Options false, // Can close menu without selecting an option. Should always be false. 1, // Force a single option to be selected. Should usually be true "Okay", // The text on the button that continues the event null, // The text to display on the "cancel" button, shouldn't ever need it. (elements) => // How to handle the selected option. Will only ever be a single element unless force single option is off. { if ((string)elements[0].Identifier == "a") { MobileParty bandits = PartySetup.CreateBanditParty(); bandits.MemberRoster.Clear(); PartySetup.AddRandomCultureUnits(bandits, numberToAdd, closestSettlement.Culture); MobileParty.MainParty.MemberRoster.Add(bandits.MemberRoster); bandits.RemoveParty(); } else if ((string)elements[0].Identifier == "b") { InformationManager.ShowInquiry(new InquiryData(eventTitle, "Disappointed, the soldiers leave.", true, false, "Done", null, null, null), true); } else { MessageBox.Show($"Error while selecting option for \"{this.RandomEventData.EventType}\""); } }, null); // What to do on the "cancel" button, shouldn't ever need it. InformationManager.ShowMultiSelectionInquiry(msid, true); StopEvent(); }
public override void StartEvent() { if (Settings.GeneralSettings.DebugMode) { InformationManager.DisplayMessage(new InformationMessage($"Starting {this.RandomEventData.EventType}", RandomEventsSubmodule.textColor)); } try { MobileParty prisonerParty = PartySetup.CreateBanditParty("looters", "Escaped prisoners (Random Event)"); prisonerParty.MemberRoster.Clear(); DoPrisonerTransfer(prisonerParty); prisonerParty.Aggressiveness = 10; prisonerParty.SetMoveEngageParty(MobileParty.MainParty); string heroDialogue = ""; if (heroInPrisonerRoster) { heroDialogue = "\n\nFortunately, you keep the important prisoners separate and they were unable to escape!"; } InformationManager.ShowInquiry( new InquiryData("Prisoner rebellion!", $"While your guards weren't looking the prisoners managed to break free. \"We'd rather die than stay in captivity another day!\"{heroDialogue}", true, false, "To arms!", null, null, null ), true); } catch (Exception ex) { MessageBox.Show($"Error while running \"{this.RandomEventData.EventType}\" event :\n\n {ex.Message} \n\n { ex.StackTrace}"); } StopEvent(); }