public void Equip(string weaponName) { foreach (Weapon weapon in inventory) { if (weapon.Name == weaponName) equippedWeapon = weapon; } }
public void NewLevel(Random random) { level++; switch (level) { case 1: Enemies = new List<Enemy>(); Enemies.Add(new Bat(this, GetRandomLocation(random))); WeaponInRoom = new Sword(this, GetRandomLocation(random)); break; case 2: Enemies = new List<Enemy>(); Enemies.Add(new Ghost(this,GetRandomLocation(random))); WeaponInRoom = new BluePotion(this,GetRandomLocation(random)); break; case 3: Enemies = new List<Enemy>(); Enemies.Add(new Ghoul(this,GetRandomLocation(random))); WeaponInRoom = new Bow(this,GetRandomLocation(random)); break; case 4: Enemies = new List<Enemy>(); Enemies.Add(new Bat(this,GetRandomLocation(random))); Enemies.Add(new Ghost(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>(); Enemies.Add(new Bat(this,GetRandomLocation(random))); Enemies.Add(new Ghoul(this,GetRandomLocation(random))); WeaponInRoom = new RedPotion(this,GetRandomLocation(random)); break; case 6: Enemies = new List<Enemy>(); Enemies.Add(new Ghost(this,GetRandomLocation(random))); Enemies.Add(new Ghost(this,GetRandomLocation(random))); WeaponInRoom = new Mace(this,GetRandomLocation(random)); break; case 7: Enemies = new List<Enemy>(); Enemies.Add(new Bat(this,GetRandomLocation(random))); Enemies.Add(new Ghost(this,GetRandomLocation(random))); Enemies.Add(new Ghoul(this,GetRandomLocation(random))); if (player.Weapons.Contains("Mace")) { WeaponInRoom = new RedPotion(this,GetRandomLocation(random)); } else { WeaponInRoom = new Mace(this,GetRandomLocation(random)); } break; } }