Ejemplo n.º 1
0
        public int Battle(int level)
        {
            Console.WriteLine("You try to slay the monster... ");

            rounds++;

            System.Threading.Thread.Sleep(1000);

            int maxRan = 10 - level;

            if (maxRan < 1)
            {
                maxRan = 1;
            }

            int ran = RandomGenerator.GetRandomNumber(maxRan);

            if (ran == 0)
            {
                Console.WriteLine("he's dead!");
                context.SetState(context.GetExploreState());

                int tempRounds = rounds;
                rounds = 0;

                return(tempRounds);
            }
            else
            {
                Console.WriteLine("but fail..");
            }

            if (rounds >= 9)
            {
                Console.WriteLine("You panic and run away in fear");
                context.SetState(context.GetExploreState());

                rounds = 0;
            }
            return(0);
        }
Ejemplo n.º 2
0
        public int Explore()
        {
            Console.WriteLine("You are looking around for something to kill!!");

            int ran = RandomGenerator.GetRandomNumber(5);

            if (newMap.getCurrentPosition() == 2)             //changed
            {
                Console.WriteLine("A monster!!! Prepare for battle!!");
                context.SetState(context.GetBattleState());
            }

            if (ran == 1)
            {
                Console.WriteLine("You find a golden jewel behind a tree!!");
                return(2);
            }

            return(0);
        }