public void SpawnRatmen(Mobile target) { Map map = this.Map; if (map == null) { return; } int rats = 0; foreach (Mobile m in this.GetMobilesInRange(10)) { if (m is Ratman || m is RatmanArcher || m is RatmanMage) { ++rats; } } if (rats < 16) { PlaySound(0x3D); int newRats = Utility.RandomMinMax(3, 6); for (int i = 0; i < newRats; ++i) { BaseCreature rat; switch (Utility.Random(5)) { default: case 0: case 1: rat = new Ratman(); break; case 2: case 3: rat = new RatmanArcher(); break; case 4: rat = new RatmanMage(); break; } rat.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); } } rat.MoveToWorld(loc, map); rat.Combatant = target; } } }
public void SpawnRatmen(Mobile target) { Map map = this.Map; if (map == null) return; int rats = 0; IPooledEnumerable eable = this.GetMobilesInRange(10); foreach (Mobile m in eable) { if (m is Ratman || m is RatmanArcher || m is RatmanMage) ++rats; } eable.Free(); if (rats < 16) { int newRats = Utility.RandomMinMax(3, 6); try { for (int i = 0; i < newRats; ++i) { BaseCreature rat; switch (Utility.Random(5)) { default: case 0: case 1: rat = new Ratman(); break; case 2: case 3: rat = new RatmanArcher(); break; case 4: rat = new RatmanMage(); break; } rat.Team = this.Team; bool validLocation = false; Point3D loc = this.Location; for (int j = 0; !validLocation && j < 10; ++j) { int x = target.X + Utility.Random(3) - 1; int y = target.Y + Utility.Random(3) - 1; int z = map.GetAverageZ(x, y); if (validLocation = map.CanFit(x, y, target.Z, 16, CanFitFlags.requireSurface)) loc = new Point3D(x, y, Z); else if (validLocation = map.CanFit(x, y, z, 16, CanFitFlags.requireSurface)) loc = new Point3D(x, y, z); } rat.MoveToWorld(loc, map); rat.Combatant = target; } } catch (Exception e) { LogHelper.LogException(e); Console.WriteLine("Exception (non-fatal) caught at Barracoon.Damage: " + e.Message); } } }
public void SpawnRatmen(Mobile target) { Map map = this.Map; if (map == null) { return; } int rats = 0; IPooledEnumerable eable = this.GetMobilesInRange(10); foreach (Mobile m in eable) { if (m is Ratman || m is RatmanArcher || m is RatmanMage) { ++rats; } } eable.Free(); if (rats < 16) { int newRats = Utility.RandomMinMax(3, 6); try { for (int i = 0; i < newRats; ++i) { BaseCreature rat; switch (Utility.Random(5)) { default: case 0: case 1: rat = new Ratman(); break; case 2: case 3: rat = new RatmanArcher(); break; case 4: rat = new RatmanMage(); break; } rat.Team = this.Team; bool validLocation = false; Point3D loc = this.Location; for (int j = 0; !validLocation && j < 10; ++j) { int x = target.X + Utility.Random(3) - 1; int y = target.Y + Utility.Random(3) - 1; int z = map.GetAverageZ(x, y); if (validLocation = map.CanFit(x, y, target.Z, 16, CanFitFlags.requireSurface)) { loc = new Point3D(x, y, Z); } else if (validLocation = map.CanFit(x, y, z, 16, CanFitFlags.requireSurface)) { loc = new Point3D(x, y, z); } } rat.MoveToWorld(loc, map); rat.Combatant = target; } } catch (Exception e) { LogHelper.LogException(e); Console.WriteLine("Exception (non-fatal) caught at Barracoon.Damage: " + e.Message); } } }
public void SpawnRatmen(Mobile target) { Map map = Map; if (map == null) { return; } int rats = GetMobilesInRange(10).Cast<Mobile>().Count(m => m is Ratman || m is RatmanArcher || m is RatmanMage); if (rats < 6) { PlaySound(0x3D); int newRats = Utility.RandomMinMax(3, 5); for (int i = 0; i < newRats; ++i) { BaseCreature rat; switch (Utility.Random(5)) { default: case 0: case 1: rat = new Ratman(); break; case 2: case 3: rat = new RatmanArcher(); break; case 4: rat = new RatmanMage(); break; } rat.Team = Team; Point3D loc = Location; for (int j = 0; j < 10; ++j) { int x = X + Utility.Random(3) - 1; int y = Y + Utility.Random(3) - 1; int z = map.GetAverageZ(x, y); if (false == map.CanFit(x, y, Z, 16, false, false)) { loc = new Point3D(x, y, Z); } else if (false == map.CanFit(x, y, z, 16, false, false)) { loc = new Point3D(x, y, z); } } rat.MoveToWorld(loc, map); // take away insta kill //rat.Combatant = target; } } }
public void SpawnRatmen( Mobile target ) { Map map = this.Map; if ( map == null ) return; int rats = 0; foreach ( Mobile m in this.GetMobilesInRange( 10 ) ) { if ( m is Ratman || m is RatmanArcher || m is RatmanMage ) ++rats; } if ( rats < 16 ) { PlaySound( 0x3D ); int newRats = Utility.RandomMinMax( 3, 6 ); for ( int i = 0; i < newRats; ++i ) { BaseCreature rat; switch ( Utility.Random( 5 ) ) { default: case 0: case 1: rat = new Ratman(); break; case 2: case 3: rat = new RatmanArcher(); break; case 4: rat = new RatmanMage(); break; } rat.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 ); } rat.MoveToWorld( loc, map ); rat.Combatant = target; } } }
public void SpawnRatmen(Mobile target) { Map map = Map; if (map == null) { return; } int rats = GetMobilesInRange(10).Cast <Mobile>().Count(m => m is Ratman || m is RatmanArcher || m is RatmanMage); if (rats < 6) { PlaySound(0x3D); int newRats = Utility.RandomMinMax(3, 5); for (int i = 0; i < newRats; ++i) { BaseCreature rat; switch (Utility.Random(5)) { default: case 0: case 1: rat = new Ratman(); break; case 2: case 3: rat = new RatmanArcher(); break; case 4: rat = new RatmanMage(); break; } rat.Team = Team; Point3D loc = Location; for (int j = 0; j < 10; ++j) { int x = X + Utility.Random(3) - 1; int y = Y + Utility.Random(3) - 1; int z = map.GetAverageZ(x, y); if (false == map.CanFit(x, y, Z, 16, false, false)) { loc = new Point3D(x, y, Z); } else if (false == map.CanFit(x, y, z, 16, false, false)) { loc = new Point3D(x, y, z); } } rat.MoveToWorld(loc, map); // take away insta kill //rat.Combatant = target; } } }