public void PackBag(Mobile from, int count) { Bolt Bolt = new Bolt(500); Bolt.Hue = 0; if (!from.AddToBackpack(Bolt)) { if (!from.BankBox.TryDropItem(from, Bolt, false)) { from.SendMessage("Your bank box is full."); } else if (from.BankBox.TryDropItem(from, Bolt, false)) { from.SendMessage("Your Backpack is too full, so the item has been placed in your bank."); } else { Bolt.Location = from.Location; Bolt.Map = from.Map; from.SendMessage("Your Backpack and Bank box is too full to carry all that."); from.SendMessage("The bag fall to the ground, be sure to put it in your bank or something!"); } } }
public override void GenerateLoot() { AddLoot(LootPack.Food); AddLoot(LootPack.UtilityItems); AddLoot(LootPack.LeatherAr); Server.Items.Bolt Bolt = new Server.Items.Bolt(20); AddToBackpack(Bolt); }
public override void OnDoubleClick(Mobile from) { Arrow Arrow = new Arrow(100); Bolt Bolt = new Bolt(100); from.AddToBackpack(Arrow); from.AddToBackpack(Bolt); from.SendMessage("You received some arrows and bolts."); }
public override void OnHit(Mobile attacker, Mobile defender) { if (Type != WeaponType.Thrown && attacker.Player && !defender.Player && (defender.Body.IsAnimal || defender.Body.IsMonster) && 0.4 >= Utility.RandomDouble()) { defender.AddToBackpack(Ammo); } if (attacker is TeiravonMobile) { TeiravonMobile tm = (TeiravonMobile)attacker; if (tm.Backpack != null) { if (tm.FindItemOnLayer(Layer.MiddleTorso) is ElvenQuiver && Utility.RandomMinMax(1, 100) <= 50) { if (Ammo is Arrow) { Item[] ammopile = tm.Backpack.FindItemsByType(typeof(Arrow), true); bool firstfound = false; for (int i = 0; i < ammopile.Length; ++i) { if (!firstfound) { Arrow ammostack = (Arrow)ammopile[0]; ammostack.Amount += 1; firstfound = true; } } } else if (Ammo is Bolt) { Item[] ammopile = tm.Backpack.FindItemsByType(typeof(Bolt), true); bool firstfound = false; for (int i = 0; i < ammopile.Length; ++i) { if (!firstfound) { Bolt ammostack = (Bolt)ammopile[0]; ammostack.Amount += 1; firstfound = true; } } } } } } base.OnHit(attacker, defender); }
public override void OnDoubleClick(Mobile from) { base.OnDoubleClick(from); if (!IsChildOf(from.Backpack)) { from.SendMessage("That item must be in your pack in order to use it."); return; } from.SendMessage("You separate the crossbow bolt bundle and its contents are placed in your backpack."); Item[] bolts = from.Backpack.FindItemsByType(typeof(Bolt)); Bolt largestItem = null; int highestCount = 0; foreach (Item item in bolts) { Bolt bolt = item as Bolt; if (bolt.Amount > highestCount) { largestItem = bolt; } } if (largestItem != null) { largestItem.Amount += 25; } else { from.Backpack.DropItem(new Bolt(25)); } Delete(); }
public void OnChop(Mobile from) { if (from.InRange(this.GetWorldLocation(), 2)) { Effects.SendLocationEffect(Location, Map, 0x3728, 20, 10); //smoke or dust Effects.PlaySound(Location, Map, 0x11C); switch (Utility.Random(25)) { case 0: Effects.SendLocationEffect(from, from.Map, 0x113A, 20, 10); // Poison Player from.PlaySound(0x231); from.ApplyPoison(from, Poison.Lesser); break; case 1: Effects.SendLocationEffect(from, from.Map, 0x3709, 30); // Burn Player from.PlaySound(0x54); AOS.Damage(from, from, Utility.RandomMinMax(2, 5), 0, 100, 0, 0, 0); break; case 2: new BarrelLid().MoveToWorld(Location, Map); new BarrelHoops().MoveToWorld(Location, Map); break; case 3: Bandage b = new Bandage(Utility.RandomMinMax(5, 10)); b.MoveToWorld(Location, Map); break; case 4: new BarrelStaves().MoveToWorld(Location, Map); new BarrelHoops().MoveToWorld(Location, Map); break; case 5: Gold g = new Gold(Utility.RandomMinMax(25, 50)); g.MoveToWorld(Location, Map); break; case 6: new AgilityPotion().MoveToWorld(Location, Map); break; case 7: new LesserCurePotion().MoveToWorld(Location, Map); break; case 8: new LesserExplosionPotion().MoveToWorld(Location, Map); break; case 9: new LesserHealPotion().MoveToWorld(Location, Map); break; case 10: new LesserLightningPotion().MoveToWorld(Location, Map); break; case 11: new LesserManaPotion().MoveToWorld(Location, Map); break; case 12: new MindPotion().MoveToWorld(Location, Map); break; case 13: new LesserPoisonPotion().MoveToWorld(Location, Map); break; case 14: new LesserShatterPotion().MoveToWorld(Location, Map); break; case 15: new StrengthPotion().MoveToWorld(Location, Map); break; case 16: new LesserToxicPotion().MoveToWorld(Location, Map); break; case 17: Arrow arrow = new Arrow(Utility.RandomMinMax(5, 25)); arrow.MoveToWorld(Location, Map); break; case 18: Bolt bolt = new Bolt(Utility.RandomMinMax(5, 25)); bolt.MoveToWorld(Location, Map); break; case 19: IronIngot ii = new IronIngot(Utility.RandomMinMax(5, 25)); ii.MoveToWorld(Location, Map); break; case 20: Leather leather = new Leather(Utility.RandomMinMax(5, 25)); leather.MoveToWorld(Location, Map); break; case 21: Log log = new Log(Utility.RandomMinMax(5, 25)); log.MoveToWorld(Location, Map); break; case 22: BoltOfCloth boc = new BoltOfCloth(Utility.RandomMinMax(1, 25)); boc.MoveToWorld(Location, Map); break; case 23: SpidersSilk spiderssilk = new SpidersSilk(Utility.RandomMinMax(5, 25)); spiderssilk.MoveToWorld(Location, Map); break; case 24: SulfurousAsh sulfurousash = new SulfurousAsh(Utility.RandomMinMax(1, 25)); sulfurousash.MoveToWorld(Location, Map); break; } Destroy(); } else { from.SendLocalizedMessage(500446); // That is too far away. } }
protected override void OnTarget(Mobile from, object targeted) { Item item = targeted as Item; Arrow arrow = targeted as Arrow; Bolt bolt = targeted as Bolt; if (targeted is PlayerMobile || targeted is BaseCreature) { from.SendMessage("You cannot target that."); } if (targeted != null && targeted is Arrow) { if (it_Tub != null) { if (!(item.IsChildOf(from.Backpack))) { from.SendMessage("This must be in your backpack."); } else if (item.IsChildOf(from.Backpack) && arrow.Amount == 20) { from.SendMessage("You carefully apply the cold material to your bundle of arrows."); it_Tub.Charges--; arrow.Consume(20); //Note: pack.ConsumeTotal( typeof(Arrow), 20 ) from.AddToBackpack(new FreezeArrow(20)); } else if (targeted != null && arrow.Amount != 20) { from.SendMessage("You must use a bundle of 20 at a time."); } } else { return; } } else if (targeted != null && targeted is Bolt) { if (it_Tub != null) { if (!(item.IsChildOf(from.Backpack))) { from.SendMessage("This must be in your backpack."); } else if (item.IsChildOf(from.Backpack) && bolt.Amount == 20) { from.SendMessage("You carefully apply the cold material to your bundle of bolts."); it_Tub.Charges--; bolt.Consume(20); //Note: pack.ConsumeTotal( typeof(Bolt), 20 ) from.AddToBackpack(new FreezeBolt(20)); } else if (targeted != null && bolt.Amount != 20) { from.SendMessage("You must use a bundle of 20 bolts at a time."); } } else { return; } } else { from.SendMessage("You must target a bundle of 20."); } }
public void Fire( Mobile from ) { BaseRanged bow = from.Weapon as BaseRanged; if ( bow == null ) { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); //from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You must practice with ranged weapons on this."); //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } if ( DateTime.Now < (m_LastUse + UseDelay) ) return; Point3D worldLoc = GetWorldLocation(); if ( FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You would do better to stand in front of the archery butte." ); // You would do better to stand in front of the archery butte. return; } if ( FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You aren't properly lined up with the archery butte to get an accurate shot." ); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if ( !from.InRange( worldLoc, 6 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You are too far away from the archery butte to get an accurate shot." ); // You are too far away from the archery butte to get an accurate shot. return; } else if ( from.InRange( worldLoc, 4 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You are too close to the target." ); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = ( ammoType == typeof( Arrow ) ); bool isBolt = ( ammoType == typeof( Bolt ) ); bool isKnown = ( isArrow || isBolt ); if ( pack == null || !pack.ConsumeTotal( ammoType, 1 ) ) { if ( isArrow ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You do not have any arrows with which to practice." ); // You do not have any arrows with which to practice. else if ( isBolt ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You do not have any crossbow bolts with which to practice." ); // You do not have any crossbow bolts with which to practice. else from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } m_LastUse = DateTime.Now; from.Direction = from.GetDirectionTo( GetWorldLocation() ); bow.PlaySwingAnimation( from ); from.MovingEffect( this, bow.EffectID, 18, 1, false, false ); ScoreEntry se = GetEntryFor( from ); if ( !from.CheckSkill( bow.Skill, m_MinSkill, m_MaxSkill ) ) { from.PlaySound( bow.MissSound ); PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} misses the target altogether.", from.Name)); //PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether. se.Record( 0 ); if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.",se.Total.ToString() )); else PublicOverheadMessage( MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); if (0.4 >= Utility.RandomDouble()) { if (isArrow) { Item Ammo = new Arrow(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } else if (isBolt) { Item Ammo = new Bolt(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } } return; } Effects.PlaySound( Location, Map, /*0x2B1*/ 564 ); double rand = Utility.RandomDouble(); int area, score, splitScore; if ( 0.10 > rand ) { area = 0; // bullseye score = 50; splitScore = 100; } else if ( 0.25 > rand ) { area = 1; // inner ring score = 10; splitScore = 20; } else if ( 0.50 > rand ) { area = 2; // middle ring score = 5; splitScore = 15; } else { area = 3; // outer ring score = 2; splitScore = 5; } bool split = ( isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble() ); if ( split ) { if (isArrow) { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the outer ring.", from.Name)); break; } } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the outer ring.", from.Name)); break; } } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name ); } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the outer ring.", from.Name)); break; } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name ); if ( isArrow ) ++m_Arrows; else if ( isBolt ) ++m_Bolts; } se.Record( split ? splitScore : score ); /*if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); else PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) );*/ if (se.Count == 1) PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.", se.Total.ToString())); else PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); }
public static void CreateItem(ItemInfo info, Mobile m) { if (m == null) return; Item item = null; BaseCreature bc = null; switch (info.IncrID) { case 0: item = new BlackPearl(999); break; case 1: item = new Bloodmoss(999); break; case 2: item = new MandrakeRoot(999); break; case 3: item = new Garlic(999); break; case 4: item = new Ginseng(999); break; case 5: item = new Nightshade(999); break; case 6: item = new SpidersSilk(999); break; case 7: item = new SulfurousAsh(999); break; case 8: item = new Bag(); ((Bag)item).DropItem( new BlackPearl(100) ); ((Bag)item).DropItem( new Bloodmoss(100) ); ((Bag)item).DropItem( new MandrakeRoot(100) ); ((Bag)item).DropItem( new Garlic(100) ); ((Bag)item).DropItem( new Ginseng(100) ); ((Bag)item).DropItem( new Nightshade(100) ); ((Bag)item).DropItem( new SpidersSilk(100) ); ((Bag)item).DropItem( new SulfurousAsh(100) ); break; case 9: item = new BatWing(999); break; case 10: item = new GraveDust(999); break; case 11: item = new DaemonBlood(999); break; case 12: item = new NoxCrystal(999); break; case 13: item = new PigIron(999); break; case 14: item = new Bag(); ((Bag)item).DropItem( new BatWing(100) ); ((Bag)item).DropItem( new GraveDust(100) ); ((Bag)item).DropItem( new DaemonBlood(100) ); ((Bag)item).DropItem( new NoxCrystal(100) ); ((Bag)item).DropItem( new PigIron(100) ); break; case 15: for (int i=0; i < 2; i++) //The last potion is dropped later { item = new RefreshPotion(); m.AddToBackpack(item); } item = new RefreshPotion(); break; case 16: for (int i=0; i < 2; i++) //The last potion is dropped later { item = new RefreshPotion(); m.AddToBackpack(item); } item = new LesserCurePotion(); break; case 17: for (int i=0; i < 2; i++) //The last potion is dropped later { item = new RefreshPotion(); m.AddToBackpack(item); } item = new LesserHealPotion(); break; case 18: for (int i=0; i < 2; i++) //The last potion is dropped later { item = new RefreshPotion(); m.AddToBackpack(item); } item = new NightSightPotion(); break; case 19: item = new Bandage(50); break; case 20: item = new Bandage(200); break; case 21: item = new Bandage(1000); break; case 22: item = new Arrow(100); break; case 23: item = new Arrow(1000); break; case 24: item = new Bolt(100); break; case 25: item = new Bolt(1000); break; case 26: bc = new Horse(); break; case 27: bc = new PackLlama(); break; case 28: item = new Club(); BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, Utility.RandomMinMax(1, 4), 40, 80); break; case 29: item = new WarFork(); BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, Utility.RandomMinMax(1, 4), 40, 80); break; case 30: item = new Katana(); BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, Utility.RandomMinMax(1, 4), 40, 80); break; case 31: item = new Bow(); BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, Utility.RandomMinMax(1, 4), 40, 80); break; case 32: item = new MetalKiteShield(); BaseRunicTool.ApplyAttributesTo((BaseShield)item, Utility.RandomMinMax(1, 4), 40, 80); break; case 33: item = new WoodenShield(); BaseRunicTool.ApplyAttributesTo((BaseShield)item, Utility.RandomMinMax(1, 4), 40, 80); break; case 34: item = new LeatherChest(); BaseRunicTool.ApplyAttributesTo((BaseArmor)item, Utility.RandomMinMax(1, 4), 40, 80); break; case 35: item = new LeatherGloves(); BaseRunicTool.ApplyAttributesTo((BaseArmor)item, Utility.RandomMinMax(1, 4), 40, 80); break; case 36: item = new LeatherGorget(); BaseRunicTool.ApplyAttributesTo((BaseArmor)item, Utility.RandomMinMax(1, 4), 40, 80); break; case 37: item = new LeatherLegs(); BaseRunicTool.ApplyAttributesTo((BaseArmor)item, Utility.RandomMinMax(1, 4), 40, 80); break; case 38: item = new LeatherCap(); BaseRunicTool.ApplyAttributesTo((BaseArmor)item, Utility.RandomMinMax(1, 4), 40, 80); break; case 39: item = new LeatherArms(); BaseRunicTool.ApplyAttributesTo((BaseArmor)item, Utility.RandomMinMax(1, 4), 40, 80); break; case 40: item = new Gold(300); break; case 41: item = new Gold(3000); break; case 42: item = new Server.Engines.BulkOrders.BulkOrderBook(); break; case 43: item = new Drums(); ((BaseInstrument)item).Quality = InstrumentQuality.Exceptional; break; case 44: item = new TambourineTassel(); ((BaseInstrument)item).Quality = InstrumentQuality.Exceptional; break; case 45: item = new Server.Multis.SmallDragonBoatDeed(); break; case 46: item = new Server.Multis.LargeDragonBoatDeed(); break; } if (item != null) { m.AddToBackpack(item); m.SendMessage("Here are the goods you requested."); } else if (bc != null) { bc.Controlled = true; bc.ControlMaster = m; bc.MoveToWorld( m.Location, m.Map ); m.SendMessage("Here is the pet you requested."); } else { m.SendMessage("That item is not available. Please report the bug at the site that will open in your browser."); m.LaunchBrowser( "http://bug.casiopia.net/" ); m.AddToBackpack( new VeriteGem(info.Price) ); } }
public override void OnMiss(Mobile attacker, Mobile defender) { Container pack = attacker.Backpack; if (attacker.Player && 0.4 >= Utility.RandomDouble() && this.Type != WeaponType.Thrown) { if (pack == null || !pack.ConsumeTotal(AmmoType, 1)) { if (attacker is TeiravonMobile && ((((TeiravonMobile)attacker).IsArcher()) && (((TeiravonMobile)attacker).IsUndead()) && (((TeiravonMobile)attacker).Shapeshifted))) { } else { Ammo.MoveToWorld(new Point3D(defender.X + Utility.RandomMinMax(-1, 1), defender.Y + Utility.RandomMinMax(-1, 1), defender.Z), defender.Map); } } else { Ammo.MoveToWorld(new Point3D(defender.X + Utility.RandomMinMax(-1, 1), defender.Y + Utility.RandomMinMax(-1, 1), defender.Z), defender.Map); } } if (attacker is TeiravonMobile) { TeiravonMobile tm = (TeiravonMobile)attacker; if (tm.Backpack != null) { if (tm.FindItemOnLayer(Layer.MiddleTorso) is ElvenQuiver && Utility.RandomMinMax(1, 100) <= 50) { if (Ammo is Arrow) { Item[] ammopile = tm.Backpack.FindItemsByType(typeof(Arrow), true); bool firstfound = false; for (int i = 0; i < ammopile.Length; ++i) { if (!firstfound) { Arrow ammostack = (Arrow)ammopile[0]; ammostack.Amount += 1; firstfound = true; } } } else if (Ammo is Bolt) { Item[] ammopile = tm.Backpack.FindItemsByType(typeof(Bolt), true); bool firstfound = false; for (int i = 0; i < ammopile.Length; ++i) { if (!firstfound) { Bolt ammostack = (Bolt)ammopile[0]; ammostack.Amount += 1; firstfound = true; } } } } } } base.OnMiss(attacker, defender); }
public ArcherGuard( Mobile target ) : base( target ) { Summoned = true; InitStats(1000, 1000, 1000); SpeechHue = 0; Hue = Utility.RandomSkinHue(); #region Armor for (int i = 0; i < m_GuardArmor.Length; ++i) { m_GuardArmor[i].Resource = GuardTheme; AddItem(m_GuardArmor[i]); m_GuardArmor[i].Movable = false; } #endregion #region Cloth BaseClothing bC = null; switch (Utility.Random(3)) { case 0: bC = new Doublet(); break; case 1: bC = new Tunic(); break; case 2: bC = new BodySash(); bC.Layer = Layer.Earrings; break; } if (bC != null) { bC.Resource = GuardTheme; AddItem(bC); bC.Movable = false; } #endregion #region Male/Female if (Female = Utility.RandomBool()) { Body = 0x191; if (string.IsNullOrEmpty(Name)) { Name = NameList.RandomName("female"); Title = "the guard"; } FemalePlateChest ar = new FemalePlateChest(); ar.Resource = GuardTheme; AddItem(ar); ar.Movable = false; } else { Body = 0x190; if (string.IsNullOrEmpty(Name)) { Name = NameList.RandomName("male"); Title = "the guard"; } PlateChest ar = new PlateChest(); ar.Resource = GuardTheme; AddItem(ar); ar.Movable = false; } #endregion Utility.AssignRandomHair(this); if (Utility.RandomBool()) Utility.AssignRandomFacialHair(this, HairHue); Container pack = new Backpack(); pack.Movable = false; pack.DropItem(new Gold(10, 25)); AddItem(pack); #region Weapon BaseWeapon weapon; Item ammo; switch (Utility.Random(3)) { case 1: weapon = new Bow(); ammo = new Arrow(250); break; case 2: weapon = new Crossbow(); ammo = new Bolt(250); break; case 3: weapon = new HeavyCrossbow(); ammo = new Bolt(250); break; default: weapon = new Bow(); ammo = new Arrow(250); break; } weapon.Crafter = this; weapon.Resource = GuardTheme; weapon.Quality = WeaponQuality.Exceptional; weapon.Speed = 1; weapon.MinDamage = 10000; weapon.MaxDamage = 10000; AddItem(weapon); weapon.Movable = false; AddItem(ammo); ammo.LootType = LootType.Blessed; #endregion Skills[SkillName.Anatomy].Base = 120.0; Skills[SkillName.Tactics].Base = 125.0; Skills[SkillName.Archery].Base = 100.0; Skills[SkillName.MagicResist].Base = 120.0; Skills[SkillName.DetectHidden].Base = 100.0; if (Utility.RandomDouble() <= 0.1) new Horse().Rider = this; NextCombatTime = DateTime.Now + TimeSpan.FromSeconds(1.0); Focus = target; }
public void Fire(Mobile from) { BaseRanged bow = from.Weapon as BaseRanged; if (bow == null) { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); //from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You must practice with ranged weapons on this."); //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } if (DateTime.Now < (m_LastUse + UseDelay)) { return; } Point3D worldLoc = GetWorldLocation(); if (FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You would do better to stand in front of the archery butte."); // You would do better to stand in front of the archery butte. return; } if (FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You aren't properly lined up with the archery butte to get an accurate shot."); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if (!from.InRange(worldLoc, 6)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You are too far away from the archery butte to get an accurate shot."); // You are too far away from the archery butte to get an accurate shot. return; } else if (from.InRange(worldLoc, 4)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You are too close to the target."); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = (ammoType == typeof(Arrow)); bool isBolt = (ammoType == typeof(Bolt)); bool isKnown = (isArrow || isBolt); if (pack == null || !pack.ConsumeTotal(ammoType, 1)) { if (isArrow) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You do not have any arrows with which to practice."); // You do not have any arrows with which to practice. } else if (isBolt) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You do not have any crossbow bolts with which to practice."); // You do not have any crossbow bolts with which to practice. } else { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); } //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } m_LastUse = DateTime.Now; from.Direction = from.GetDirectionTo(GetWorldLocation()); bow.PlaySwingAnimation(from); from.MovingEffect(this, bow.EffectID, 18, 1, false, false); ScoreEntry se = GetEntryFor(from); if (!from.CheckSkill(bow.Skill, m_MinSkill, m_MaxSkill)) { from.PlaySound(bow.MissSound); PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} misses the target altogether.", from.Name)); //PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether. se.Record(0); if (se.Count == 1) { PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.", se.Total.ToString())); } else { PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count)); //1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); } if (0.4 >= Utility.RandomDouble()) { if (isArrow) { Item Ammo = new Arrow(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } else if (isBolt) { Item Ammo = new Bolt(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } } return; } Effects.PlaySound(Location, Map, /*0x2B1*/ 564); double rand = Utility.RandomDouble(); int area, score, splitScore; if (0.10 > rand) { area = 0; // bullseye score = 50; splitScore = 100; } else if (0.25 > rand) { area = 1; // inner ring score = 10; splitScore = 20; } else if (0.50 > rand) { area = 2; // middle ring score = 5; splitScore = 15; } else { area = 3; // outer ring score = 2; splitScore = 5; } bool split = (isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble()); if (split) { if (isArrow) { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the outer ring.", from.Name)); break; } } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the outer ring.", from.Name)); break; } } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name ); } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the outer ring.", from.Name)); break; } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name ); if (isArrow) { ++m_Arrows; } else if (isBolt) { ++m_Bolts; } } se.Record(split ? splitScore : score); /*if ( se.Count == 1 ) * PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); * else * PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) );*/ if (se.Count == 1) { PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.", se.Total.ToString())); } else { PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); } }
public ArcherGuard(Mobile target) : base(target) { //10OCT2007 Reorganized Guards *** START *** //Reduce stats to a normal level //InitStats(100, 125, 25); InitStats((Utility.RandomMinMax(50, 75)), (Utility.RandomMinMax(50, 75)), (Utility.RandomMinMax(50, 75))); Title = "the guard"; SpeechHue = Utility.RandomDyedHue(); Hue = Utility.RandomSkinHue(); if (Female = Utility.RandomBool()) { Body = 0x191; Name = NameList.RandomName("female"); switch (Utility.Random(2)) { case 0: AddItem(new LeatherSkirt()); break; case 1: AddItem(new LeatherShorts()); break; } switch (Utility.Random(4)) { case 0: AddItem(new FemaleLeatherChest()); break; case 1: AddItem(new FemaleStuddedChest()); break; case 2: AddItem(new LeatherBustierArms()); break; case 3: AddItem(new StuddedBustierArms()); break; } } else { Body = 0x190; Name = NameList.RandomName("male"); AddItem(new StuddedChest()); AddItem(new StuddedArms()); if (Utility.RandomBool()) { Utility.AssignRandomFacialHair(this, HairHue); } } new Horse().Rider = this; AddItem(new StuddedGloves()); AddItem(new StuddedGorget()); AddItem(new StuddedLegs()); AddItem(new Boots()); AddItem(new FeatheredHat(Utility.RandomNondyedHue())); AddItem(new BodySash(Utility.RandomNondyedHue())); Utility.AssignRandomHair(this); switch (Utility.Random(1)) //picks one of the following { case 0: { Bow bow = new Bow(); bow.Movable = false; bow.Crafter = this; bow.Quality = WeaponQuality.Exceptional; AddItem(bow); Container pack = new Backpack(); pack.Movable = false; Arrow arrows = new Arrow(250); pack.DropItem(arrows); pack.DropItem(new Gold(10, 25)); AddItem(pack); break; } case 1: { Crossbow crossbow = new Crossbow(); crossbow.Movable = false; crossbow.Crafter = this; crossbow.Quality = WeaponQuality.Exceptional; AddItem(crossbow); Container pack = new Backpack(); pack.Movable = false; Bolt bolt = new Bolt(250); pack.DropItem(bolt); pack.DropItem(new Gold(10, 25)); AddItem(pack); break; } } //10OCT2007 Reorganized Guards *** END *** Skills[SkillName.Anatomy].Base = 120.0; Skills[SkillName.Tactics].Base = 120.0; Skills[SkillName.Archery].Base = 120.0; Skills[SkillName.MagicResist].Base = 120.0; Skills[SkillName.DetectHidden].Base = 100.0; this.NextCombatTime = DateTime.Now + TimeSpan.FromSeconds(0.5); this.Focus = target; }