public void SpawnVampireBats(Mobile target) { Map map = this.Map; if (map == null) { return; } int newVampireBats = Utility.RandomMinMax(1, 2); for (int i = 0; i < newVampireBats; ++i) { VampireBat vb = new VampireBat(); vb.Team = this.Team; vb.FightMode = FightMode.Closest; 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); } } vb.MoveToWorld(loc, map); vb.Combatant = target; } }
public void SpawnVampireBats( Mobile target ) { Map map = this.Map; if( map == null ) return; int newVampireBats = 3; for( int i = 0; i < newVampireBats; ++i ) { VampireBat vb = new VampireBat(); vb.Team = this.Team; vb.FightMode = FightMode.Closest; 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 ); } vb.MoveToWorld( loc, map ); vb.Combatant = target; } }
public void SpawnBats(Mobile target) { Map map = this.Map; if (map == null) return; int bats = 0; IPooledEnumerable eable = this.GetMobilesInRange(10); foreach (Mobile m in eable) { if (m is VampireBat) ++bats; } eable.Free(); if (bats < 16) { int newRats = Utility.RandomMinMax(3, 6); try { for (int i = 0; i < newRats; ++i) { BaseCreature bat; bat = new VampireBat(); bat.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); } bat.MoveToWorld(loc, map); bat.Combatant = target; } } catch (Exception e) { LogHelper.LogException(e); Console.WriteLine("Exception (non-fatal) caught at VladDracula.Damage: " + e.Message); } } }
public void SpawnBats(Mobile target) { Map map = this.Map; if (map == null) { return; } int bats = 0; IPooledEnumerable eable = this.GetMobilesInRange(10); foreach (Mobile m in eable) { if (m is VampireBat) { ++bats; } } eable.Free(); if (bats < 16) { int newRats = Utility.RandomMinMax(3, 6); try { for (int i = 0; i < newRats; ++i) { BaseCreature bat; bat = new VampireBat(); bat.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); } } bat.MoveToWorld(loc, map); bat.Combatant = target; } } catch (Exception e) { LogHelper.LogException(e); Console.WriteLine("Exception (non-fatal) caught at VladDracula.Damage: " + e.Message); } } }