Ejemplo n.º 1
0
 //Method: Player give item
 public void PlayerGiveItem(Item item, Npc npc)
 {
     player.RemoveItem(item);
     npc.AddItem(item);
 }
Ejemplo n.º 2
0
 //Method: Npc give item
 public void NpcGiveItem(Item item, Npc npc)
 {
     npc.RemoveItem(item);
     player.AddItem(item);
     return;
 }
Ejemplo n.º 3
0
        public MainGame()
        {
            allRooms    = new List <Room>();
            allNpcs     = new List <Npc>();
            turnCounter = 0;
            Player mainPlayer = new Player(100);

            player = mainPlayer;

            //Map

            //Driveway
            Room r1  = new Room("Driveway", "A long road led to the noble entrance doors of 'Battenberg Mannor'. Tall, well maintained hedges surrounded the place. My car was standing in front of the large marble stairs.");
            Item car = new Item("car", "My car, an old Hudson that had seen better days.", false);

            r1.AddItem(car);

            //Entrance Hall
            Room r2          = new Room("Entrance Hall", "A large room, with several columns and a floor made out of marvel. Two police officers were gathering around a lifeless body.");
            Item dagger      = new Item("dagger", "The dagger was completely made out of stone. Strange symbols were engraved in the blade. They looked familiar to me, althoug i was shure that i had never seen them bevore.", true);
            Item body        = new Item("dead body", "The dead Body of a young woman. She got stabbed in the chest with a fancy dagger, but it seemed to had missed hear heart.", false);
            Item bloodtraces = new Item("blood trace", "There were blood traces on the floor. As if the victim would have runned for her life and collapsed there. The trace seemed to leed to the eastern door.", false);
            Item note        = new Item("note", "In the victims pocket was a note. On the note was written: 'Meet me in the library' It was signed with the letter 'C'.", true);
            Npc  butler      = new Npc("Alfred Sharp", "Grey hair, a small mustache and a perfectly aligned suit dressed that man. He looked exactly like you would imagine a butler to look like.", true, "Well Mr. Grifford, despite this terrible happenings today, i have much work to do. Because of the absence of Lord Charlie Battenberg till tomorrow. And before you ask, i have been in the service Room this whole day, assisting Lady Battenberg. The only strange thing, exept the 'incident', is that my precious cleaning mop is missing since this morning.", 100, r2);
            Npc  police      = new Npc("The Police", "Two police officers guarded the crime scene.", false, "Well Mr. Grifford, you may start with your investigation. If you should find anything... conclusive, don't hesitade to tell us.", 100, r2);

            r2.AddItem(dagger);
            r2.AddItem(note);
            r2.AddItem(body);
            r2.AddItem(bloodtraces);
            r2.AddNpc(police);

            //Dining Hall
            Room r3   = new Room("Dining Hall", "A long dining table filled the middle of the room. It was prepared for one person.");
            Npc  lady = new Npc("Lady Battenberg", "She was an elder lady. Light grey hair and a classical long dress finished her look.", false, "Oh, it is terrible! Poor Isabelle... She left this world too early. And what is my husband going to say when he returns... . I nearly forgott, this is the key to my husbands office. You might need it for your investigation.", 100, r3);
            Item key  = new Item("key", "The Key to the office of Lord Battenberg", true);

            lady.AddItem(key);

            //Kitchen
            Room r4   = new Room("Kitchen", "A white stained room, that looked like a kitchen, that is used by experienced people.");
            Npc  cook = new Npc("Agate Murror", "A well feeded woman, with short brown hair. She was wearing a typical white kitchen uniform and looked quite bussy", false, "I don't know what happened. I have been in the kitchen the whole day. I was looking for a thief. In the last days, food has been disappearing and i am going to find out why!", 100, r4);

            //Floor
            Room r5 = new Room("Floor", "A long floor with several doors.");

            //Library
            Room r6    = new Room("Library", "Tall bookshelfes covered the walls. Cobwebs and dust were all over the place. Execpt one shelf. It looked well used.");
            Item floor = new Item("wet floor", "The floor seemed to be cleaned not long ago.", false);
            Item book1 = new Item("book: Ancient south american mythology", "A book about the Atztecs and theyr mythology and rituals.", true);
            Item book2 = new Item("book: A quick guide to get rich", "A book that will help your family get rich in just three generations.", true);
            Item book3 = new Item("book: The Red Circle", "A documentation about the mediacal history of pox.", true);
            Item book4 = new Item("book: Fantastical secret doors and how to find them", "A book about secret doors in old mansions and castles.", true);

            r6.AddItem(floor);
            r6.AddItem(book1);
            r6.AddItem(book2);
            r6.AddItem(book3);
            r6.AddItem(book4);

            //Office
            Room r7 = new Room("Office", "A small room with a large desk in the middle. Many books lied on the table. Lord Battenberg seemed to be very interrested in ancient history. Especially in the culture of the Atztecs and Mayas.");

            //Secret Passage
            Room r8   = new Room("Secret passage", "A long tunnel, with torches. Strange, they were burning.");
            Item mop  = new Item("cleaning mop", "A mop, that is mostly used to clean the ground. It was wet.", true);
            Item food = new Item("food leftovers", "Someone or something hasn't finish its last meal.", false);

            r8.AddItem(mop);
            r8.AddItem(food);

            //Secret Chamber
            Room r9   = new Room("Secret chamber", "The chamber was filled with torch light. In the middle was a man, bowed over an altar of stone. It was edged in blood.");
            Npc  lord = new Npc("Lord Battenberg", "He was spilled with blood. His face was mad. He wispered strange words in a language i could not understand. And his mad eyes starred at me.", true, "Oh, who are you? Mhh, actually it doesn't matter anyway. You will make a fine addition to my ritual!", 100, r9);

            //Add Doors
            r1.AddDoor(new Door(Door.Directions.North, r2, "north", false));
            r2.AddDoor(new Door(Door.Directions.South, r1, "south", false));
            r2.AddDoor(new Door(Door.Directions.West, r3, "west", false));
            r2.AddDoor(new Door(Door.Directions.East, r5, "east", false));
            r3.AddDoor(new Door(Door.Directions.North, r4, "north", false));
            r3.AddDoor(new Door(Door.Directions.East, r2, "east", false));
            r4.AddDoor(new Door(Door.Directions.South, r3, "south", false));
            r5.AddDoor(new Door(Door.Directions.West, r2, "west", false));
            r5.AddDoor(new Door(Door.Directions.East, r7, "east", true));
            r5.AddDoor(new Door(Door.Directions.North, r6, "north", false));
            r6.AddDoor(new Door(Door.Directions.South, r5, "south", false));
            r7.AddDoor(new Door(Door.Directions.West, r5, "west", false));
            r8.AddDoor(new Door(Door.Directions.South, r6, "south", false));
            r8.AddDoor(new Door(Door.Directions.North, r9, "north", false));
            r9.AddDoor(new Door(Door.Directions.South, r8, "south", false));

            allNpcs.Add(butler);
            allNpcs.Add(lady);
            allNpcs.Add(cook);
            allNpcs.Add(lord);

            allRooms.Add(r1);
            allRooms.Add(r2);
            allRooms.Add(r3);
            allRooms.Add(r4);
            allRooms.Add(r5);
            allRooms.Add(r6);
            allRooms.Add(r7);
            allRooms.Add(r8);
            allRooms.Add(r9);

            //r1.AddNpc(allNpcs.Find(x => x.GetCurrentRoom().Equals(r1)));
            r2.AddNpc(allNpcs.Find(x => x.GetCurrentRoom().Equals(r2)));
            r3.AddNpc(allNpcs.Find(x => x.GetCurrentRoom().Equals(r3)));
            r4.AddNpc(allNpcs.Find(x => x.GetCurrentRoom().Equals(r4)));
            //r5.AddNpc(allNpcs.Find(x => x.GetCurrentRoom().Equals(r5)));
            //r6.AddNpc(allNpcs.Find(x => x.GetCurrentRoom().Equals(r6)));
            //r7.AddNpc(allNpcs.Find(x => x.GetCurrentRoom().Equals(r7)));
            //r8.AddNpc(allNpcs.Find(x => x.GetCurrentRoom().Equals(r8)));
            r9.AddNpc(allNpcs.Find(x => x.GetCurrentRoom().Equals(r9)));

            currentRoom   = r1;
            secretPassage = r8;
            currentNpc    = butler;
            currentEnemy  = lord;

            //Intro
            Console.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("It was one of those rainy days in London, when I, Ian Griffort, private Detective, got called to help by the local Police.");
            Console.WriteLine("The house maiden had been found dead. Stabbed in the chest with a dagger.");
            Console.WriteLine("It took about an hour, then I arrived at Battenberg Manor.");
            Console.WriteLine("The Police had already finished its investigation but it ended without a result.");
            Console.WriteLine("It was on me, to find out what happened there.");
            Console.WriteLine("\nI arrived at the ");
            ShowRoom();
            Console.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("For a list of commands type 'h' or 'help'.");
        }
