示例#1
0
 internal void Attack(Direction direction, Random random)
 {
     if (equippedWeapon != null)
     {
         if (equippedWeapon is IPotion)
         {
             if (equippedWeapon.Name == "Blue Potion")
             {
                 BluePotion currentWeapon = equippedWeapon as BluePotion;
                 currentWeapon.Attack(direction, random);
                 equippedWeapon = null;
             }
             else
             {
                 RedPotion currentWeapon = equippedWeapon as RedPotion;
                 currentWeapon.Attack(direction, random);
                 equippedWeapon = null;
             }
         }
         else
         {
             equippedWeapon.Attack(direction, random);
         }
     }
 }
示例#2
0
        public void Attack(Direction direction, Random random)
        {
            if (equippedWeapon != null)
            {
                switch (equippedWeapon.Name)
                {
                case "Sword":
                    Sword sword = (Sword)equippedWeapon;
                    sword.Attack(direction, random);
                    break;

                case "Bow":
                    Bow bow = (Bow)equippedWeapon;
                    bow.Attack(direction, random);
                    break;

                case "Mace":
                    Mace mace = (Mace)equippedWeapon;
                    mace.Attack(direction, random);
                    break;

                case "Blue Potion":
                    BluePotion bluePotion = (BluePotion)equippedWeapon;
                    bluePotion.Attack(direction, random);
                    break;

                case "Red Potion":
                    RedPotion redPotion = (RedPotion)equippedWeapon;
                    redPotion.Attack(direction, random);
                    break;
                }
            }
        }
示例#3
0
 private void SetWeaponByLevel(Random random)
 {
     if (!CheckPlayerInventory("Sword") &&
         level == 1)
     {
         WeaponInRoom = new Sword(this, GetRandomLocation(random));
     }
     else if (!CheckPlayerInventory("Bow") &&
              (level == 3 || level == 4))
     {
         WeaponInRoom = new Bow(this, GetRandomLocation(random));
     }
     else if (!CheckPlayerInventory("Battle Axe") &&
              (level == 5 || level == 7))
     {
         WeaponInRoom = new BattleAxe(this, GetRandomLocation(random));
     }
     else if (!CheckPlayerInventory("Mace") &&
              (level == 6 || level == 7))
     {
         WeaponInRoom = new Mace(this, GetRandomLocation(random));
     }
     else if (!CheckPlayerInventory("Quiver") &&
              level == 7)
     {
         WeaponInRoom = new Quiver(this, GetRandomLocation(random));
     }
     else if (!CheckPlayerInventory("Bomb") &&
              level == 8)
     {
         WeaponInRoom = new Bomb(this, GetRandomLocation(random));
     }
     else if (!CheckPlayerInventory("Shield") &&
              level == 9)
     {
         WeaponInRoom = new Shield(this, GetRandomLocation(random));
     }
     else if (!CheckPlayerInventory("Blue Potion") &&
              (level == 2 || level == 4 || level == 8))
     {
         WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
     }
     else if (!CheckPlayerInventory("Red Potion") &&
              (level == 4 || level == 5 || level == 7) || level == 9)
     {
         WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
     }
 }
示例#4
0
        public void NewLevel(Random random)
        {
            _level++;
            switch (_level)
            {
            case 1:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Sword(this, GetRandomLocation(random));
                break;

            case 2:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                break;

            case 3:
                Enemies = new List <Enemy>()
                {
                    new Ghoul(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Bow(this, GetRandomLocation(random));
                break;

            case 4:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghost(this, GetRandomLocation(random)),
                };
                if (CheckPlayerInventory("Bow"))
                {
                    if (_isUsedBluePotion)
                    {
                        WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                    }
                }
                else
                {
                    WeaponInRoom = new Bow(this, GetRandomLocation(random));
                }
                break;

            case 5:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                break;

            case 6:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random))
                };
                WeaponInRoom = new Mace(this, GetRandomLocation(random));
                break;

            case 7:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random))
                };
                if (CheckPlayerInventory("Mace"))
                {
                    if (_isUsedRedPotion)
                    {
                        WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                    }
                }
                else
                {
                    WeaponInRoom = new Mace(this, GetRandomLocation(random));
                }
                break;

            case 8:
                Application.Exit();
                break;
            }
        }
