示例#1
0
        public override void Run()
        {
            var klutz = Party.GetRandomCompanion();

            Description = $"While walking along a riverbank, the ground gives out from under {klutz.FirstName()}'s feet and they slide into the water. Some of their gear is lost or ruined!";

            Penalty = new Penalty();

            Penalty.AddEntityLoss(klutz, EntityStatTypes.CurrentMorale, 10);

            Penalty.AddPartyLoss(PartySupplyTypes.Food, 2);
            Penalty.AddPartyLoss(PartySupplyTypes.HealthPotions, 2);

            var fullResultDescription = new List <string> {
                Description + "\n"
            };

            var travelManager = Object.FindObjectOfType <TravelManager>();

            travelManager.ApplyEncounterPenalty(Penalty);

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.EncounterResult, this, fullResultDescription);
        }
示例#2
0
        public override void Run()
        {
            var numBandits = Random.Range(MinBandits, MaxBandits + 1);

            Description = $"{numBandits} bandits have blocked the trail. Their leader steps forward and demands that you turn over all your supplies.";

            var bandits = new List <Entity>();

            for (var i = 0; i < numBandits; i++)
            {
                var banditIndex = Dice.Roll("1d2");

                Entity bandit;

                if (banditIndex == 1)
                {
                    bandit = new ManAtArms(Race.RaceType.Human, false);
                }
                else
                {
                    bandit = new Crossbowman(Race.RaceType.Human, false);
                }

                bandits.Add(bandit);
            }

            Options = new Dictionary <string, Option>();

            var optionTitle = "Give up the supplies.";

            string optionResultText = "The group stands aside and watches as the bandits make off with their supplies.";

            var optionOnePenalty = new Penalty();

            var travelManager = Object.FindObjectOfType <TravelManager>();

            optionOnePenalty.AddPartyLoss(PartySupplyTypes.Gold, travelManager.Party.Gold);
            optionOnePenalty.AddPartyLoss(PartySupplyTypes.HealthPotions, travelManager.Party.HealthPotions);
            optionOnePenalty.AddPartyLoss(PartySupplyTypes.Food, travelManager.Party.Food);

            var optionOne = new Option(optionTitle, optionResultText, null, optionOnePenalty, EncounterType.Normal);

            Options.Add(optionTitle, optionOne);

            optionTitle = "Fight!";

            optionResultText = "Those supplies are essential to the group's survival. They must fight!";

            var fightOption = new FightCombatOption(optionTitle, optionResultText, bandits);

            Options.Add(optionTitle, fightOption);

            SubscribeToOptionSelectedEvent();

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this);
        }
示例#3
0
        public override void Run()
        {
            var travelManager = Object.FindObjectOfType<TravelManager>();

            var gold = travelManager.Party.Gold;

            const int pastryCost = 30;

            const int foodGain = 9;

            Reward = new Reward();
            Penalty = new Penalty();

            var fatty = travelManager.Party.GetRandomCompanion();

            Description = $"The party decides to camp outside of a small village. {fatty.FirstName()} disappears for awhile to check things out. When they return, they're carrying an armful of pastries. ";

            if (gold <= 0)
            {
                Description += $"\n\nThey found them in a basket with no one around to claim them!";
            }
            else if (gold <= pastryCost)
            {
                Description += $"\n\nThey spent the rest of the gold!";

                Reward.AddPartyGain(PartySupplyTypes.Food, foodGain - 2);

                Penalty.AddPartyLoss(PartySupplyTypes.Gold, gold);
            }
            else
            {
                Description += $"\n\nThey spent {pastryCost} gold!";

                Reward.AddPartyGain(PartySupplyTypes.Food, foodGain);

                Penalty.AddPartyLoss(PartySupplyTypes.Gold, pastryCost);
            }

            Description += $"\n\nThe pastries are pretty good though and there are plenty leftover after everyone stuffs their faces!";

            Reward.EveryoneGain(travelManager.Party, EntityStatTypes.CurrentEnergy, 10);
            Reward.EveryoneGain(travelManager.Party, EntityStatTypes.CurrentMorale, 5);

            var fullResultDescription = new List<string> { Description + "\n" };

            travelManager.ApplyEncounterPenalty(Penalty);
            travelManager.ApplyEncounterReward(Reward);

            var eventMediator = Object.FindObjectOfType<EventMediator>();
            eventMediator.Broadcast(GlobalHelper.EncounterResult, this, fullResultDescription);
        }
