コード例 #1
0
        public Rooms(int id, string roomname, string description, int exitN, int exitE, int exitS, int exitW, int mobId)
        {
            RoomName    = roomname;
            Description = description;
            ID          = id;
            ExitEast    = exitE;
            ExitNorth   = exitN;
            ExitWest    = exitW;
            ExitSouth   = exitS;

            // Adding a random monster to the list to use later inside of rooms
            if (mobId != 4)
            {
                if (mobId > 1)
                {
                    Random rand = new Random();

                    int getNewMob = rand.Next(0, 4);
                    RoomsMob = new Mobs(IDA.Mob[getNewMob]);
                    RoomMobs.Add(RoomsMob);
                }
            }
            else
            {
                RoomMobs.Add(IDA.FindMobID(mobId));
            }
        }
コード例 #2
0
 // Creating a mob object to be used to interact with player object.
 public Mobs(Mobs newMob) : base(newMob.Health, newMob.Race)
 {
     ID          = newMob.ID;
     Name        = newMob.Name;
     MobInfo     = newMob.MobInfo;
     MobDmgType  = newMob.MobDmgType;
     MobWeakness = newMob.MobWeakness;
     Health      = newMob.Health;
     Race        = newMob.Race;
 }
コード例 #3
0
ファイル: Look.cs プロジェクト: William-Merritt/AWayBack
        public static void lookForVerb(string noun)
        {
            Mobs lookForMob = IDA.FindMobName(noun);

            if (lookForMob != null)
            {
                foreach (Mobs mob in Player.CurrentRoom.RoomMobs.ToList())
                {
                    if (mob.Name == lookForMob.Name)
                    {
                        MobFound(mob);
                    }
                }
            }
        }
コード例 #4
0
        public static void CommenceCombat(string noun, Player player)
        {
            if (Player.CurrentRoom.RoomMobs == null)
            {
                Console.WriteLine("Nothing to attack. You're safe.");
            }
            else
            {
                Mobs newMob = new Mobs();

                Console.WriteLine($"Fighting --->{newMob.Name}\n" +
                                  $"Boss Current HP is --> {newMob.Health}");

                Console.WriteLine(" ");

                Random rand = new Random();

                int combat = rand.Next(20) + 1;

                Console.WriteLine($"You hit the boss for {combat} points! ");
                Console.WriteLine(" ");

                newMob.Health -= combat;

                Console.WriteLine($"Boss Current HP is --> {newMob.Health}");
                Console.WriteLine(" ");

                Console.WriteLine($"Fighting --->{player.Name}\n" +
                                  $"Boss Current HP is --> {player.Health}");
                Console.WriteLine(" ");

                int combat2 = rand.Next(20) + 1;
                Console.WriteLine($"You were hit for {combat2} points! ");
                Console.WriteLine(" ");
                player.Health -= combat2;

                Console.WriteLine($"Your Current HP is --> {player.Health}");
                Console.WriteLine(" ");
                Console.ReadLine();
            }
        }
コード例 #5
0
ファイル: Look.cs プロジェクト: William-Merritt/AWayBack
 public static string MobFound(Mobs lookForMob)
 {
     return($"Name: {lookForMob.Name}\n" +
            $"Health: {lookForMob.Health}");
 }