public void SpawnWaterElemental(Mobile m) { Map map = this.Map; if (map == null) { return; } WaterElemental spawned = new WaterElemental(); spawned.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); } } spawned.MoveToWorld(loc, map); spawned.Combatant = m; }
public static void HandleThrow(BaseBeverage beverage, WaterElemental elemental, Mobile thrower) { if (!beverage.IsFull) { thrower.SendLocalizedMessage(1113038); } else if (!thrower.InRange(elemental.Location, 5)) // It is not full. { thrower.SendLocalizedMessage(500295); // You are too far away to do that. } else if (!elemental.HasDecanter) { thrower.SendLocalizedMessage(1115895); // It seems that this water elemental no longer has a magical decanter... } else if (0.1 > Utility.RandomDouble()) { thrower.RevealingAction(); elemental.Damage(1, thrower); elemental.HasDecanter = false; beverage.Delete(); thrower.AddToBackpack(new EndlessDecanter()); thrower.SendLocalizedMessage(1115897); // The water elemental has thrown a magical decanter back to you! } else { thrower.RevealingAction(); elemental.Damage(1, thrower); beverage.Delete(); thrower.PlaySound(0x040); thrower.SendLocalizedMessage(1115896); // The water pitcher has shattered. } }
public void DoSpawn() { Map map = this.Map; if (map != null && Utility.RandomBool()) { this.PlaySound(0x218);////////// int newFollowers = Utility.RandomMinMax(2, 5); Mobile focus = GetRandomTarget(10, false); if (focus != null) { for (int i = 0; i < newFollowers; ++i) { BaseCreature spawn; switch (Utility.Random(5)) { default: case 0: spawn = new WaterElemental(); break; case 1: spawn = new EarthElemental(); break; case 2: spawn = new FireSteed(); break; case 3: spawn = new FireElemental(); break; case 4: spawn = new AirElemental(); break; } spawn.Team = this.Team; bool validLocation = false; Point3D loc = focus.Location; for (int j = 0; !validLocation && j < 10; ++j) { int x = Utility.RandomMinMax(focus.X - 1, focus.X + 1); int y = Utility.RandomMinMax(focus.Y - 1, focus.Y + 1); int z = map.GetAverageZ(x, y); if (validLocation = map.CanFit(x, y, this.Z, 16, false, false)) { loc = new Point3D(x, y, this.Z); } else if (validLocation = map.CanFit(x, y, z, 16, false, false)) { loc = new Point3D(x, y, z); } } spawn.MoveToWorld(loc, map); spawn.Combatant = focus; } } } }
private void FinishEffect( Point3D p ) { int count = Utility.RandomMinMax( 1, 3 ); if ( Hue != 0x8A0 ) count += Utility.RandomMinMax( 1, 2 ); Map map = this.Map; for ( int i = 0; map != null && i < count; ++i ) { BaseCreature spawn; switch ( Utility.Random( 4 ) ) { default: case 0: spawn = new SeaSerpent(); break; case 1: spawn = new DeepSeaSerpent(); break; case 2: spawn = new WaterElemental(); break; case 3: spawn = new Kraken(); break; } int x = p.X, y = p.Y; for ( int j = 0; j < 20; ++j ) { int tx = p.X - 5 + Utility.Random( 11 ); int ty = p.Y - 5 + Utility.Random( 11 ); Tile t = map.Tiles.GetLandTile( tx, ty ); if ( t.Z == p.Z && ( (t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137) ) && !Spells.SpellHelper.CheckMulti( new Point3D( tx, ty, p.Z ), map ) ) { x = tx; y = ty; break; } } spawn.MoveToWorld( new Point3D( x, y, p.Z ), map ); if ( spawn is Kraken && 0.2 > Utility.RandomDouble() ) spawn.PackItem( new MessageInABottle( map == Map.Felucca ? Map.Felucca : Map.Trammel ) ); } Delete(); }
protected virtual void FinishEffect( Point3D p, Map map, Mobile from ) { from.RevealingAction(); int count = GetSpawnCount(); for ( int i = 0; map != null && i < count; ++i ) { BaseCreature spawn; switch ( Utility.Random( 4 ) ) { default: case 0: spawn = new SeaSerpent(); break; case 1: spawn = new DeepSeaSerpent(); break; case 2: spawn = new WaterElemental(); break; case 3: spawn = new Kraken(); break; } Spawn( p, map, spawn ); spawn.Combatant = from; } Delete(); }
public void SpawnFollowers(Mobile target) { Map map = this.Map; if (map == null) return; int followers = 0; foreach (Mobile m in this.GetMobilesInRange(10)) { if (m is EarthElemental || m is FireElemental || m is AirElemental || m is FireSteed || m is WaterElemental) ++followers; } if (this.Followers < 9) { this.PlaySound(0x218);////////// int newFollowers = Utility.RandomMinMax(1, 3); for (int i = 0; i < newFollowers; ++i) { BaseCreature follower; switch (Utility.Random(5)) { default: case 0: follower = new WaterElemental(); break; case 1: follower = new EarthElemental(); break; case 2: follower = new FireSteed(); break; case 3: follower = new FireElemental(); break; case 4: follower = new AirElemental(); break; } follower.Team = this.Team; bool validLocation = false; Point3D loc = this.Location; for (int j = 0; !validLocation && j < 9; ++j) { int x = this.X + Utility.Random(3) - 1; int y = this.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, this.Z); else if (validLocation = map.CanFit(x, y, z, 16, false, false)) loc = new Point3D(x, y, z); } follower.MoveToWorld(loc, map); follower.Combatant = target; } } }
public void SpawnFollowers(Mobile target) { Map map = this.Map; if (map == null) { return; } int followers = 0; foreach (Mobile m in this.GetMobilesInRange(10)) { if (m is EarthElemental || m is FireElemental || m is AirElemental || m is FireSteed || m is WaterElemental) { ++followers; } } if (this.Followers < 9) { this.PlaySound(0x218);////////// int newFollowers = Utility.RandomMinMax(1, 3); for (int i = 0; i < newFollowers; ++i) { BaseCreature follower; switch (Utility.Random(5)) { default: case 0: follower = new WaterElemental(); break; case 1: follower = new EarthElemental(); break; case 2: follower = new FireSteed(); break; case 3: follower = new FireElemental(); break; case 4: follower = new AirElemental(); break; } follower.Team = this.Team; bool validLocation = false; Point3D loc = this.Location; for (int j = 0; !validLocation && j < 9; ++j) { int x = this.X + Utility.Random(3) - 1; int y = this.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, this.Z); } else if (validLocation = map.CanFit(x, y, z, 16, false, false)) { loc = new Point3D(x, y, z); } } follower.MoveToWorld(loc, map); follower.Combatant = target; } } }
protected override void OnTick() { if ( m_Item.Deleted ) return; Mobile spawn; switch ( Utility.Random( 10 ) ) { default: case 0: spawn = new AirElemental(); break; case 1: spawn = new EarthElemental(); break; case 2: spawn = new WaterElemental(); break; case 3: spawn = new FireElemental(); break; case 4: spawn = new IceElemental(); break; case 5: spawn = new SnowElemental(); break; case 6: spawn = new Efreet(); break; case 7: spawn = new BloodElemental(); break; case 8: spawn = new PoisonElemental(); break; } spawn.MoveToWorld( m_Item.Location, m_Item.Map ); m_Item.Delete(); }
private void FinishEffect( Point3D p ) { int count = Utility.RandomMinMax( 1, 3 ); if ( Hue != 0x8A0 ) count += Utility.RandomMinMax( 1, 2 ); Map map = this.Map; for ( int i = 0; map != null && i < count; ++i ) { BaseCreature spawn; switch ( Utility.Random( 2 ) ) { default: case 0: spawn = new SeaSerpent(); break; case 1: spawn = new WaterElemental(); break; } int x = p.X, y = p.Y; for ( int j = 0; j < 20; ++j ) { int tx = p.X - 5 + Utility.Random( 11 ); int ty = p.Y - 5 + Utility.Random( 11 ); LandTile t = map.Tiles.GetLandTile( tx, ty ); if ( t.Z == p.Z && ( (t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137) ) && !Spells.SpellHelper.CheckMulti( new Point3D( tx, ty, p.Z ), map ) ) { x = tx; y = ty; break; } } spawn.Map = map; spawn.Location = new Point3D( x, y, p.Z ); } Delete(); }
public override Item Construct(Type type, Mobile from) { if (type == typeof(TreasureMap)) { int level; //if ( from is PlayerMobile && ((PlayerMobile)from).Young && from.Map == Map.Trammel && TreasureMap.IsInHavenIsland( from ) ) // level = 0; //else level = 1; return new TreasureMap(level, Map.Felucca); } else if (type == typeof(MessageInABottle)) { return new MessageInABottle( /*from.Map == Map.Felucca ?*/ Map.Felucca /* : Map.Trammel*/); } Container pack = from.Backpack; if (pack != null) { List<SOS> messages = pack.FindItemsByType<SOS>(); for (int i = 0; i < messages.Count; ++i) { SOS sos = messages[i]; if (from.Map == sos.TargetMap && from.InRange(sos.TargetLocation, (int)(from.Skills[SkillName.Fishing].Value - 75.0))) { Item preLoot = null; switch (Utility.Random(8)) { case 0: // Body parts { var list = new[] { 0x1CDD, 0x1CE5, // arm 0x1CE0, 0x1CE8, // torso 0x1CE1, 0x1CE9, // head 0x1CE2, 0x1CEC // leg }; preLoot = new ShipwreckedItem(Utility.RandomList(list)); break; } case 1: // Bone parts { var list = new[] { 0x1AE0, 0x1AE1, 0x1AE2, 0x1AE3, 0x1AE4, // skulls 0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, // bone piles 0x1B15, 0x1B16 // pelvis bones }; preLoot = new ShipwreckedItem(Utility.RandomList(list)); break; } case 2: // Paintings and portraits { preLoot = new ShipwreckedItem(Utility.Random(0xE9F, 10)); break; } case 3: // Pillows { preLoot = new ShipwreckedItem(Utility.Random(0x13A4, 11)); break; } case 4: // Shells { preLoot = new ShipwreckedItem(Utility.Random(0xFC4, 9)); break; } case 5: //Hats { if (Utility.RandomBool()) { preLoot = new SkullCap(); } else { preLoot = new TricorneHat(); } break; } case 6: // Misc { var list = new[] { 0x1EB5, // unfinished barrel 0xA2A, // stool 0xC1F, // broken clock 0x1047, 0x1048, // globe 0x1EB1, 0x1EB2, 0x1EB3, 0x1EB4 // barrel staves }; if (Utility.Random(list.Length + 1) == 0) { preLoot = new Candelabra(); } else { preLoot = new ShipwreckedItem(Utility.RandomList(list)); } break; } } if (preLoot != null) { if (preLoot is IShipwreckedItem) { ((IShipwreckedItem)preLoot).IsShipwreckedItem = true; } return preLoot; } LockableContainer chest = null; switch (Utility.Random(3)) { case 0: chest = new MetalGoldenChest(); break; case 1: chest = new MetalChest(); break; default: case 2: chest = new WoodenChest(); break; } chest.Breakable = false; chest.Locked = false; if (sos.IsAncient) { int hue = 1150; if (0.20 > Utility.RandomDouble()) { switch (Utility.Random((chest is WoodenChest) ? 6 : 14)) { case 0: hue = 1193; break; case 1: hue = 1281; break; case 2: hue = 1190; break; case 3: hue = 1165; break; case 4: hue = 1160; break; case 5: hue = 1126; break; case 6: hue = CraftResources.GetInfo(CraftResource.Valorite).Hue; break; case 7: hue = CraftResources.GetInfo(CraftResource.Verite).Hue; break; case 8: hue = CraftResources.GetInfo(CraftResource.Agapite).Hue; break; case 9: hue = CraftResources.GetInfo(CraftResource.Gold).Hue; break; case 10: hue = CraftResources.GetInfo(CraftResource.Bronze).Hue; break; case 11: hue = CraftResources.GetInfo(CraftResource.Copper).Hue; break; case 12: hue = CraftResources.GetInfo(CraftResource.ShadowIron).Hue; break; case 13: hue = CraftResources.GetInfo(CraftResource.DullCopper).Hue; break; } } chest.Hue = hue; } else if ((chest is MetalChest || chest is MetalGoldenChest) && (0.5 * sos.Level) >= Utility.RandomDouble()) { int randhue = Utility.Random(120); var resource = CraftResource.None; if (randhue >= 118) { resource = CraftResource.Valorite; } else if (randhue >= 115) { resource = CraftResource.Verite; } else if (randhue >= 110) { resource = CraftResource.Agapite; } else if (randhue >= 100) { resource = CraftResource.Gold; } else if (randhue >= 90) { resource = CraftResource.Bronze; } else if (randhue >= 70) { resource = CraftResource.Copper; } else if (randhue >= 40) { resource = CraftResource.ShadowIron; } else { resource = CraftResource.DullCopper; } chest.Hue = CraftResources.GetInfo(resource).Hue; } int soslevel = sos.Level; TreasureMapChest.Fill(chest, soslevel, from.Expansion); if (!sos.IsAncient) { chest.Locked = false; } double chance = Utility.RandomDouble(); BaseCreature mibmonster1; BaseCreature mibmonster2; mibmonster1 = new DeepWaterElemental(); if (chance <= 0.02 && from.Skills[SkillName.Fishing].Base >= 115) { mibmonster2 = new Osiredon(); int choice = Utility.Random(5); switch (choice) { case 4: mibmonster2.PackItem(new SmallFishingNetDeed()); break; case 3: mibmonster2.PackItem(new LargeFishingNetDeed()); break; case 2: mibmonster2.PackItem(new Shell()); break; case 1: mibmonster2.PackItem(new Anchor()); break; case 0: mibmonster2.PackItem(new Hook()); break; } } else if (soslevel < 5) { mibmonster2 = new WaterElemental(); } else { mibmonster2 = new DeepWaterElemental(); } int x = from.X, y = from.Y; Map map = from.Map; mibmonster1.MoveToWorld(new Point3D(x, y, -5), map); mibmonster2.MoveToWorld(new Point3D(x, y, -5), map); mibmonster1.Home = mibmonster1.Location; mibmonster1.HomeMap = mibmonster1.Map; mibmonster1.RangeHome = 10; mibmonster2.Home = mibmonster2.Location; mibmonster2.HomeMap = mibmonster2.Map; mibmonster2.RangeHome = 10; if (sos.IsAncient) { chest.DropItem(new FabledFishingNet()); } else { chest.DropItem(new SpecialFishingNet()); } chest.Movable = true; chest.Name = "treasure chest"; chest.IsShipwreckedItem = true; if (sos.Level > 0) { chest.TrapType = TrapType.ExplosionTrap; chest.TrapPower = soslevel * Utility.RandomMinMax(9, 19); chest.TrapLevel = 0; } else { chest.TrapType = TrapType.None; chest.TrapPower = 1; chest.TrapLevel = 1; } sos.Delete(); return chest; } } } return base.Construct(type, from); }