示例#4
0
        public override void Run()
        {
            Penalty = new Penalty();

            Penalty.RemoveFromParty(_companion);

            const int theftChance = 54;

            var roll = Dice.Roll("1d100");

            if (roll <= theftChance)
            {
                Description += "\n\nThey stole some supplies too!";
            }

            const int foodChance = 51;

            if (roll <= foodChance)
            {
                Penalty.AddPartyLoss(PartySupplyTypes.Food, Party.Food >= 10 ? 10 : Party.Food);
            }

            const int goldChance = 5;

            if (roll <= goldChance)
            {
                Penalty.AddPartyLoss(PartySupplyTypes.Gold, Party.Gold >= 70 ? 70 : Party.Gold);
            }

            const int potionChance = 10;

            if (roll <= potionChance)
            {
                Penalty.AddPartyLoss(PartySupplyTypes.Gold, Party.HealthPotions >= 2 ? 2 : Party.HealthPotions);
            }

            var fullResultDescription = new List <string> {
                Description + "\n"
            };

            var travelManager = Object.FindObjectOfType <TravelManager>();

            travelManager.ApplyEncounterPenalty(Penalty);

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.EncounterResult, this, fullResultDescription);
        }
示例#5
0
        public override void Run()
        {
            var travelManager = Object.FindObjectOfType <TravelManager>();

            var gold = travelManager.Party.Gold;

            const int clothesCost = 50;

            Reward  = new Reward();
            Penalty = new Penalty();

            var trendy = travelManager.Party.GetRandomCompanion();

            Description = $"The party decides to camp outside of a town known for its shopping district. {trendy.FirstName()} disappears for awhile to check things out. They return proudly wearing the poofiest, silkiest pantaloons you've ever seen!";

            if (gold <= 0)
            {
                Description += $"\n\nThey found the clothes hanging out to dry in someone's yard and took them!";
            }
            else
            if (gold <= clothesCost)
            {
                Description += $"\n\nThey spent the rest of the gold!";

                Penalty.AddPartyLoss(PartySupplyTypes.Gold, gold);
            }
            else
            {
                Description += $"\n\nThey spent {clothesCost} gold!";

                Penalty.AddPartyLoss(PartySupplyTypes.Gold, clothesCost);
            }

            Reward.EveryoneGain(travelManager.Party, EntityStatTypes.CurrentEnergy, 10);

            Reward.AddEntityGain(trendy, EntityStatTypes.CurrentMorale, 5);

            var fullResultDescription = new List <string> {
                Description + "\n"
            };

            travelManager.ApplyEncounterPenalty(Penalty);
            travelManager.ApplyEncounterReward(Reward);

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.EncounterResult, this, fullResultDescription);
        }
示例#6
0
        public override void Run()
        {
            Options = new Dictionary <string, Option>();

            string  optionTitle;
            string  optionResultText;
            Reward  optionReward  = null;
            Penalty optionPenalty = null;

            var travelManager = Object.FindObjectOfType <TravelManager>();

            if (travelManager.Party.Gold >= BetAmount)
            {
                var bestArm = travelManager.Party.GetCompanionWithHighestRangedSkill();

                optionTitle      = $"{bestArm.Name} takes the bet";
                optionResultText = $"\"Best two out of three?\" says {bestArm.FirstName()}. \n\n";

                var opponentRoll = Dice.Roll("2d6");

                var companionRoll = Dice.Roll($"{bestArm.Skills.Ranged}d6");

                if (companionRoll >= opponentRoll)
                {
                    optionResultText += $"{bestArm.FirstName()} crushes the challenger. Easy money!";

                    optionReward = new Reward();
                    optionReward.AddPartyGain(PartySupplyTypes.Gold, BetAmount);
                }
                else
                {
                    optionResultText += $"{bestArm.FirstName()} tries his best, but can't quite beat the young man's skipping ability.";

                    optionPenalty = new Penalty();
                    optionPenalty.AddPartyLoss(PartySupplyTypes.Gold, BetAmount);
                }

                var optionOne = new Option(optionTitle, optionResultText, optionReward, optionPenalty, EncounterType);

                Options.Add(optionTitle, optionOne);
            }

            optionTitle      = "Keep moving";
            optionResultText = "The group starts moving again down the trail. \n\n \"HA! Yee that's what I thought! Don't stand a chance against me!\"";

            var optionTwo = new Option(optionTitle, optionResultText, null, null, EncounterType);

            Options.Add(optionTitle, optionTwo);

            SubscribeToOptionSelectedEvent();

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this);
        }
