Exemplo n.º 1
0
 public void Equip(string weaponName)
 {
     foreach (Weapon weapon in inventory)
     {
         if (weapon.Name == weaponName)
             equippedWeapon = weapon;
     }
 }
Exemplo n.º 2
0
 public void Attack(Direction direction, Random random)
 {
     if (equippedWeapon != null)
     {
         equippedWeapon.Attack(direction, random);
         if (equippedWeapon is IPotion)
         {
             inventory.Remove(equippedWeapon);
             if (inventory.Count > 0)
                 equippedWeapon = inventory[0];
             else
                 equippedWeapon = null;
         }
     }
 }
Exemplo n.º 3
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)),
             };
             if (!CheckPlayerInventory("Blue Potion"))
                 WeaponInRoom = new BluePotion(this, GetRandomLocation(random));
             break;
         case 3:
             Enemies = new List<Enemy>() {
                 new Ghoul(this, GetRandomLocation(random)),
             };
             if (!CheckPlayerInventory("Bow"))
                 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)),
             };
             if (!CheckPlayerInventory("Red Potion"))
                 WeaponInRoom = new RedPotion(this, GetRandomLocation(random));
             break;
         case 6:
             Enemies = new List<Enemy>() {
                 new Ghost(this, GetRandomLocation(random)),
                 new Ghoul(this, GetRandomLocation(random)),
             };
             if (!CheckPlayerInventory("Mace"))
                 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;
         case 8:
             Victory = true;
             break;
         default: break;
     }
 }