public void SpawnShip() { BaseGalleon gal; if (this is PirateCaptain) { gal = new OrcishGalleon(Direction.North); } else if (Map == Map.Tokuno) { gal = new TokunoGalleon(Direction.North); } else { gal = new GargishGalleon(Direction.North); } var p = Location; Map map = Map; // Move this sucka out of the way! Internalize(); if (gal.CanFit(p, map, gal.ItemID)) { gal.Owner = this; gal.MoveToWorld(p, map); m_Galleon = gal; Server.Engines.Quests.BountyQuestSpawner.FillHold(m_Galleon); MoveToWorld(new Point3D(p.X, p.Y - 1, gal.Z + gal.ZSurface), map); int crewCount = Utility.RandomMinMax(3, 5); for (int j = 0; j < crewCount; j++) { Mobile crew = new PirateCrew(); if (j == 0 && this is PirateCaptain) { crew.Title = "the orc captain"; } AddToCrew(crew); crew.MoveToWorld(new Point3D(gal.X + Utility.RandomList(-1, 1), gal.Y + Utility.RandomList(-1, 0, 1), gal.ZSurface), map); } gal.AutoAddCannons(this); return; } else { gal.Delete(); Delete(); } }
/*public override bool OnBeforeDeath() * { * * return base.OnBeforeDeath(); * }*/ public void SpawnCrew() { Defrag(); int family = m_crew.Count; if (family >= crewCount) { return; } Map map = this.Map; if (map == null) { return; } int hr = (int)((this.RangeHome + 1) / 2); for (int i = family; i < crewCount; ++i) { PirateCrew crew = new PirateCrew(); bool validLocation = false; Point3D loc = this.Location; for (int j = 0; !validLocation && j < 10; ++j) { int x = X + Utility.Random(5) - 1; int y = Y + Utility.Random(5) - 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); } } crew.master = this; crew.Team = this.Team; crew.Home = this.Location; crew.RangeHome = (hr > 4 ? 4 : hr); crew.MoveToWorld(loc, map); m_crew.Add(crew); } }
public void SpawnPirate(Mobile target) { Map map = target.Map; if (map == null) { return; } int pirates = 0; foreach (Mobile m in this.GetMobilesInRange(10)) { if (m is PirateCrew) { ++pirates; } } if (pirates < 10 && Utility.RandomDouble() <= 0.25) { BaseCreature PirateCrew = new PirateCrew(); Point3D loc = target.Location; bool validLocation = false; 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, 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); } } PirateCrew.MoveToWorld(loc, map); PirateCrew.Combatant = target; } }
public void Defrag() { for (int i = 0; i < m_crew.Count; ++i) { try { object o = m_crew[i]; PirateCrew crew = o as PirateCrew; if (crew == null || !crew.Alive) { m_crew.RemoveAt(i); --i; } } catch {} } }
public void SpawnPirate( Mobile target ) { Map map = target.Map; if ( map == null ) return; int pirates = 0; foreach ( Mobile m in this.GetMobilesInRange( 10 ) ) { if (m is PirateCrew) ++pirates; } if ( pirates < 10 && Utility.RandomDouble() <= 0.25) { BaseCreature PirateCrew = new PirateCrew(); Point3D loc = target.Location; bool validLocation = false; 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, 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 ); } PirateCrew.MoveToWorld(loc, map); PirateCrew.Combatant = target; } }
public override void OnThink() { #region Pirate Can Say Random Phrases From A [.txt] File if (DateTime.Now >= nextAbilityTime && Combatant == null && active == true) { nextAbilityTime = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(4, 6)); if (text == null) { try { text = new StreamReader(path, System.Text.Encoding.Default, false); } catch { } } Talk(); Emote(); } #endregion Pirate Can Say Random Phrases From A [.txt] File if(boatspawn == false) { Map map = this.Map; if ( map == null ) return; this.Z = 0; m_PirateShip_Boat = new PirateShip_Boat(); Point3D loc = this.Location; Point3D loccrew = this.Location; loc = new Point3D( this.X, this.Y-1, this.Z-5 ); loccrew = new Point3D( this.X, this.Y-1, this.Z+1 ); m_PirateShip_Boat.MoveToWorld(loc, map); boatspawn = true; for(int i = 0; i < 5; ++i) { PirateCrew m_PirateCrew = new PirateCrew(); m_PirateCrew.MoveToWorld(loccrew, map); } } base.OnThink(); if ( DateTime.Now < m_NextPickup ) return; if (m_PirateShip_Boat == null) { return; } m_NextPickup = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 1, 2 ) ); enemydirection = Direction.North; foreach ( Item enemy in this.GetItemsInRange( 200 ) ) { if (enemy is BaseBoat && enemy != m_PirateShip_Boat && !(enemy is PirateShip_Boat)) { List<Mobile> targets = new List<Mobile>(); IPooledEnumerable eable = enemy.GetMobilesInRange( 16 ); foreach ( Mobile m in eable ) { if ( m is PlayerMobile ) targets.Add( m ); } eable.Free(); if ( targets.Count > 0 ) { m_enemyboat = enemy as BaseBoat; enemydirection = this.GetDirectionTo(m_enemyboat); break; } } } if (m_enemyboat == null) { return; } if (m_PirateShip_Boat != null && m_enemyboat != null) { if (m_PirateShip_Boat != null && (enemydirection == Direction.North) && m_PirateShip_Boat.Facing != Direction.North) { m_PirateShip_Boat.Facing = Direction.North; } else if (m_PirateShip_Boat != null && (enemydirection == Direction.South) && m_PirateShip_Boat.Facing != Direction.South) { m_PirateShip_Boat.Facing = Direction.South; } else if (m_PirateShip_Boat != null && (enemydirection == Direction.East || enemydirection == Direction.Right || enemydirection == Direction.Down) && m_PirateShip_Boat.Facing != Direction.East) { m_PirateShip_Boat.Facing = Direction.East; } else if (m_PirateShip_Boat != null && (enemydirection == Direction.West || enemydirection == Direction.Left || enemydirection == Direction.Up) && m_PirateShip_Boat.Facing != Direction.West) { m_PirateShip_Boat.Facing = Direction.West; } m_PirateShip_Boat.StartMove(Direction.North, true); if (m_PirateShip_Boat != null && this.InRange(m_enemyboat, 10) && m_PirateShip_Boat.IsMoving == true) { m_PirateShip_Boat.StopMove(false); } } else { if (m_PirateShip_Boat != null && m_PirateShip_Boat.IsMoving == true) { m_PirateShip_Boat.StopMove(false); } } }
public void SpawnPirateAndGalleon(SpawnZone zone, Map map) { SpawnDefinition def = m_Zones[zone]; if (map != Map.Internal && map != null) { Rectangle2D rec = def.SpawnRegion; OrcishGalleon gal = new OrcishGalleon(Direction.North); PirateCaptain pirate = new PirateCaptain(gal); pirate.Zone = zone; gal.Owner = pirate; FillHold(gal); Point3D p = Point3D.Zero; bool spawned = false; for(int i = 0; i < 25; i++) { int x = Utility.Random(rec.X, rec.Width); int y = Utility.Random(rec.Y, rec.Height); p = new Point3D(x, y, -5); if (gal.CanFit(p, map, gal.ItemID)) { spawned = true; break; } } if (!spawned) { gal.Delete(); pirate.Delete(); return; } int gold = Utility.RandomMinMax(GoldRange[0], GoldRange[1]); gal.MoveToWorld(p, map); gal.AutoAddCannons(pirate); pirate.MoveToWorld(new Point3D(gal.X, gal.Y - 1, gal.ZSurface), map); int crewCount = Utility.RandomMinMax(3, 5); for (int i = 0; i < crewCount; i++) { Mobile crew = new PirateCrew(); if (i == 0) crew.Title = "the orc captain"; pirate.AddToCrew(crew); crew.MoveToWorld(new Point3D(gal.X + Utility.RandomList(-1, 1), gal.Y + Utility.RandomList(-1, 0, 1), gal.ZSurface), map); } Point2D[] course = def.GetRandomWaypoints(); gal.BoatCourse = new BoatCourse(gal, new List<Point2D>(def.GetRandomWaypoints())); gal.NextNavPoint = 0; gal.StartCourse(false, false); /*MapItem mapItem = new MapItem(map); if (map == Map.Tokuno) mapItem.SetDisplay(5, 5, 1448 - 32, 1448 - 10, 400, 400); else mapItem.SetDisplay(5, 5, 5120 - 32, 4096 - 10, 400, 400); for (int i = 0; i < course.Length; i++) mapItem.AddWorldPin(course[i].X, course[i].Y); pirate.Backpack.DropItem(mapItem); gal.MapItem = mapItem;*/ //mapItem.Name = "Pirate Map"; //if (0.90 > Utility.RandomDouble()) // mapItem.Movable = false; m_Bounties.Add(pirate, gold); m_ActiveZones[zone].Add(pirate); } }
public override void OnThink() { if(boatspawn == false) { Map map = this.Map; if ( map == null ) return; this.Z = 0; m_PirateShip_Boat = new PirateShip_Boat(); Point3D loc = this.Location; Point3D loccrew = this.Location; loc = new Point3D( this.X, this.Y-1, Map.GetAverageZ(this.X, this.Y)); loccrew = new Point3D( this.X, this.Y-1, loc.Z+1 ); m_PirateShip_Boat.MoveToWorld(loc, map); boatspawn = true; for(int i = 0; i < 5; ++i) { PirateCrew m_PirateCrew = new PirateCrew(); m_PirateCrew.MoveToWorld(loccrew, map); } } base.OnThink(); if ( DateTime.UtcNow < m_NextPickup ) return; if (m_PirateShip_Boat == null) { return; } m_NextPickup = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 1, 2 ) ); enemydirection = Direction.North; foreach ( Item enemy in this.GetItemsInRange( 200 ) ) { if (enemy is BaseBoat && enemy != m_PirateShip_Boat && !(enemy is PirateShip_Boat)) { List<Mobile> targets = new List<Mobile>(); IPooledEnumerable eable = enemy.GetMobilesInRange( 16 ); foreach ( Mobile m in eable ) { if ( m is PlayerMobile ) targets.Add( m ); } eable.Free(); if ( targets.Count > 0 ) { m_enemyboat = enemy as BaseBoat; enemydirection = this.GetDirectionTo(m_enemyboat); break; } } } if (m_enemyboat == null) { return; } if (m_PirateShip_Boat != null && m_enemyboat != null) { if (m_PirateShip_Boat != null && (enemydirection == Direction.North) && m_PirateShip_Boat.Facing != Direction.North) { m_PirateShip_Boat.Facing = Direction.North; } else if (m_PirateShip_Boat != null && (enemydirection == Direction.South) && m_PirateShip_Boat.Facing != Direction.South) { m_PirateShip_Boat.Facing = Direction.South; } else if (m_PirateShip_Boat != null && (enemydirection == Direction.East || enemydirection == Direction.Right || enemydirection == Direction.Down) && m_PirateShip_Boat.Facing != Direction.East) { m_PirateShip_Boat.Facing = Direction.East; } else if (m_PirateShip_Boat != null && (enemydirection == Direction.West || enemydirection == Direction.Left || enemydirection == Direction.Up) && m_PirateShip_Boat.Facing != Direction.West) { m_PirateShip_Boat.Facing = Direction.West; } m_PirateShip_Boat.StartMove(Direction.North, true); if (m_PirateShip_Boat != null && this.InRange(m_enemyboat, 10) && m_PirateShip_Boat.IsMoving == true) { m_PirateShip_Boat.StopMove(false); } } else { if (m_PirateShip_Boat != null && m_PirateShip_Boat.IsMoving == true) { m_PirateShip_Boat.StopMove(false); } } }
public override void OnThink() { #region Pirate Can Say Random Phrases From A [.txt] File if (DateTime.Now >= nextAbilityTime && Combatant == null && active == true) { nextAbilityTime = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(4, 6)); if (text == null) { try { text = new StreamReader(path, System.Text.Encoding.Default, false); } catch { } } Talk(); Emote(); } #endregion Pirate Can Say Random Phrases From A [.txt] File if (boatspawn == false) { Map map = this.Map; if (map == null) { return; } this.Z = 0; m_PirateShip_Boat = new PirateShip_Boat(); Point3D loc = this.Location; Point3D loccrew = this.Location; loc = new Point3D(this.X, this.Y - 1, this.Z - 5); loccrew = new Point3D(this.X, this.Y - 1, this.Z + 1); m_PirateShip_Boat.MoveToWorld(loc, map); boatspawn = true; for (int i = 0; i < 5; ++i) { PirateCrew m_PirateCrew = new PirateCrew(); m_PirateCrew.MoveToWorld(loccrew, map); } } base.OnThink(); if (DateTime.Now < m_NextPickup) { return; } if (m_PirateShip_Boat == null) { return; } m_NextPickup = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(1, 2)); enemydirection = Direction.North; foreach (Item enemy in this.GetItemsInRange(200)) { if (enemy is BaseBoat && enemy != m_PirateShip_Boat && !(enemy is PirateShip_Boat)) { List <Mobile> targets = new List <Mobile>(); IPooledEnumerable eable = enemy.GetMobilesInRange(16); foreach (Mobile m in eable) { if (m is PlayerMobile) { targets.Add(m); } } eable.Free(); if (targets.Count > 0) { m_enemyboat = enemy as BaseBoat; enemydirection = this.GetDirectionTo(m_enemyboat); break; } } } if (m_enemyboat == null) { return; } if (m_PirateShip_Boat != null && m_enemyboat != null) { if (m_PirateShip_Boat != null && (enemydirection == Direction.North) && m_PirateShip_Boat.Facing != Direction.North) { m_PirateShip_Boat.Facing = Direction.North; } else if (m_PirateShip_Boat != null && (enemydirection == Direction.South) && m_PirateShip_Boat.Facing != Direction.South) { m_PirateShip_Boat.Facing = Direction.South; } else if (m_PirateShip_Boat != null && (enemydirection == Direction.East || enemydirection == Direction.Right || enemydirection == Direction.Down) && m_PirateShip_Boat.Facing != Direction.East) { m_PirateShip_Boat.Facing = Direction.East; } else if (m_PirateShip_Boat != null && (enemydirection == Direction.West || enemydirection == Direction.Left || enemydirection == Direction.Up) && m_PirateShip_Boat.Facing != Direction.West) { m_PirateShip_Boat.Facing = Direction.West; } m_PirateShip_Boat.StartMove(Direction.North, true); if (m_PirateShip_Boat != null && this.InRange(m_enemyboat, 10) && m_PirateShip_Boat.IsMoving == true) { m_PirateShip_Boat.StopMove(false); } } else { if (m_PirateShip_Boat != null && m_PirateShip_Boat.IsMoving == true) { m_PirateShip_Boat.StopMove(false); } } }
public void SpawnShip() { BaseGalleon gal; if (this is PirateCaptain) gal = new OrcishGalleon(Direction.North); else if (this.Map == Map.Tokuno) gal = new TokunoGalleon(Direction.North); else gal = new GargishGalleon(Direction.North); if (gal.CanFit(this.Location, this.Map, gal.ItemID)) { gal.Owner = this; gal.MoveToWorld(this.Location, this.Map); m_Galleon = gal; Server.Engines.Quests.BountyQuestSpawner.FillHold(m_Galleon); this.MoveToWorld(new Point3D(gal.X, gal.Y - 1, gal.ZSurface), this.Map); int crewCount = Utility.RandomMinMax(3, 5); for (int j = 0; j < crewCount; j++) { Mobile crew = new PirateCrew(); if (j == 0 && this is PirateCaptain) crew.Title = "the orc captain"; AddToCrew(crew); crew.MoveToWorld(new Point3D(gal.X + Utility.RandomList(-1, 1), gal.Y + Utility.RandomList(-1, 0, 1), gal.ZSurface), this.Map); } gal.AutoAddCannons(this); return; } else { gal.Delete(); Delete(); } }
/*public override bool OnBeforeDeath() { return base.OnBeforeDeath(); }*/ public void SpawnCrew() { Defrag(); int family = m_crew.Count; if( family >= crewCount ) return; Map map = this.Map; if ( map == null ) return; int hr = (int)((this.RangeHome + 1) / 2); for ( int i = family; i < crewCount; ++i ) { PirateCrew crew = new PirateCrew(); bool validLocation = false; Point3D loc = this.Location; for ( int j = 0; !validLocation && j < 10; ++j ) { int x = X + Utility.Random( 5 ) - 1; int y = Y + Utility.Random( 5 ) - 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 ); } crew.master = this; crew.Team = this.Team; crew.Home = this.Location; crew.RangeHome = ( hr > 4 ? 4 : hr ); crew.MoveToWorld( loc, map ); m_crew.Add( crew ); } }
public override void OnThink() { if (boatspawn == false) { Map map = this.Map; if (map == null) { return; } this.Z = 0; m_PirateShip_Boat = new PirateShip_Boat(); Point3D loc = this.Location; Point3D loccrew = this.Location; loc = new Point3D(this.X, this.Y - 1, Map.GetAverageZ(this.X, this.Y)); loccrew = new Point3D(this.X, this.Y - 1, loc.Z + 1); m_PirateShip_Boat.MoveToWorld(loc, map); boatspawn = true; for (int i = 0; i < 5; ++i) { PirateCrew m_PirateCrew = new PirateCrew(); m_PirateCrew.MoveToWorld(loccrew, map); } } base.OnThink(); if (DateTime.UtcNow < m_NextPickup) { return; } if (m_PirateShip_Boat == null) { return; } m_NextPickup = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(1, 2)); enemydirection = Direction.North; foreach (Item enemy in this.GetItemsInRange(200)) { if (enemy is BaseBoat && enemy != m_PirateShip_Boat && !(enemy is PirateShip_Boat)) { List <Mobile> targets = new List <Mobile>(); IPooledEnumerable eable = enemy.GetMobilesInRange(16); foreach (Mobile m in eable) { if (m is PlayerMobile) { targets.Add(m); } } eable.Free(); if (targets.Count > 0) { m_enemyboat = enemy as BaseBoat; enemydirection = this.GetDirectionTo(m_enemyboat); break; } } } if (m_enemyboat == null) { return; } if (m_PirateShip_Boat != null && m_enemyboat != null) { if (m_PirateShip_Boat != null && (enemydirection == Direction.North) && m_PirateShip_Boat.Facing != Direction.North) { m_PirateShip_Boat.Facing = Direction.North; } else if (m_PirateShip_Boat != null && (enemydirection == Direction.South) && m_PirateShip_Boat.Facing != Direction.South) { m_PirateShip_Boat.Facing = Direction.South; } else if (m_PirateShip_Boat != null && (enemydirection == Direction.East || enemydirection == Direction.Right || enemydirection == Direction.Down) && m_PirateShip_Boat.Facing != Direction.East) { m_PirateShip_Boat.Facing = Direction.East; } else if (m_PirateShip_Boat != null && (enemydirection == Direction.West || enemydirection == Direction.Left || enemydirection == Direction.Up) && m_PirateShip_Boat.Facing != Direction.West) { m_PirateShip_Boat.Facing = Direction.West; } m_PirateShip_Boat.StartMove(Direction.North, true); if (m_PirateShip_Boat != null && this.InRange(m_enemyboat, 10) && m_PirateShip_Boat.IsMoving == true) { m_PirateShip_Boat.StopMove(false); } } else { if (m_PirateShip_Boat != null && m_PirateShip_Boat.IsMoving == true) { m_PirateShip_Boat.StopMove(false); } } }