示例#7
0
        public override void Run()
        {
            Penalty = new Penalty();
            Penalty.AddEntityLoss(_companion, EntityStatTypes.CurrentHealth, 10);

            Penalty.AddPartyLoss(PartySupplyTypes.Gold, 35);

            var fullResultDescription = new List <string> {
                Description + "\n"
            };

            var travelManager = Object.FindObjectOfType <TravelManager>();

            travelManager.ApplyEncounterPenalty(Penalty);

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.EncounterResult, this, fullResultDescription);

            _companion.Stats.CurrentMorale = _companion.Stats.MaxMorale;
        }
示例#8
0
        public override void Run()
        {
            Options = new Dictionary <string, Option>();

            string optionTitle;
            string optionResultText;

            var sacrifice = Party.GetRandomCompanion();

            if (Party.HealthPotions > 0)
            {
                optionTitle = "Offer them a health potion";

                optionResultText = "Not quite cough syrup, but close enough!\n\n";

                const int sacChance = 13;

                var roll = Dice.Roll("1d100");

                var optionOnePenalty = new Penalty();

                optionOnePenalty.AddPartyLoss(PartySupplyTypes.HealthPotions, 1);

                var optionOneReward = new Reward();

                if (roll <= sacChance)
                {
                    optionResultText += "\"Still gonna take one of you as a sacrifice though.\"\n\n";

                    optionResultText += $"{sacrifice.Name} vanishes in a flash of fire and black smoke! Seva shrugs.\n\n\"Okay, see ya.\"";

                    optionOnePenalty.RemoveFromParty(sacrifice);

                    optionOnePenalty.EveryoneLoss(Party, EntityStatTypes.CurrentMorale, 5);

                    optionOneReward.EveryoneGain(Party, EntityAttributeTypes.Physique, 1);
                    optionOneReward.EveryoneGain(Party, EntitySkillTypes.Endurance, 1);
                }
                else
                {
                    var chosen = Party.GetRandomCompanion();

                    optionResultText += $"Seva points at {chosen.FirstName()}.\n\n\"You seem cool. Here.\"\n\n{chosen.FirstName()} glows red briefly and Seva vanishes.";

                    optionOneReward.AddEntityGain(chosen, EntityAttributeTypes.Physique, 1);
                    optionOneReward.AddEntityGain(chosen, EntitySkillTypes.Endurance, 1);

                    //todo maybe change their skin color to red idk
                }

                var optionOne = new Option(optionTitle, optionResultText, optionOneReward, optionOnePenalty,
                                           EncounterType.Normal);

                Options.Add(optionTitle, optionOne);
            }

            optionTitle = "PANIC!";

            optionResultText = $"Everyone screams and scatters in all directions! Seva alternates between screaming and coughing before pointing at {sacrifice.FirstName()}. {sacrifice.FirstName()} stops in their tracks, glows red briefly, then vanishes in a flash of fire and black smoke! Seva shrugs.\n\n\"Okay, see ya.\"";

            var optionTwoPenalty = new Penalty();

            optionTwoPenalty.RemoveFromParty(sacrifice);

            var optionTwo = new Option(optionTitle, optionResultText, null, optionTwoPenalty, EncounterType.Normal);

            Options.Add(optionTitle, optionTwo);

            SubscribeToOptionSelectedEvent();

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this);
        }
