Example #1
0
        public override void StartEvent()
        {
            if (Settings.GeneralSettings.DebugMode)
            {
                InformationManager.DisplayMessage(new InformationMessage($"Starting {this.RandomEventData.EventType}", RandomEventsSubmodule.textColor));
            }

            List <InquiryElement> inquiryElements = new List <InquiryElement>();

            inquiryElements.Add(new InquiryElement("a", "Break it up.", null, true, "Where do these fools think this food comes from?"));
            inquiryElements.Add(new InquiryElement("b", "Join in!", null, true, "You were done eating anyway."));

            MultiSelectionInquiryData msid = new MultiSelectionInquiryData(
                eventTitle,                                                    // Title
                $"While your party is eating, a large food fight breaks out.", // 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.MainParty.RecentEventsMorale -= moraleLoss;

                    InformationManager.ShowInquiry(new InquiryData(eventTitle, "You command that everyone stops this nonsense. Although the party looks displeased, at least you saved the food.", true, false, "Done", null, null, null), true);
                }
                else if ((string)elements[0].Identifier == "b")
                {
                    string extraDialogue = "";

                    float xpToGive = Settings.GeneralSettings.GeneralLevelXpMultiplier * Hero.MainHero.GetSkillValue(DefaultSkills.Throwing) * 0.5f;
                    Hero.MainHero.AddSkillXp(DefaultSkills.Throwing, xpToGive);

                    int foodToRemove  = MBRandom.RandomInt(minFoodLoss, maxFoodLoss);
                    bool runOutOfFood = RemoveFood(foodToRemove);
                    if (runOutOfFood)
                    {
                        extraDialogue = " Quickly you realise that there is no food left. If you can't source some more soon there may be trouble.";
                    }

                    InformationManager.ShowInquiry(new InquiryData(eventTitle, $"You decide to join in on the fun! You even manage to deal out some black eyes. Did you go too far? Probably.{extraDialogue}", 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();
        }
Example #2
0
        public override void StartEvent()
        {
            if (Settings.GeneralSettings.DebugMode)
            {
                InformationManager.DisplayMessage(new InformationMessage($"Starting {this.RandomEventData.EventType}", RandomEventsSubmodule.textColor));
            }

            List <InquiryElement> inquiryElements = new List <InquiryElement>();

            inquiryElements.Add(new InquiryElement("a", "Pay gold to have them leave", null, true, "What is gold good for, if not to dissuade people from killing you?"));
            inquiryElements.Add(new InquiryElement("b", "Attack", null));

            if (Hero.MainHero.PartyBelongedTo.MemberRoster.TotalHealthyCount > troopScareCount)
            {
                inquiryElements.Add(new InquiryElement("c", "Intimidate them", null));
            }

            MultiSelectionInquiryData msid = new MultiSelectionInquiryData(
                eventTitle,             // Title
                CalculateDescription(), // 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")
                {
                    float percentMoneyLost = MBRandom.RandomFloatRanged(moneyMinPercent, moneyMaxPercent);
                    int goldLost           = (int)MathF.Floor(Hero.MainHero.Gold * percentMoneyLost);
                    Hero.MainHero.ChangeHeroGold(-goldLost);
                    InformationManager.ShowInquiry(new InquiryData(eventTitle, $"You give the bandits {goldLost} coins and they quickly flee. At least you and your soldiers live to fight another day.", true, false, "Done", null, null, null), true);
                }
                else if ((string)elements[0].Identifier == "b")
                {
                    SpawnBandits(false);
                    InformationManager.ShowInquiry(new InquiryData(eventTitle, "Seeing you won't back down, the bandits get ready for a fight.", true, false, "Done", null, null, null), true);
                }
                else if ((string)elements[0].Identifier == "c")
                {
                    SpawnBandits(true);
                    InformationManager.ShowInquiry(new InquiryData(eventTitle, "You laugh as you watch the rest of your party emerge over the crest of the hill. The bandits get ready to flee.", 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();
        }
Example #3
0
        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));
            }

            float percentOffset = MBRandom.RandomFloatRanged(-percentageDifferenceOfCurrentTroop, percentageDifferenceOfCurrentTroop);

            int spawnCount = (int)(MobileParty.MainParty.MemberRoster.Count * (1 + percentOffset));

            if (spawnCount < minimumSoldiers)
            {
                spawnCount = minimumSoldiers;
            }

            List <InquiryElement> inquiryElements = new List <InquiryElement>();

            inquiryElements.Add(new InquiryElement("a", "Let the soldiers have some fun!", null));
            inquiryElements.Add(new InquiryElement("b", "Do nothing.", null, true, "Think about the experience you're giving up!"));

            MultiSelectionInquiryData msid = new MultiSelectionInquiryData(
                eventTitle,                       // Title
                CalculateDescription(spawnCount), // 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")
                {
                    InformationManager.ShowInquiry(new InquiryData(eventTitle, "The looters look terrified.", true, false, "Good", null, null, null), true);
                    SpawnLooters(spawnCount);
                }
                else if ((string)elements[0].Identifier == "b")
                {
                    InformationManager.ShowInquiry(new InquiryData(eventTitle, "The looters, seeing that you aren't about to attack, quickly scatter to the wind. Your soldiers grumble.", 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();
        }
Example #5
0
        public override void StartEvent()
        {
            if (Settings.GeneralSettings.DebugMode)
            {
                InformationManager.DisplayMessage(new InformationMessage($"Starting {this.RandomEventData.EventType}", RandomEventsSubmodule.textColor));
            }

            List <InquiryElement> inquiryElements = new List <InquiryElement>();

            inquiryElements.Add(new InquiryElement("a", "Order the men to gather some food.", null));
            inquiryElements.Add(new InquiryElement("b", "There's no time.", null));

            MultiSelectionInquiryData msid = new MultiSelectionInquiryData(
                eventTitle,                                                                                                                                                      // Title
                "While traveling you come across a large meadow with grazing deer surrounded by grape vines. If you have some spare time, perhaps you could collect some food.", // 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")
                {
                    Campaign.Current.TimeControlMode = CampaignTimeControlMode.UnstoppableFastForwardForPartyWaitTime;

                    MobileParty.MainParty.IsActive = false;

                    waitPos = MobileParty.MainParty.Position2D;

                    //hourlyTickEvent = CampaignEvents.CreatePeriodicEvent(1f, 0f);
                    hourlyTickEvent = CampaignEvents.CreatePeriodicEvent(CampaignTime.HoursFromNow(1f), CampaignTime.Zero);
                    hourlyTickEvent.AddHandler(new MBCampaignEvent.CampaignEventDelegate(HourlyTick));
                }
                else if ((string)elements[0].Identifier == "b")
                {
                    StopEvent();
                }
                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);
        }
Example #6
0
        public override void StartEvent()
        {
            if (Settings.GeneralSettings.DebugMode)
            {
                InformationManager.DisplayMessage(new InformationMessage($"Starting {this.RandomEventData.EventType}", RandomEventsSubmodule.textColor));
            }

            List <InquiryElement> inquiryElements = new List <InquiryElement>();

            inquiryElements.Add(new InquiryElement("a", "Buy drink", null, true, "What could go wrong?"));
            inquiryElements.Add(new InquiryElement("b", "Decline", null, true, "You'd have to be crazy to drink random liquid!"));

            MultiSelectionInquiryData msid = new MultiSelectionInquiryData(
                eventTitle,                                                                                                                            // Title
                $"You come across a vendor selling exotic drinks for {price}. He won't tell you how, but says that it will make you a better person.", // 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")
                {
                    GiveRandomSkillXP();
                    Hero.MainHero.ChangeHeroGold(-price);

                    InformationManager.ShowInquiry(new InquiryData(eventTitle, "\"Wise choice.\" The vendor pours you a small cup with a weird, fizzy, yellow liquid in it. As you take a sip, you think to yourself that it smells like piss. Quickly you realise it tastes like it too.\n Hopefully that wasn't a mistake.", true, false, "Done", null, null, null), true);
                }
                else if ((string)elements[0].Identifier == "b")
                {
                    InformationManager.ShowInquiry(new InquiryData(eventTitle, "\"Hehehehehe\" the vendor laughs. \"It's your loss.\"", 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();
        }
Example #7
0
        public override void StartEvent()
        {
            List <InquiryElement> inquiryElements = new List <InquiryElement>();

            inquiryElements.Add(new InquiryElement("a", "Gamble", null));
            inquiryElements.Add(new InquiryElement("b", "Decline", null));

            int goldToBet = (int)MathF.Floor(Hero.MainHero.Gold * moneyBetPercent);

            string extraDialogue = "";

            if (goldToBet > 40000)
            {
                extraDialogue = " You have no idea how they have that much money. You contemplate stealing it.";
            }

            MultiSelectionInquiryData msid = new MultiSelectionInquiryData(
                "All or nothing",                                                                                                          // Title
                $"One of your soldiers wants to flip a coin. Heads you win, tails they do. The prize is {goldToBet} gold.{extraDialogue}", // 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")
                {
                    string outcomeText = DoBet(goldToBet);
                    InformationManager.ShowInquiry(new InquiryData("All or nothing", outcomeText, true, false, "Done", null, null, null), true);
                }
                else
                {
                    InformationManager.ShowInquiry(new InquiryData("All or nothing", "You walk away.", true, false, "Done", null, null, null), true);
                }
            },
                null);                 // What to do on the "cancel" button, shouldn't ever need it.

            InformationManager.ShowMultiSelectionInquiry(msid, true);

            StopEvent();
        }
Example #8
0
        public void onCastClick()
        {
            var elements = new List <InquiryElement>();

            foreach (var el in BuffManager.Instance.GetRegisteredBuffList())
            {
                elements.Add(new InquiryElement(el.stringID, el.Name, new ImageIdentifier(CharacterCode.CreateFrom(Hero.MainHero.CharacterObject))));
            }
            var inquiry = new MultiSelectionInquiryData("Cast a spell",
                                                        "Select a spell to cast from the list",
                                                        elements,
                                                        true,
                                                        1,
                                                        "OK",
                                                        "Cancel",
                                                        onPositiveResult,
                                                        onNegativeResult);

            InformationManager.ShowMultiSelectionInquiry(inquiry, true);
        }
Example #9
0
        public override void StartEvent()
        {
            if (Settings.GeneralSettings.DebugMode)
            {
                InformationManager.DisplayMessage(new InformationMessage($"Starting {this.RandomEventData.EventType}", RandomEventsSubmodule.textColor));
            }

            List <InquiryElement> inquiryElements = new List <InquiryElement>();

            inquiryElements.Add(new InquiryElement("a", "Shake the tree", null));
            inquiryElements.Add(new InquiryElement("b", "Leave it be", null));

            if (PlayerStatus.HasRangedWeaponEquipped())
            {
                inquiryElements.Add(new InquiryElement("c", "Use ranged weapon", null));
            }

            MultiSelectionInquiryData msid = new MultiSelectionInquiryData(
                eventTitle,                                                                          // Title
                "While walking past some trees you notice something shiny high up in its branches.", // 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")
                {
                    if (MBRandom.RandomFloat <= treeShakeChance)
                    {
                        // Success, calculate gold
                        int goldGained = MBRandom.RandomInt(minGold, maxGold);
                        Hero.MainHero.ChangeHeroGold(goldGained);

                        InformationManager.ShowInquiry(new InquiryData(eventTitle, $"You eventually shake the shiny object free from the tree! It hits the ground with a heavy thunk. It turns out that it was a purse with {goldGained} gold inside.", true, false, "Done", null, null, null), true);
                    }
                    else
                    {
                        // Failure
                        InformationManager.ShowInquiry(new InquiryData(eventTitle, $"Try as you might, you're unable to get dislodge the shiny object.", true, false, "Done", null, null, null), true);
                    }
                }
                else if ((string)elements[0].Identifier == "b")
                {
                    InformationManager.ShowInquiry(new InquiryData(eventTitle, $"You decide to leave the tree alone. Throughout the next few hours you can't help but wonder it was...", true, false, "Done", null, null, null), true);
                }
                else if ((string)elements[0].Identifier == "c")
                {
                    //Get weapon
                    SkillObject skillToUse = GetSkillObject();

                    if (skillToUse == null)
                    {
                        InformationManager.ShowInquiry(new InquiryData(eventTitle, $"Something went wrong with selecting your weapon, what have you done?! Aborting event.", true, false, "Sorry", null, null, null), true);
                        return;
                    }

                    //Check for success
                    float chancePercent = 0;

                    if (Hero.MainHero.GetSkillValue(skillToUse) < minRangeLevel)
                    {
                        chancePercent = 0;
                    }
                    else
                    {
                        var heroSkillValue = Hero.MainHero.GetSkillValue(skillToUse);
                        chancePercent      = ((float)heroSkillValue - minRangeLevel) / (maxRangeLevel - minRangeLevel);
                        chancePercent      = MathF.Clamp(chancePercent, baseRangeChance, 1.0f);
                    }

                    if (MBRandom.RandomFloat < chancePercent)
                    {
                        // Success -- Add gold and xp
                        int goldGained = MBRandom.RandomInt(minGold, maxGold);
                        Hero.MainHero.ChangeHeroGold(goldGained);

                        Hero.MainHero.AddSkillXp(skillToUse, Settings.GeneralSettings.GeneralLevelXpMultiplier * Hero.MainHero.GetSkillValue(skillToUse));

                        InformationManager.ShowInquiry(new InquiryData(eventTitle, $"You manage to knock the shiny object out of the tree with (what you consider) a fantastic shot! Shame no one was there to see it. You notice that object was in fact a purse full of {goldGained} gold!", true, false, "Done", null, null, null), true);
                    }
                    else
                    {
                        // Failure

                        ItemObject meat = MBObjectManager.Instance.GetObject <ItemObject>("meat");
                        MobileParty.MainParty.ItemRoster.AddToCounts(meat, 1);

                        InformationManager.ShowInquiry(new InquiryData(eventTitle, $"Shot after shot you attempt to knock down the object without success. At one stage a bird drops out of the tree. It's time to give up... At least you have dinner.", 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();
        }
Example #10
0
 public static void ShowMultiSelectionInquiry(MultiSelectionInquiryData data, bool pauseGameActiveState = false) => InformationManager.ShowMultiSelectionInquiry(data, pauseGameActiveState);
        public override void StartEvent()
        {
            if (Settings.GeneralSettings.DebugMode)
            {
                InformationManager.DisplayMessage(new InformationMessage($"Starting {this.RandomEventData.EventType}", RandomEventsSubmodule.textColor));
            }

            List <InquiryElement> inquiryElements = new List <InquiryElement>();

            inquiryElements.Add(new InquiryElement("a", "Take them in", null));
            inquiryElements.Add(new InquiryElement("b", "Ignore them", null));

            MultiSelectionInquiryData msid = new MultiSelectionInquiryData(
                eventTitle,                                   // Title
                $"You come across some wandering livestock.", // 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")
                {
                    int sheepCount = 0;
                    int cowCount   = 0;

                    int totalCount = MBRandom.RandomInt(minFood, maxFood);

                    sheepCount = MBRandom.RandomInt(1, totalCount);
                    cowCount   = totalCount - sheepCount;

                    string cowText = "";

                    if (cowCount > 0)
                    {
                        string cowPlural = "";
                        if (cowCount > 1)
                        {
                            cowPlural = "s";
                        }

                        cowText = $", and {cowCount} cow{cowPlural}.";
                    }
                    else
                    {
                        cowText = ".";
                    }

                    ItemObject sheep = MBObjectManager.Instance.GetObject <ItemObject>("sheep");
                    ItemObject cow   = MBObjectManager.Instance.GetObject <ItemObject>("cow");

                    MobileParty.MainParty.ItemRoster.AddToCounts(sheep, sheepCount);
                    MobileParty.MainParty.ItemRoster.AddToCounts(cow, cowCount);

                    InformationManager.ShowInquiry(new InquiryData(eventTitle, $"Who could say no to such a delicious -- I mean, reasonable proposition? You end up in possession of {sheepCount} sheep{cowText}", true, false, "Yum", null, null, null), true);
                }
                else if ((string)elements[0].Identifier == "b")
                {
                    InformationManager.ShowInquiry(new InquiryData(eventTitle, "The last thing you need right now is to tend to livestock, so you leave them.", 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();
        }