示例#5
0
        public void NewLevel(Random random)
        {
            level++;
            switch (level)
            {
            case 1:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Sword(this, GetRandomLocation(random));
                break;

            case 2:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                break;

            case 3:
                Enemies = new List <Enemy>()
                {
                    new Ghoul(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Bow(this, GetRandomLocation(random));
                break;

            case 4:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghost(this, GetRandomLocation(random)),
                };
                if (!CheckPlayerInventory("Bow"))
                {
                    WeaponInRoom = new Bow(this, GetRandomLocation(random));
                }
                else
                {
                    if (!CheckPlayerInventory("Blue Potion"))
                    {
                        WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                    }
                }
                break;

            case 5:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                break;

            case 6:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Mace(this, GetRandomLocation(random));
                break;

            case 7:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random)),
                };
                if (!CheckPlayerInventory("Mace"))
                {
                    WeaponInRoom = new Mace(this, GetRandomLocation(random));
                }
                else
                {
                    if (!CheckPlayerInventory("Red Potion"))
                    {
                        WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                    }
                }
                break;

            default:
                break;
            }
        }
示例#6
0
        public void NewLevel(Random random)
        {
            level++;

            switch (level)
            {
            case 1:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Sword(this, GetRandomLocation(random));
                break;

            case 2:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                break;

            case 3:
                Enemies = new List <Enemy>()
                {
                    new Ghoul(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Bow(this, GetRandomLocation(random));
                break;

            case 4:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghost(this, GetRandomLocation(random)),
                };
                if (!CheckPlayerInventory("Bow"))
                {
                    WeaponInRoom = new Bow(this, GetRandomLocation(random));
                }
                else if (!CheckPlayerInventory("Blue Potion"))
                {
                    WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                }
                break;

            case 5:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                break;

            case 6:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Mace(this, GetRandomLocation(random));
                break;

            case 7:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random)),
                };
                if (!CheckPlayerInventory("Mace"))
                {
                    WeaponInRoom = new Mace(this, GetRandomLocation(random));
                }
                else if (!CheckPlayerInventory("Red Potion"))
                {
                    WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                }
                break;

            default:
                DialogResult result = MessageBox.Show("Congratulations!  You beat the game!", "The End", MessageBoxButtons.OK);
                Debug.WriteLine(level);
                if (result == DialogResult.OK)
                {
                    Application.Exit();
                }
                break;
            }
        }
示例#7
0
        /// <summary>
        /// Takes care of setting up the levels
        /// </summary>
        /// <param name="random"></param>
        public void NewLevel(Random random)
        {
            level++;
            switch (level)
            {
            case 1:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Sword(this, GetRandomLocation(random));
                break;

            case 2:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                break;

            case 3:
                Enemies = new List <Enemy>()
                {
                    new Ghoul(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Bow(this, GetRandomLocation(random));
                break;

            case 4:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghost(this, GetRandomLocation(random)),
                };
                if (!CheckPlayerInventory("Bow"))
                {
                    WeaponInRoom = new Bow(this, GetRandomLocation(random));
                }
                else if (!CheckPlayerInventory("Blue Potion"))
                {
                    WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                }
                else
                {
                    WeaponInRoom = null;
                }
                break;

            case 5:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random)),
                };

                WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                break;

            case 6:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random)),
                };

                WeaponInRoom = new Mace(this, GetRandomLocation(random));
                break;

            case 7:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random)),
                };

                if (!CheckPlayerInventory("Mace"))
                {
                    WeaponInRoom = new Mace(this, GetRandomLocation(random));
                }
                else if (!CheckPlayerInventory("Red Potion"))
                {
                    WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                }
                else
                {
                    WeaponInRoom = null;
                }
                break;

            case 8:
                MessageBox.Show("You completed the game!");
                Application.Exit();
                break;
            }
        }