示例#9
0
        public override void Run()
        {
            var numBandits = Random.Range(MinBandits, MaxBandits + 1);

            Description = $"{numBandits} bandits have blocked the trail. ";

            const int foodThreshold = 6;

            Description += "Their leader steps forward and shakily demands that you turn over ";

            Penalty = new Penalty();

            if (Party.Food > foodThreshold && Party.Gold > 4 && Party.HealthPotions > 4)
            {
                var numGold = Party.Gold / 4;

                Description += $"{numGold} gold, ";

                var numPotions = Party.HealthPotions / 4;

                Description += $"{numPotions} potion";

                if (numPotions > 1)
                {
                    Description += $"s";
                }

                Description += ", ";

                Description += "and the rest of your food!";

                Penalty.AddPartyLoss(PartySupplyTypes.Gold, Party.Gold / 4);
                Penalty.AddPartyLoss(PartySupplyTypes.HealthPotions, Party.HealthPotions / 4);
                Penalty.AddPartyLoss(PartySupplyTypes.Food, Party.Food);
            }
            else
            {
                Description += "half of all your supplies!";

                if (Party.Gold > 1)
                {
                    Penalty.AddPartyLoss(PartySupplyTypes.Gold, Party.Gold / 2);
                }

                if (Party.HealthPotions > 1)
                {
                    Penalty.AddPartyLoss(PartySupplyTypes.HealthPotions, Party.HealthPotions / 2);
                }

                if (Party.Food > 1)
                {
                    Penalty.AddPartyLoss(PartySupplyTypes.Food, Party.Food / 2);
                }
            }

            var bandits = new List <Entity>();

            for (var i = 0; i < numBandits; i++)
            {
                var banditIndex = Dice.Roll("1d2");

                Entity bandit;

                if (banditIndex == 1)
                {
                    bandit = new ManAtArms(Race.RaceType.Human, false);
                }
                else
                {
                    bandit = new Crossbowman(Race.RaceType.Human, false);
                }

                bandits.Add(bandit);
            }

            Options = new Dictionary <string, Option>();

            var optionTitle = "Give up the supplies.";

            string optionResultText = "The group stands aside and watches as the bandits make off with their supplies.";

            var optionOnePenalty = Penalty;

            Penalty = null;

            var optionOne = new Option(optionTitle, optionResultText, null, optionOnePenalty, EncounterType.Normal);

            Options.Add(optionTitle, optionOne);

            optionTitle = "Fight!";

            optionResultText = "Those supplies are essential to the group's survival. They must fight!";

            var fightOption = new FightCombatOption(optionTitle, optionResultText, bandits);

            Options.Add(optionTitle, fightOption);

            SubscribeToOptionSelectedEvent();

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this);
        }
示例#10
0
        public override void Run()
        {
            Options = new Dictionary <string, Option>();

            var travelManager = Object.FindObjectOfType <TravelManager>();

            var totalCost = CostPerPerson * travelManager.Party.GetCompanions().Count;

            string optionTitle;
            string optionResultText;

            if (totalCost <= travelManager.Party.Gold)
            {
                optionTitle      = $"Pay the {totalCost} gold";
                optionResultText = $"The group pays {totalCost} gold to stay the night. It's pretty comfy!";

                var optionReward = new Reward();
                optionReward.AddEntityGain(travelManager.Party.Derpus, EntityStatTypes.CurrentEnergy, EnergyGain);

                foreach (var companion in travelManager.Party.GetCompanions())
                {
                    optionReward.AddEntityGain(companion, EntityStatTypes.CurrentEnergy, EnergyGain);
                }

                var optionOnePenalty = new Penalty();
                optionOnePenalty.AddPartyLoss(PartySupplyTypes.Gold, totalCost);

                var rollForBreakfast = Random.Range(0, 101); //todo diceroller

                if (rollForBreakfast <= BreakfastChance)
                {
                    optionResultText = "\nThe innkeeper serves breakfast as thanks for being great guests!";

                    optionReward.AddEntityGain(travelManager.Party.Derpus, EntityStatTypes.CurrentMorale, EnergyGain);

                    foreach (var companion in travelManager.Party.GetCompanions())
                    {
                        optionReward.AddEntityGain(companion, EntityStatTypes.CurrentMorale, EnergyGain);
                    }

                    optionReward.AddPartyGain(PartySupplyTypes.Food, travelManager.Party.GetCompanions().Count *Party.FoodConsumedPerCompanion);
                }

                Options.Add(optionTitle, new Option(optionTitle, optionResultText, optionReward, optionOnePenalty, EncounterType));
            }

            optionTitle      = "No thanks";
            optionResultText = "You keep on going and travel through the night.";

            var optionTwoPenalty = new Penalty();

            optionTwoPenalty.AddEntityLoss(travelManager.Party.Derpus, EntityStatTypes.CurrentEnergy, 10);

            foreach (var companion in travelManager.Party.GetCompanions())
            {
                optionTwoPenalty.AddEntityLoss(companion, EntityStatTypes.CurrentEnergy, 10);
            }

            Options.Add(optionTitle, new Option(optionTitle, optionResultText, null, optionTwoPenalty, EncounterType));

            SubscribeToOptionSelectedEvent();

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this);
        }
