public void Equip(string weaponName) { foreach(Weapon weapon in inventory) { if (weapon.Name == weaponName) { equippedWeapon = weapon; } } }
public void Attack(Direction direction, Random random) { if (equippedWeapon == null) { return; } if (direction == Direction.None) { return; } equippedWeapon.Attack(direction, random); if (equippedWeapon is IPotion || equippedWeapon is IExplosive) { // Drink potion or explode bomb inventory.Remove(equippedWeapon); equippedWeapon = null; } }
public void NewLevel(Random random) { /* NÍVEL INIMIGOS ARMAS 2 --------- Fantasmas ----------------- Porção Azul. 3 --------- Morte --------------------- Arco. 4 --------- Morcego, Fantasma --------- Arco, se não foi pego no 3, caso contrário porção azul. 5 --------- Morcego, Morte ------------ Porção vermelha. 6 --------- Fantasma, Morte ----------- Mangual. 7 --------- Morcego, Fantasma, Morte -- Mangual, se não foi pego no 6, caso contrário porção vermelha. OBS.: Só aparece se a porção vermelha do nível 5 foi usada 8 --------- N/A ----------------------- N/A - termina o jogo com Application.Exit(). */ level++; switch (level) { case 1: Enemies = new List<Enemy>(); Enemies.Add(new Morcego(this, GetRandomLocation(random))); WeaponInRoom = new Espada(this, GetRandomLocation(random)); break; case 2: Enemies = new List<Enemy>(); Enemies.Add(new Fantasma(this, GetRandomLocation(random))); if (!PlayerWeapons.Contains("Porção Azul")) WeaponInRoom = new BluePotion(this, GetRandomLocation(random)); break; case 3: Enemies = new List<Enemy>(); Enemies.Add(new Morte(this, GetRandomLocation(random))); WeaponInRoom = new Arco(this, GetRandomLocation(random)); break; case 4: Enemies = new List<Enemy>(); Enemies.Add(new Morcego(this, GetRandomLocation(random))); Enemies.Add(new Fantasma(this, GetRandomLocation(random))); /**/ if(PlayerWeapons.Contains("Arco") && !PlayerWeapons.Contains("Poção Azul")) WeaponInRoom = new BluePotion(this, GetRandomLocation(random)); else WeaponInRoom = new Arco(this, GetRandomLocation(random)); /**/ break; case 5: Enemies = new List<Enemy>(); Enemies.Add(new Morcego(this, GetRandomLocation(random))); Enemies.Add(new Morte(this, GetRandomLocation(random))); WeaponInRoom = new RedPotion(this, GetRandomLocation(random)); break; case 6: Enemies = new List<Enemy>(); Enemies.Add(new Fantasma(this, GetRandomLocation(random))); Enemies.Add(new Morte(this, GetRandomLocation(random))); WeaponInRoom = new Mangual(this, GetRandomLocation(random)); break; case 7: Enemies = new List<Enemy>(); Enemies.Add(new Morcego(this, GetRandomLocation(random))); Enemies.Add(new Fantasma(this, GetRandomLocation(random))); Enemies.Add(new Morte(this, GetRandomLocation(random))); /**/ if (PlayerWeapons.Contains("Mangual") && !PlayerWeapons.Contains("Porção Vermelha")) WeaponInRoom = new RedPotion(this, GetRandomLocation(random)); else WeaponInRoom = new Arco(this, GetRandomLocation(random)); /**/ break; //default: // MessageBox.Show("Fim de Jogo!"); // Application.ExitThread(); // break; } }
public void NewLevel(Random random) { level++; switch (level) { case 1: Enemies = new List<Enemy>(); Enemies.Add(new Bat(this, GetRandomLocation(random), new Size(30, 30))); WeaponInRoom = new Sword(this, GetRandomLocation(random)); break; case 2: Enemies.Clear(); Enemies.Add(new Ghost(this, GetRandomLocation(random), new Size(30, 30))); WeaponInRoom = new BluePotion(this, GetRandomLocation(random)); break; case 3: Enemies.Clear(); Enemies.Add(new Ghoul(this, GetRandomLocation(random), new Size(30, 30))); WeaponInRoom = new Bow(this, GetRandomLocation(random)); break; case 4: Enemies.Clear(); Enemies.Add(new Bat(this, GetRandomLocation(random), new Size(30, 30))); Enemies.Add(new Ghost(this, GetRandomLocation(random), new Size(30, 30))); WeaponInRoom = null; if (CheckPlayerInventory("Bow")) { if (!CheckPlayerInventory("Blue Potion") || (CheckPlayerInventory("Blue Potion") && CheckPotionUsed("Blue Potion"))) { WeaponInRoom = new BluePotion(this, GetRandomLocation(random)); } } else { WeaponInRoom = new Bow(this, GetRandomLocation(random)); } break; case 5: Enemies.Clear(); Enemies.Add(new Bat(this, GetRandomLocation(random), new Size(30, 30))); Enemies.Add(new Ghoul(this, GetRandomLocation(random), new Size(30, 30))); WeaponInRoom = new RedPotion(this, GetRandomLocation(random)); break; case 6: Enemies.Clear(); Enemies.Add(new Ghost(this, GetRandomLocation(random), new Size(30, 30))); Enemies.Add(new Ghoul(this, GetRandomLocation(random), new Size(30, 30))); WeaponInRoom = new Mace(this, GetRandomLocation(random)); break; case 7: Enemies.Clear(); Enemies.Add(new Bat(this, GetRandomLocation(random), new Size(30, 30))); Enemies.Add(new Ghost(this, GetRandomLocation(random), new Size(30, 30))); Enemies.Add(new Ghoul(this, GetRandomLocation(random), new Size(30, 30))); WeaponInRoom = null; if (CheckPlayerInventory("Mace")) { if (!CheckPlayerInventory("Red Potion") || (CheckPlayerInventory("Red Potion") && CheckPotionUsed("Red Potion"))) { WeaponInRoom = new RedPotion(this, GetRandomLocation(random)); } } else { WeaponInRoom = new Mace(this, GetRandomLocation(random)); } break; case 8: Application.Exit(); break; } }
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))); if (CheckPlayerInventory(bluePotion)) { return; } else { WeaponInRoom = new bluePotion(this, GetRandomLocation(random)); } break; case 3: Enemies = new List<Enemy>(); Enemies.Add(new Ghoul(this, GetRandomLocation(random))); if (CheckPlayerInventory(Bow)) { return; } else { WeaponInRoom = new Bow(this, GetRandomLocation(random)); } break; case 4: Enemies = new List<Enemy>(); Enemies.Add(new Ghost(this, GetRandomLocation(random))); Enemies.Add(new Bat(this, GetRandomLocation(random))); if (CheckPlayerInventory(Bow)) { WeaponInRoom = new bluePotion(this, GetRandomLocation(random)); } else { WeaponInRoom = new Bow(this, GetRandomLocation(random)); } break; case 5: Enemies = new List<Enemy>(); Enemies.Add(new Ghoul(this, GetRandomLocation(random))); Enemies.Add(new Bat(this, GetRandomLocation(random))); if (CheckPlayerInventory(redPotion)) { return; } else { WeaponInRoom = new redPotion(this, GetRandomLocation(random)); } break; case 6: Enemies = new List<Enemy>(); Enemies.Add(new Ghoul(this, GetRandomLocation(random))); Enemies.Add(new Ghost(this, GetRandomLocation(random))); if (CheckPlayerInventory(Mace)) { return; } else { WeaponInRoom = new Mace(this, GetRandomLocation(random)); } break; case 7: Enemies = new List<Enemy>(); Enemies.Add(new Ghoul(this, GetRandomLocation(random))); Enemies.Add(new Bat(this, GetRandomLocation(random))); Enemies.Add(new Ghost(this, GetRandomLocation(random))); if (CheckPlayerInventory(Mace)) { return; } else { WeaponInRoom = new redPotion(this, GetRandomLocation(random)); } break; case 8: System.Windows.Forms.Application.Exit(); } }
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)); } }