protected override void OnTarget(Mobile from, object target) { if (from == null || m_Net == null) { return; } if (from.Deleted || !from.Alive || m_Net.Deleted || m_Net.RootParent != from) { return; } PlayerMobile player = from as PlayerMobile; if (player == null) { return; } if (!m_Net.IsChildOf(player.Backpack)) { player.SendMessage("That item must be in your pack in order to use it."); return; } if (!player.CanBeginAction(typeof(UOACZThrowingNet))) { player.SendMessage("You may only use a net once every " + m_Net.CooldownSeconds.ToString() + " seconds."); return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } Mobile mobileTarget = null; if (target is Mobile) { mobileTarget = target as Mobile; } else { player.SendMessage("That is not a valid target."); return; } if (mobileTarget == player) { player.SendMessage("You cannot target yourself."); return; } if (!UOACZSystem.IsUOACZValidMobile(mobileTarget)) { player.SendMessage("That is not a valid target."); return; } if (Utility.GetDistance(player.Location, mobileTarget.Location) > 8) { from.SendMessage("That is too far away"); return; } if (!player.Map.InLOS(player.Location, mobileTarget.Location)) { player.SendMessage("That is not within in your line of sight."); return; } SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1, 1, true, 0, false, "", "", "-1"); if (!from.Mounted) { player.Animate(31, 7, 1, true, false, 0); } double duration = 60; if (mobileTarget is UOACZBaseWildlife) { duration = 60; } if (mobileTarget is UOACZBaseUndead) { UOACZBaseUndead bc_Undead = mobileTarget as UOACZBaseUndead; double reduction = 1 - (bc_Undead.Difficulty * .10); if (reduction < .10) { reduction = .10; } duration *= reduction; } if (mobileTarget is UOACZBaseHuman) { UOACZBaseCivilian bc_Human = mobileTarget as UOACZBaseCivilian; double reduction = 1 - (bc_Human.Difficulty * .10); if (reduction < .10) { reduction = .10; } duration *= reduction; } PlayerMobile playerTarget = mobileTarget as PlayerMobile; if (playerTarget != null) { if (playerTarget.IsUOACZHuman) { duration = Utility.RandomMinMax(2, 4); } if (playerTarget.IsUOACZUndead) { duration = Utility.RandomMinMax(5, 10); } } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); player.m_UOACZAccountEntry.NetsThrown++; int itemId = m_Net.ItemID; int itemHue = m_Net.Hue; Effects.PlaySound(player.Location, player.Map, 0x5D3); player.DoHarmful(mobileTarget); Point3D playerLocation = player.Location; Map playerMap = player.Map; Point3D mobileLocation = mobileTarget.Location; Map mobileMap = mobileTarget.Map; IEntity startLocation = new Entity(Serial.Zero, new Point3D(playerLocation.X, playerLocation.Y, playerLocation.Z + 7), playerMap); IEntity endLocation = new Entity(Serial.Zero, new Point3D(mobileTarget.X, mobileTarget.Y, mobileTarget.Z), mobileMap); double distance = from.GetDistanceToSqrt(endLocation); double destinationDelay = (double)distance * .08; m_Net.Delete(); Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (!UOACZSystem.IsUOACZValidMobile(mobileTarget)) { return; } if (Utility.GetDistance(playerLocation, mobileLocation) >= 25) { return; } SpecialAbilities.HinderSpecialAbility(1.0, player, mobileTarget, 1, duration, true, -1, true, "You ensnare them in a net", "You have been ensnared in a net!", "-1"); for (int a = 0; a < 9; a++) { TimedStatic net = new TimedStatic(3538, duration - destinationDelay); Point3D netLocation = mobileTarget.Location; switch (a) { //Row 1 case 0: net.ItemID = 3538; netLocation = new Point3D(netLocation.X - 1, netLocation.Y - 1, netLocation.Z); break; case 1: net.ItemID = 3528; netLocation = new Point3D(netLocation.X, netLocation.Y - 1, netLocation.Z); break; case 2: net.ItemID = 3537; netLocation = new Point3D(netLocation.X + 1, netLocation.Y - 1, netLocation.Z); break; //Row 2 case 3: net.ItemID = 3539; netLocation = new Point3D(netLocation.X - 1, netLocation.Y, netLocation.Z); break; case 4: net.ItemID = 3530; netLocation = new Point3D(netLocation.X, netLocation.Y, netLocation.Z); break; case 5: net.ItemID = 3531; netLocation = new Point3D(netLocation.X + 1, netLocation.Y, netLocation.Z); break; //Row 3 case 6: net.ItemID = 3540; netLocation = new Point3D(netLocation.X - 1, netLocation.Y + 1, netLocation.Z); break; case 7: net.ItemID = 3529; netLocation = new Point3D(netLocation.X, netLocation.Y + 1, netLocation.Z); break; case 8: net.ItemID = 3541; netLocation = new Point3D(netLocation.X + 1, netLocation.Y + 1, netLocation.Z); break; } net.Hue = itemHue; net.Name = "a net"; net.MoveToWorld(netLocation, mobileMap); } }); }
protected override void OnTarget(Mobile from, object target) { PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } if (m_Torch == null) { return; } if (m_Torch.Deleted) { return; } IPoint3D location = target as IPoint3D; if (location == null) { return; } Map map = player.Map; if (map == null) { return; } SpellHelper.GetSurfaceTop(ref location); Mobile mobileTarget = null; targetLocation = new Entity(Serial.Zero, new Point3D(location), map); if (new Point3D(location) == from.Location) { return; } if (!player.CanBeginAction(typeof(UOACZTorch))) { player.SendMessage("You must wait a few moments before throwing another torch."); return; } if (Utility.GetDistance(player.Location, targetLocation.Location) > ThrowRange) { player.SendMessage("That location is too far away."); return; } player.RevealingAction(); SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, 1, true, 0, false, "", "", "-1"); m_Torch.Delete(); player.Animate(31, 7, 1, true, false, 0); int throwSound = 0x5D3; int hitSound = 0x5CF; int itemID = 2578; int itemHue = 0; Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } player.BeginAction(typeof(UOACZTorch)); Timer.DelayCall(TimeSpan.FromSeconds(UOACZTorch.CooldownSeconds), delegate { if (player != null) { player.EndAction(typeof(UOACZTorch)); } }); Effects.PlaySound(player.Location, player.Map, throwSound); IEntity startLocation = new Entity(Serial.Zero, new Point3D(player.Location.X, player.Location.Y, player.Location.Z + 5), player.Map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(targetLocation.Location.X, targetLocation.Location.Y, targetLocation.Location.Z + 5), targetLocation.Map); Effects.SendMovingEffect(startLocation, endLocation, itemID, 15, 0, false, false, itemHue, 0); double distance = player.GetDistanceToSqrt(endLocation.Location); double destinationDelay = (double)distance * .04; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { Effects.PlaySound(endLocation.Location, endLocation.Map, hitSound); Effects.SendLocationParticles(EffectItem.Create(endLocation.Location, endLocation.Map, TimeSpan.FromSeconds(1.0)), 0x3709, 10, 30, 0, 0, 5052, 0); //Mobiles Queue m_Queue = new Queue(); IPooledEnumerable nearbyMobiles = endLocation.Map.GetMobilesInRange(endLocation.Location, 0); int mobilesHit = 0; foreach (Mobile mobile in nearbyMobiles) { if (!UOACZSystem.IsUOACZValidMobile(mobile)) { continue; } m_Queue.Enqueue(mobile); mobilesHit++; } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); BaseCreature bc_Target = mobile as BaseCreature; PlayerMobile pm_Target = mobile as PlayerMobile; int minDamage = 20; int maxDamage = 40; double damageScalar = 2; if (pm_Target != null) { if (pm_Target.IsUOACZHuman) { damageScalar = 0; } if (pm_Target.IsUOACZUndead) { damageScalar = .66; } } int damage = (int)(Math.Round(((double)Utility.RandomMinMax(minDamage, maxDamage)) * damageScalar)); bool humanSource = false; if (player != null) { if (player.IsUOACZHuman) { humanSource = true; } } if (damage > 0) { if (humanSource) { player.DoHarmful(mobile); new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, player, damage, 100, 0, 0, 0, 0); } else { new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, damage, 100, 0, 0, 0, 0); } } } if (mobilesHit > 0) { Effects.PlaySound(endLocation.Location, endLocation.Map, 0x054); Effects.SendLocationParticles(EffectItem.Create(endLocation.Location, endLocation.Map, TimeSpan.FromSeconds(1.0)), 0x3709, 10, 30, 0, 0, 5052, 0); } bool oilLocationHit = false; //Items IPooledEnumerable nearbyItems = endLocation.Map.GetItemsInRange(endLocation.Location, 1); foreach (Item item in nearbyItems) { if (item is UOACZOilLocation) { m_Queue.Enqueue(item); } } nearbyItems.Free(); while (m_Queue.Count > 0) { UOACZOilLocation oilLocation = (UOACZOilLocation)m_Queue.Dequeue(); if (oilLocation == null) { continue; } if (oilLocation.Deleted) { continue; } if (oilLocation.Burning) { continue; } oilLocation.Ignite(player); oilLocationHit = true; } if (!oilLocationHit) { Effects.PlaySound(endLocation.Location, endLocation.Map, 0x3BE); Effects.SendLocationParticles(EffectItem.Create(endLocation.Location, endLocation.Map, TimeSpan.FromSeconds(1.0)), 0x3735, 10, 30, 0, 0, 5052, 0); } }); }); }