示例#11
0
        public override void Run()
        {
            var travelManager = Object.FindObjectOfType <TravelManager>();

            var chosenCompanion = travelManager.Party.GetRandomCompanion();

            Description = $"{chosenCompanion.FirstName()} gets cut pretty badly after challenging a crab to a knife fight.";

            Options = new Dictionary <string, Option>();

            var optionTitle = "Ignore it";

            var optionResultText = $"{chosenCompanion.FirstName()} insists that they don't need any help and proudly bleeds everywhere.";

            var optionOnePenalty = new Penalty();

            optionOnePenalty.AddEntityLoss(chosenCompanion, EntityStatTypes.CurrentHealth, 5);
            optionOnePenalty.AddEntityLoss(chosenCompanion, EntityAttributeTypes.Physique, 1);

            var optionOne = new Option(optionTitle, optionResultText, null, optionOnePenalty, EncounterType.Normal);

            Options.Add(optionTitle, optionOne);

            optionTitle = "Heal the wound";

            var medicalCompanion = travelManager.Party.GetCompanionWithHighestHealing();

            var healRoll = Dice.Roll($"{medicalCompanion.Skills.Healing - 1}d6");

            var wildRoll = GlobalHelper.RollWildDie();

            healRoll += wildRoll;

            const int healSuccess = 15;

            Reward  optionTwoReward = null;
            Penalty optionTwoPenalty;

            if (medicalCompanion.Skills.Healing > 5 || healRoll > healSuccess)
            {
                if (travelManager.Party.HealthPotions > 0)
                {
                    optionResultText =
                        $"{medicalCompanion.FirstName()} is able to treat the wound and it heals properly.";

                    optionTwoReward = new Reward();

                    optionTwoReward.AddEntityGain(medicalCompanion, EntitySkillTypes.Healing, 1);

                    optionTwoPenalty = new Penalty();

                    optionTwoPenalty.AddPartyLoss(PartySupplyTypes.HealthPotions, 1);
                }
                else
                {
                    optionResultText =
                        $"{medicalCompanion.FirstName()} does the best they can with no health potions. The wound ends up smelling funny later on.";

                    optionTwoPenalty = new Penalty();

                    optionTwoPenalty.AddEntityLoss(chosenCompanion, EntityStatTypes.CurrentMorale, 5);
                }
            }
            else
            {
                optionResultText =
                    $"{medicalCompanion.FirstName()} tries to help, but makes the wound much worse. The bleeding stops, but {chosenCompanion.FirstName()} feels weaker.";

                optionTwoPenalty = new Penalty();

                optionTwoPenalty.AddEntityLoss(chosenCompanion, EntityStatTypes.CurrentHealth, 5);
                optionTwoPenalty.AddEntityLoss(chosenCompanion, EntityAttributeTypes.Physique, 1);
            }

            var optionTwo = new Option(optionTitle, optionResultText, optionTwoReward, optionTwoPenalty,
                                       EncounterType.Normal);

            Options.Add(optionTitle, optionTwo);

            SubscribeToOptionSelectedEvent();

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this);
        }
