public void SpawnUndeadArmy(Mobile target) { Map map = this.Map; if (map == null) { return; } int knights = 0; foreach (Mobile m in this.GetMobilesInRange(10)) { if (m is UndeadKnight || m is WailingBanshee) { ++knights; } } if (knights < 1) { PlaySound(0x567); int newUndead = Utility.Random(13); for (int i = 0; i < newUndead; ++i) { BaseCreature skeleton; switch (Utility.Random(2)) { default: case 0: skeleton = new WailingBanshee(); break; case 1: skeleton = new UndeadKnight(); break; } skeleton.Team = this.Team; bool validLocation = false; Point3D loc = this.Location; for (int j = 0; !validLocation && j < 10; ++j) { int x = X + Utility.Random(3) - 1; int y = Y + Utility.Random(3) - 1; int z = map.GetAverageZ(x, y); if (validLocation = map.CanFit(x, y, this.Z, 16, false, false)) { loc = new Point3D(x, y, Z); } else if (validLocation = map.CanFit(x, y, z, 16, false, false)) { loc = new Point3D(x, y, z); } } skeleton.MoveToWorld(loc, map); skeleton.Combatant = target; } } }
public void SpawnUndeadArmy(Mobile target) { Map map = this.Map; if (map == null) return; int knights = 0; foreach (Mobile m in this.GetMobilesInRange(10)) { if (m is UndeadKnight || m is WailingBanshee) ++knights; } if (knights < 1) { PlaySound(0x567); int newUndead = Utility.Random(13); for (int i = 0; i < newUndead; ++i) { BaseCreature skeleton; switch (Utility.Random(2)) { default: case 0: skeleton = new WailingBanshee(); break; case 1: skeleton = new UndeadKnight(); break; } skeleton.Team = this.Team; bool validLocation = false; Point3D loc = this.Location; for (int j = 0; !validLocation && j < 10; ++j) { int x = X + Utility.Random(3) - 1; int y = Y + Utility.Random(3) - 1; int z = map.GetAverageZ(x, y); if (validLocation = map.CanFit(x, y, this.Z, 16, false, false)) loc = new Point3D(x, y, Z); else if (validLocation = map.CanFit(x, y, z, 16, false, false)) loc = new Point3D(x, y, z); } skeleton.MoveToWorld(loc, map); skeleton.Combatant = target; } } }