示例#8
0
文件: Game.cs 项目: wicked2/TheQuest
        public void NewLevel(Random random)
        {
            level++;
            switch (level)
            {
            case 1:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLoction(random))
                };
                WeaponInRoom = new Sword(this, GetRandomLoction(random));

                break;

            case 4:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLoction(random))
                };
                WeaponInRoom = new BluePotion(this, GetRandomLoction(random));
                break;

            case 3:
                Enemies = new List <Enemy>()
                {
                    new Ghoul(this, GetRandomLoction(random))
                };
                WeaponInRoom = new Bow(this, GetRandomLoction(random));
                break;

            case 2:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLoction(random)), new Ghost(this, GetRandomLoction(random))
                };
                if (!WeaponInRoom.PickedUp)
                {
                    WeaponInRoom = new Bow(this, GetRandomLoction(random));
                }
                else if (!CheckPlayerInventory("Blue Potion"))
                {
                    WeaponInRoom = new BluePotion(this, GetRandomLoction(random));
                }
                break;

            case 5:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLoction(random)), new Ghoul(this, GetRandomLoction(random))
                };
                WeaponInRoom = new RedPotion(this, GetRandomLoction(random));
                break;

            case 6:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLoction(random)), new Ghoul(this, GetRandomLoction(random))
                };
                WeaponInRoom = new Mace(this, GetRandomLoction(random));
                break;

            case 7:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLoction(random)), new Ghost(this, GetRandomLoction(random)), new Ghoul(this, GetRandomLoction(random))
                };
                if (!WeaponInRoom.PickedUp)
                {
                    WeaponInRoom = new Mace(this, GetRandomLoction(random));
                }
                else if (!CheckPlayerInventory("Red Potion"))
                {
                    WeaponInRoom = new RedPotion(this, GetRandomLoction(random));
                }
                break;

            case 8:
                Application.Exit();
                break;
            }
        }
示例#9
0
        public bool NewLevel(Random random)
        {
            level++;
            switch (level)
            {
            case 1:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Sword(this, GetRandomLocation(random));
                break;

            case 2:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random))
                };
                WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                break;

            case 3:
                Enemies = new List <Enemy>()
                {
                    new Ghoul(this, GetRandomLocation(random))
                };
                WeaponInRoom = new Bow(this, GetRandomLocation(random));
                break;

            case 4:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random)),
                    new Bat(this, GetRandomLocation(random))
                };
                if (player.Weapons.Contains("Bow"))
                {
                    WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                }
                else
                {
                    WeaponInRoom = new Bow(this, GetRandomLocation(random));
                }
                break;

            case 5:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random))
                };
                WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                break;

            case 6:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random))
                };
                WeaponInRoom = new Mace(this, GetRandomLocation(random));
                break;

            case 7:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random))
                };
                if (player.Weapons.Contains("Mace"))
                {
                    WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                }
                else
                {
                    WeaponInRoom = new Mace(this, GetRandomLocation(random));
                }
                break;

            default:
                MessageBox.Show("Congrats! You've beaten the game!");
                return(false);
            }
            return(true);
        }
示例#10
0
        public void NewLevel(Random random)
        {
            level++;
            switch (level)
            {
            case 1:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Sword(this, GetRandomLocation(random));
                break;

            case 2:
                Enemies.Clear();
                Enemies.Add(new Ghost(this, GetRandomLocation(random)));
                WeaponInRoom = new Sword(this, GetRandomLocation(random));
                WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                break;

            case 3:
                Enemies.Clear();
                Enemies.Add(new Gnoul(this, GetRandomLocation(random)));
                WeaponInRoom = new Bow(this, GetRandomLocation(random));
                break;

            case 4:
                Enemies.Clear();
                Enemies.Add(new Bat(this, GetRandomLocation(random)));
                Enemies.Add(new Ghost(this, GetRandomLocation(random)));
                if (!PlayerWeapons.Contains("Bow"))
                {
                    WeaponInRoom = new Bow(this, GetRandomLocation(random));
                }
                else
                if (!PlayerWeapons.Contains("Blue Potion"))
                {
                    WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                }
                break;

            case 5:
                Enemies.Clear();
                Enemies.Add(new Bat(this, GetRandomLocation(random)));
                Enemies.Add(new Gnoul(this, GetRandomLocation(random)));
                WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                break;

            case 6:
                Enemies.Clear();
                Enemies.Add(new Ghost(this, GetRandomLocation(random)));
                Enemies.Add(new Gnoul(this, GetRandomLocation(random)));
                WeaponInRoom = new Mace(this, GetRandomLocation(random));
                break;

            case 7:
                Enemies.Clear();
                Enemies.Add(new Bat(this, GetRandomLocation(random)));
                Enemies.Add(new Ghost(this, GetRandomLocation(random)));
                Enemies.Add(new Gnoul(this, GetRandomLocation(random)));
                if (!PlayerWeapons.Contains("Mace"))
                {
                    WeaponInRoom = new Mace(this, GetRandomLocation(random));
                }
                else
                if (!PlayerWeapons.Contains("Red Potion"))
                {
                    WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                }
                break;

            case 8:
                Application.Exit();
                break;
            }
        }