示例#12
0
        public override void Run()
        {
            Options = new Dictionary <string, Option>();

            var optionTitle = "Look for a safe way out";

            const int escapeSuccess = 26;

            var travelManager = Object.FindObjectOfType <TravelManager>();
            var smartyPants   = travelManager.Party.GetCompanionWithHighestIntellect();

            //todo diceroller here
            var intCheck = smartyPants.Attributes.Intellect + Random.Range(1, 21);

            Debug.Log("Holy Inferno safe way out check: ");
            Debug.Log($"Value Needed: {escapeSuccess}");
            Debug.Log(
                $"Rolled: {intCheck - smartyPants.Attributes.Intellect} + Intellect: {smartyPants.Attributes.Intellect} = Final Value {intCheck}");

            Penalty penalty = null;

            string optionResultText;

            if (intCheck > escapeSuccess)
            {
                optionResultText = $"{smartyPants.Name} thinks fast and finds a way out. No one is injured!";
            }
            else if (intCheck == escapeSuccess)
            {
                optionResultText = $"{smartyPants.Name} tries to find a safe exit, but wastes precious time making a decision. Everyone escapes, but they look a little crispy...";

                penalty = new Penalty();

                foreach (var companion in travelManager.Party.GetCompanions())
                {
                    penalty.AddEntityLoss(companion, EntityStatTypes.CurrentHealth, 10);
                }
            }
            else
            {
                optionResultText = $"{smartyPants.Name} tries to find a safe exit, but panics instead! Everyone runs screaming from the building!";

                penalty = new Penalty();
                penalty.AddEntityLoss(travelManager.Party.Derpus, EntityStatTypes.CurrentMorale, 10);

                foreach (var companion in travelManager.Party.GetCompanions())
                {
                    penalty.AddEntityLoss(companion, EntityStatTypes.CurrentMorale, 10);
                }
            }

            var optionOne = new Option(optionTitle, optionResultText, null, penalty, EncounterType);

            Options.Add(optionTitle, optionOne);

            optionTitle = "RUN!";

            var chosenCompanion = travelManager.Party.GetRandomCompanion();

            optionResultText = $"Everyone flees to safety in a panic. After ensuring everyone is unharmed, {chosenCompanion.Name} notices that their bag was left behind.";

            penalty = new Penalty();

            var foodLost = travelManager.Party.Food / 4;

            penalty.AddPartyLoss(PartySupplyTypes.Food, foodLost);

            var goldLost = travelManager.Party.Gold / 4;

            penalty.AddPartyLoss(PartySupplyTypes.Gold, goldLost);

            var potionsLost = travelManager.Party.HealthPotions / 4;

            penalty.AddPartyLoss(PartySupplyTypes.HealthPotions, potionsLost);

            var optionTwo = new Option(optionTitle, optionResultText, null, penalty, EncounterType);

            Options.Add(optionTitle, optionTwo);

            SubscribeToOptionSelectedEvent();

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this);
        }
示例#13
0
        public override void Run()
        {
            Options = new Dictionary <string, Option>();

            string optionTitle;
            string optionResultText = "\"Pleasure doing business with you!\"";

            var itemStore = Object.FindObjectOfType <ItemStore>();

            var weapon = itemStore.GetRandomEquipableItem(EquipLocation.Weapon);

            if (Party.Gold >= weapon.GetPrice())
            {
                optionTitle = $"{weapon.GetDisplayName()} ({weapon.GetPrice()})";

                var weaponReward = new Reward();

                weaponReward.AddToInventory(weapon);

                var weaponPenalty = new Penalty();

                weaponPenalty.AddPartyLoss(PartySupplyTypes.Gold, weapon.GetPrice());

                var weaponOption = new Option(optionTitle, optionResultText, weaponReward, weaponPenalty,
                                              EncounterType.Normal);

                Options.Add(optionTitle, weaponOption);
            }

            var slot = GlobalHelper.GetRandomEnumValue <EquipLocation>();

            while (slot == EquipLocation.Weapon || slot == EquipLocation.Book)
            {
                slot = GlobalHelper.GetRandomEnumValue <EquipLocation>();
            }

            var armor = itemStore.GetRandomEquipableItem(slot);

            if (Party.Gold >= armor.GetPrice())
            {
                optionTitle = $"{armor.GetDisplayName()} ({armor.GetPrice()})";

                var armorReward = new Reward();

                armorReward.AddToInventory(armor);

                var armorPenalty = new Penalty();

                armorPenalty.AddPartyLoss(PartySupplyTypes.Gold, armor.GetPrice());

                var armorOption = new Option(optionTitle, optionResultText, armorReward, armorPenalty,
                                             EncounterType.Normal);

                Options.Add(optionTitle, armorOption);
            }

            const int supplyCost = 30;

            if (Party.Gold >= supplyCost)
            {
                optionTitle = $"Some supplies {supplyCost}";

                var supplyReward = new Reward();

                supplyReward.AddPartyGain(PartySupplyTypes.Food, 5);
                supplyReward.AddPartyGain(PartySupplyTypes.HealthPotions, 1);

                var supplyPenalty = new Penalty();

                supplyPenalty.AddPartyLoss(PartySupplyTypes.Gold, supplyCost);

                var supplyOption = new Option(optionTitle, optionResultText, supplyReward, supplyPenalty,
                                              EncounterType.Normal);

                Options.Add(optionTitle, supplyOption);
            }

            optionTitle = "Nothing";

            optionResultText = "You continue down the trail.";

            var nothingOption = new Option(optionTitle, optionResultText, null, null, EncounterType.Normal);

            Options.Add(optionTitle, nothingOption);

            SubscribeToOptionSelectedEvent();

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this);
        }
