Example #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);
            }
        }
Example #2
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;
                }
            }
        }