示例#11
0
文件: Game.cs 项目: raduATL/TheQuest
        public void NewLevel(Random random)
        {
            level++;
            switch (level)
            {
            case 1:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random))
                };
                WeaponInRoom = new Sword(this, GetRandomLocation(random));
                break;

            case 2:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                break;

            case 3:
                Enemies = new List <Enemy>()
                {
                    new Ghoul(this, GetRandomLocation(random))
                };
                if (!PlayerWeapons.Contains("Bomb"))
                {
                    WeaponInRoom = new Bomb(this, GetRandomLocation(random));
                }
                else
                {
                    WeaponInRoom = new Bow(this, GetRandomLocation(random));
                }
                break;

            case 4:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghost(this, GetRandomLocation(random))
                };
                if (!PlayerWeapons.Contains("Bow"))
                {
                    WeaponInRoom = new Bow(this, GetRandomLocation(random));
                }
                else if (!PlayerWeapons.Contains("Blue Potion"))
                {
                    WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                }
                else
                {
                    WeaponInRoom = new Bomb(this, GetRandomLocation(random));
                }
                break;

            case 5:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random))
                };
                WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                break;

            case 6:
                Enemies = new List <Enemy>()
                {
                    new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random))
                };
                WeaponInRoom = new Mace(this, GetRandomLocation(random));
                break;

            case 7:
                Enemies = new List <Enemy>()
                {
                    new Bat(this, GetRandomLocation(random)),
                    new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random))
                };
                if (!PlayerWeapons.Contains("Mace"))
                {
                    WeaponInRoom = new Mace(this, GetRandomLocation(random));
                }
                else if (!PlayerWeapons.Contains("Red Potion"))
                {
                    WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                }
                break;

            default:
                Environment.Exit(0);
                break;
            }
        }
示例#12
0
        public void NewLevel(Random random)
        {
            level++;
            switch (level)
            {
            case 1:
                Enemies = new List <Enemy>
                {
                    new Bat(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Sword(this, GetRandomLocation(random));
                break;

            case 2:
                Enemies = new List <Enemy>
                {
                    new Ghost(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                break;

            case 3:
                Enemies = new List <Enemy>
                {
                    new Ghoul(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Bow(this, GetRandomLocation(random));
                break;

            case 4:
                Enemies = new List <Enemy>
                {
                    new Bat(this, GetRandomLocation(random)), new Ghost(this, GetRandomLocation(random)),
                };

                if (!player.Weapons.Contains("Bow"))
                {
                    WeaponInRoom = new Bow(this, GetRandomLocation(random));
                }
                else if (!player.Weapons.Contains("BluePotion"))
                {
                    WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
                }
                break;

            case 5:
                Enemies = new List <Enemy>
                {
                    new Bat(this, GetRandomLocation(random)), new Ghoul(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                break;

            case 6:
                Enemies = new List <Enemy>
                {
                    new Ghost(this, GetRandomLocation(random)), new Ghoul(this, GetRandomLocation(random)),
                };
                WeaponInRoom = new Mace(this, GetRandomLocation(random));
                break;

            case 7:
                Enemies = new List <Enemy>
                {
                    new Bat(this, GetRandomLocation(random)), new Ghost(this, GetRandomLocation(random)),
                    new Ghoul(this, GetRandomLocation(random)),
                };

                if (!player.Weapons.Contains("Mace"))
                {
                    WeaponInRoom = new Mace(this, GetRandomLocation(random));
                }
                else if (!player.Weapons.Contains("RedPotion"))
                {
                    WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
                }
                break;

            case 8:
                MessageBox.Show("You have completed the quest!");
                System.Environment.Exit(0);
                break;
            }
        }