示例#14
0
        public override void Run()
        {
            Options = new Dictionary <string, Option>();

            var optionTitle = "Scavenge for supplies (free)";

            var optionResultText = "Everyone splits up and scrounges up what they can from the streets and alleys.";

            var optionReward = new Reward();

            var foodGained = Random.Range(4, 9);

            optionReward.AddPartyGain(PartySupplyTypes.Food, foodGained);

            const int potionChance = 50;

            //todo diceroller
            var roll = Random.Range(1, 101);

            int potionsGained;

            if (roll <= potionChance)
            {
                potionsGained = Random.Range(1, 6);

                optionReward.AddPartyGain(PartySupplyTypes.HealthPotions, potionsGained);
            }

            const int goldChance = 30;

            //todo diceroller
            roll = Random.Range(1, 101);

            if (roll <= goldChance)
            {
                var goldGained = Random.Range(20, 41);

                optionReward.AddPartyGain(PartySupplyTypes.Gold, goldGained);
            }

            var optionOne = new Option(optionTitle, optionResultText, optionReward, null, EncounterType);

            Options.Add(optionTitle, optionOne);

            var supplyCost = Random.Range(25, 81);

            optionTitle      = $"Buy supplies ({supplyCost} gold)";
            optionResultText = "A local shopkeeper is happy to do business.";

            optionReward = new Reward();

            foodGained *= 2;

            optionReward.AddPartyGain(PartySupplyTypes.Food, foodGained);

            potionsGained = Random.Range(2, 12);

            optionReward.AddPartyGain(PartySupplyTypes.HealthPotions, potionsGained);

            var optionPenalty = new Penalty();

            optionPenalty.AddPartyLoss(PartySupplyTypes.Gold, supplyCost);

            var optionTwo = new Option(optionTitle, optionResultText, optionReward, optionPenalty, EncounterType);

            Options.Add(optionTitle, optionTwo);

            var travelManager = Object.FindObjectOfType <TravelManager>();

            var restCost = travelManager.Party.GetCompanions().Count * 10;

            if (travelManager.Party.Gold >= restCost)
            {
                optionTitle      = $"Rest for a day ({restCost} gold)";
                optionResultText = $"The party stays at the local inn and gets some good shut-eye.";

                optionReward = new Reward();

                optionReward.AddEntityGain(travelManager.Party.Derpus, EntityStatTypes.CurrentEnergy, 10);

                foreach (var companion in travelManager.Party.GetCompanions())
                {
                    optionReward.AddEntityGain(companion, EntityStatTypes.CurrentEnergy, 10);
                }

                optionReward.AddEntityGain(travelManager.Party.Derpus, EntityStatTypes.CurrentMorale, 10);

                foreach (var companion in travelManager.Party.GetCompanions())
                {
                    optionReward.AddEntityGain(companion, EntityStatTypes.CurrentMorale, 10);
                }

                optionPenalty = new Penalty();

                optionPenalty.AddPartyLoss(PartySupplyTypes.Gold, restCost);

                EncounterType = EncounterType.Camping;

                CountsAsDayTraveled = false;

                var optionThree = new Option(optionTitle, optionResultText, optionReward, optionPenalty, EncounterType);

                Options.Add(optionTitle, optionThree);
            }

            SubscribeToOptionSelectedEvent();

            var eventMediator = Object.FindObjectOfType <EventMediator>();

            eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this);
        }