Exemplo n.º 1
0
        public override void Run()
        {
            var numBandits = Random.Range(MinZombies, MaxZombies + 1);

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

            var chosenCompanion = travelManager.Party.GetRandomCompanion();

            Description = $"The party is passing through a particularly dark part of the trail. {chosenCompanion.FirstName()} is nervously snapping their gaze side to side when they notice several figures lumbering towards them! The wagon is surrounded by zombies!";

            var zombies = new List <Entity>();

            for (var i = 0; i < numBandits; i++)
            {
                zombies.Add(new Zombie());
            }

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

            var optionTitle = "Retreat";

            string optionResultText;

            const int retreatSuccessValue = 47;

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

            var retreatSuccess = retreatCheck <= retreatSuccessValue;

            if (retreatSuccess)
            {
                optionResultText = "You manage to evade the undead attackers and escape safely.";
            }
            else
            {
                optionResultText = "You try to get away, but the attackers are too fast! Prepare for battle!";
            }

            var retreatOption = new RetreatCombatOption(optionTitle, optionResultText, zombies, retreatSuccess);

            Options.Add(optionTitle, retreatOption);

            optionTitle = "To arms!";

            optionResultText = "Prepare for battle...";

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

            Options.Add(optionTitle, fightOption);

            SubscribeToOptionSelectedEvent();

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

            eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this);
        }
Exemplo n.º 2
0
        public override void Run()
        {
            var numBandits = Random.Range(MinBandits, MaxBandits + 1);

            Description = $"{numBandits} bandits have blocked the trail with their weapons drawn!";

            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 = "Retreat";

            string optionResultText;

            const int retreatSuccessValue = 47;

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

            var retreatSuccess = retreatCheck <= retreatSuccessValue;

            Debug.Log($"Value Needed: {retreatSuccessValue}");
            Debug.Log($"Rolled: {retreatCheck}");

            if (retreatSuccess)
            {
                optionResultText = "They manage to evade the attackers and escape safely.";
            }
            else
            {
                optionResultText = "They try to get away, but the attackers are too fast! Prepare for battle!";
            }

            var retreatOption = new RetreatCombatOption(optionTitle, optionResultText, bandits, retreatSuccess);

            Options.Add(optionTitle, retreatOption);

            optionTitle = "To arms!";

            optionResultText = "Prepare for battle...";

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

            Options.Add(optionTitle, fightOption);

            SubscribeToOptionSelectedEvent();

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

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