Ejemplo n.º 4
0
        //Method: Attack <Npc>
        public void Attack(string command)
        {
            if (command == "attack")
            {
                Console.WriteLine("\nI knew i had to attack, but whom?");
                return;
            }

            if (currentRoom.GetNpcs().Exists(x => x.GetName().ToLower().Equals(command.ToLower().Substring(7))))
            {
                currentEnemy = currentRoom.GetNpcs().Find(x => x.GetName().ToLower() == command.ToLower().Substring(7));

                if (currentEnemy.GetFightable() == true)
                {
                    Console.WriteLine("The fight began!");
                    while ((player.GetHealth() > 0) & (currentEnemy.GetHealth() > 0))
                    {
                        int attackValuePlayer = 1;
                        int attackValueNpc    = 0;
                        Console.WriteLine("I attacked " + currentEnemy.GetName() + ".");

                        if (attackValuePlayer > attackValueNpc)
                        {
                            currentEnemy.ReduceHealth();
                            Console.WriteLine("That attack did hit!");
                        }
                        else
                        {
                            Console.WriteLine("I remember missing that attack!");
                        }
                        Console.WriteLine("Mhh, i can't remember if i did continue the fight... (y/n)");
                        if (Console.ReadLine() == "n")
                        {
                            Console.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
                            currentRoom = lastRoom;
                            Console.WriteLine("I managed to escape the fight into the " + currentRoom.GetTitle() + "!");
                            return;
                        }
                        if (Console.ReadLine() == "y")
                        {
                            Console.WriteLine("---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
                            Console.WriteLine(currentEnemy.GetName() + " attacked!");
                            if (attackValueNpc != attackValuePlayer)
                            {
                                player.ReduceHealth();
                                Console.WriteLine(currentEnemy.GetName() + "'s attack did hit!");
                                Console.WriteLine("I felt like i had " + player.GetHealth() + "% of my strenght remaining.");
                            }
                            else
                            {
                                Console.WriteLine("I remember " + currentEnemy.GetName() + " missing that attack!");
                            }
                        }
                    }
                }

                else
                {
                    Console.WriteLine("I can't remember fighting against " + currentEnemy.GetName() + ".");
                    return;
                }

                if (player.GetHealth() > 0)
                {
                    Console.WriteLine("My enemy trambeled and died. " + currentEnemy.GetName() + " lied dead on the ground.");
                    Item deadEnemy = new Item("Dead body of " + currentEnemy.GetName(), currentEnemy.GetDescription() + " But then " + currentEnemy.GetName() + " lied dead to my feet.", false);
                    currentRoom.AddItem(deadEnemy);
                    currentRoom.RemoveNpc(currentEnemy);
                    return;
                }
                else
                {
                    Console.WriteLine("And that is how I died. It is strange when you think about it.");
                    Console.WriteLine("\n-The game ended-");
                    gameOver = true;
                    Update();
                    return;
                }
            }
            else
            {
                Console.WriteLine("There was no " + command.Substring(7) + " to attack.");
                return;
            }
        }
Ejemplo n.º 5
0
 public void AddNpc(Npc npc)
 {
     npcs.Add(npc);
 }