예제 #1
0
        private void TalkToAction()
        {
            int npcToTalkToId = _gameConsoleView.DisplayGetNpcToTalkTo();



            if (npcToTalkToId != 0)
            {
                Npc npc = _gameUniverse.GetNpcById(npcToTalkToId);

                Civilian civ = npc as Civilian;
                if (civ.healing > 0)
                {
                    Random rnd    = new Random();
                    int    random = rnd.Next(1, (100 - _gamePlayer.ProspectorHealth + 1));
                    civ.healing = random;
                }
                if (_gamePlayer.ProspectorHealth + civ.healing <= 100)
                {
                    _gamePlayer.ProspectorHealth += civ.healing;
                }
                else
                {
                    civ.healing = 0;
                }
                Random r       = new Random();
                int    randExp = r.Next(1, 50);
                civ.expPoints          = randExp;
                _gamePlayer.ExpPoints += civ.expPoints;

                _gameConsoleView.DisplayTalkTo(civ);
            }
        }
예제 #2
0
        public int DisplayGetNpcToTalkTo()
        {
            int  npcId      = 0;
            bool validNpcId = false;

            //
            // get a list of NPCs in the current space-time location
            //
            List <Npc> npcsInSpaceTimeLocation = _gameUniverse.GetNpcsBySpaceTimeLocationId(_gameSurvivor.IslandLocationID);

            if (npcsInSpaceTimeLocation.Count > 0)
            {
                DisplayGamePlayScreen("Chose Character to Speak With", Text.NpcsChooseList(npcsInSpaceTimeLocation), ActionMenu.NpcMenu, "");

                while (!validNpcId)
                {
                    //
                    // get an integer from the player
                    //
                    GetInteger($"Enter the Id number of the character you wish to speak with: ", 0, 0, out npcId);

                    //
                    // validate integer as a valid NPC id and in current location
                    //
                    if (_gameUniverse.IsValidNpcByLocationId(npcId, _gameSurvivor.IslandLocationID))
                    {
                        Npc npc = _gameUniverse.GetNpcById(npcId);
                        if (npc is ISpeak)
                        {
                            validNpcId = true;
                        }
                        else
                        {
                            ClearInputBox();
                            validNpcId = true;
                            npcId      = 0;
                            DisplayGamePlayScreen("Choose Character to Speak With", "It appears this character has nothing to say.", ActionMenu.NpcMenu, "");
                        }
                    }
                    else
                    {
                        ClearInputBox();
                        DisplayInputErrorMessage("It appears you entered and invalid NPC id. Please try again.");
                    }
                }
            }
            else
            {
                DisplayGamePlayScreen("Choose Character to Speak With", "It appears there are no NPCs here.", ActionMenu.NpcMenu, "");
            }

            return(npcId);
        }
예제 #3
0
        private void AskToScavenge()
        {
            //
            // display a list of NPCs in space-time location and get a player choice
            //
            int npcGetToScavenge = _gameConsoleView.DisplayGetNpcToAskToScavenge();

            //
            // get NPC to scavenge for an object
            // display object added to inventory
            //
            if (npcGetToScavenge != 0)
            {
                //
                // get the NPC from the universe
                //
                Animal theNpc = _gameUniverse.GetNpcById(npcGetToScavenge) as Animal;

                //
                // get found object and put it in inventory
                //
                List <SurvivorObject> objectsToScavengeFor = _gameUniverse.GetSurvivorObjectsByIslandLocationId(8);
                SurvivorObject        foundObject          = theNpc.ScavengeForObjects(objectsToScavengeFor);

                if (foundObject.IslandLocationId != 0)
                {
                    _gameConsoleView.DisplayConfirmScavengerObjectAddedToInventory(foundObject, theNpc);

                    //
                    // note: survivor object is added to list and the island location is set to 0
                    //
                    _gameSurvivor.Inventory.Add(foundObject);
                    foundObject.IslandLocationId = 0;

                    //
                    // update experience points, health, and lives
                    //
                    _gameSurvivor.ExperiencePoints += foundObject.ExperiencePoints;
                    _gameSurvivor.Health           += foundObject.HealthPoints;
                    _gameSurvivor.Lives            += foundObject.Lives;
                }
                else
                {
                    _gameConsoleView.DisplayScavengerErrorMessage(theNpc);
                }
            }
        }
예제 #4
0
        private void TalkToAction()
        {
            //
            // display a list of NPCs in space-time location and get a player choice
            //
            int npcToTalkToId = _gameConsoleView.DisplayGetNpcToTalkTo();

            //
            // display NPC's message
            //
            if (npcToTalkToId != 0)
            {
                //
                // get the NPC from the universe
                //
                Npc npc = _gameUniverse.GetNpcById(npcToTalkToId);

                //
                // display information for the object chosen
                //
                _gameConsoleView.DisplayTalkTo(npc);

                //
                // add experience points, lives, health
                //
                CrewMember theNpc = _gameUniverse.GetNpcById(npcToTalkToId) as CrewMember;

                _gameSurvivor.ExperiencePoints += theNpc.ExperiencePoints;
                _gameSurvivor.Health           += theNpc.Health;
                _gameSurvivor.Lives            += theNpc.Lives;

                //
                // unlock location if npc has a key
                //
                UnlockLocation(theNpc);
            }
        }
예제 #5
0
        /// <summary>
        /// allows player to talk to a specific NPC
        /// </summary>
        private void TalkToAction()
        {
            //
            // display a list of NPCs in the curren location
            // and get the player's choice
            //
            int npcToTalkToId = _gameConsoleView.DisplayGetNpcToTalkTo();

            //
            // display NPC's message
            //
            if (npcToTalkToId != 0)
            {
                //
                // get the NPC from the universe
                //
                Npc npc = _gameUniverse.GetNpcById(npcToTalkToId);

                //
                // display information for the object chosen
                //
                _gameConsoleView.DisplayTalkTo(npc);
            }
        }
예제 #6
0
        /// <summary>
        /// process the talk to action
        /// </summary>
        private void TalkToAction()
        {
            //
            // display a list of NPCs in location and get a player choice
            //
            int npcToTalkToId = _gameConsoleView.DisplayGetNpcToTalkTo();

            //
            // display NPC's message
            //
            if (npcToTalkToId != 0)
            {
                //
                // get the NPC from the universe
                //
                Npc npc = _gameUniverse.GetNpcById(npcToTalkToId);

                //
                // display information for the object chosen
                //
                _gameConsoleView.DisplayTalkTo(npc);

                //
                // update experience points for adding objects
                //
                Civilian civilian = npc as Civilian;
                _gamePlayer.ExperiencePoints += civilian.ExperiencePoints;

                //
                // remove life
                //
                if (civilian.IsDeadly)
                {
                    _gamePlayer.Lives -= 1;
                }
            }
        }