protected override void OnTick() { if (m_UOACZFirefield == null) { Stop(); return; } if (m_UOACZFirefield.Deleted) { Stop(); return; } if (DateTime.UtcNow >= m_UOACZFirefield.m_Expiration) { Stop(); m_UOACZFirefield.Delete(); return; } if (m_UOACZFirefield.Map == Map.Internal || m_UOACZFirefield.Map == null) { return; } bool foundAnother = false; IPooledEnumerable itemsOnTile = m_UOACZFirefield.Map.GetItemsInRange(m_UOACZFirefield.Location, 0); foreach (Item item in itemsOnTile) { if (item == null) { continue; } if (item.Deleted) { continue; } if (item == m_UOACZFirefield) { continue; } if (item is UOACZFirefield) { foundAnother = true; break; } } itemsOnTile.Free(); if (foundAnother) { Stop(); m_UOACZFirefield.Delete(); return; } if (m_UOACZFirefield.Map == Map.Internal || m_UOACZFirefield.Map == null) { return; } m_Queue = new Queue(); IPooledEnumerable itemsOnTileB = m_UOACZFirefield.Map.GetItemsInRange(m_UOACZFirefield.Location, 0); foreach (Item item in itemsOnTileB) { if (item == null) { continue; } if (item.Deleted) { continue; } if (item is UOACZOilLocation) { m_Queue.Enqueue(item); } } itemsOnTileB.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(null); } //Possible Result of Igniting Other Oil if (m_UOACZFirefield == null) { Stop(); return; } if (m_UOACZFirefield.Deleted) { Stop(); return; } if (m_UOACZFirefield.Map == Map.Internal || m_UOACZFirefield.Map == null) { return; } m_Queue = new Queue(); IPooledEnumerable nearbyMobiles = m_UOACZFirefield.Map.GetMobilesInRange(m_UOACZFirefield.Location, 0); foreach (Mobile mobile in nearbyMobiles) { if (m_UOACZFirefield == null) { continue; } if (m_UOACZFirefield.Deleted) { continue; } if (!UOACZSystem.IsUOACZValidMobile(mobile)) { continue; } PlayerMobile player = mobile as PlayerMobile; if (player != null) { if (player.IsUOACZUndead) { if (player.m_UOACZAccountEntry.UndeadProfile.ActiveForm == UOACZUndeadUpgradeType.FlamingZombie) { continue; } } } if (mobile is UOACZFlamingZombie) { continue; } if (m_UOACZFirefield.m_UndeadBased) { if (mobile is UOACZBaseUndead) { continue; } if (player != null) { if (player.IsUOACZUndead) { continue; } } } else { if (mobile is UOACZBaseHuman) { continue; } if (player != null) { if (player.IsUOACZHuman) { continue; } } } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); if (m_UOACZFirefield == null) { continue; } if (m_UOACZFirefield.Deleted) { continue; } if (!UOACZSystem.IsUOACZValidMobile(mobile)) { continue; } int minDamage = 3; int maxDamage = 5; double damageScalar = 1; if (mobile is BaseCreature) { damageScalar = 2; } double damage = (double)Utility.RandomMinMax(minDamage, maxDamage) * damageScalar; if (damage > 0) { int finalDamage = (int)(Math.Round(damage)); AOS.Damage(mobile, finalDamage, 0, 100, 0, 0, 0); Effects.PlaySound(mobile.Location, mobile.Map, m_UOACZFirefield.m_HitSound); } } }
public void Ignite(Mobile from) { if (Burning) { return; } Burning = true; Effects.PlaySound(Location, Map, 0x5CF); Effects.SendLocationParticles(EffectItem.Create(Location, Map, TimeSpan.FromSeconds(1.0)), 0x3709, 10, 30, 0, 0, 5052, 0); Queue m_Queue = new Queue(); IPooledEnumerable nearbyItems = Map.GetItemsInRange(Location, 1); foreach (Item item in nearbyItems) { if (item is UOACZOilLocation) { m_Queue.Enqueue(item); } } nearbyItems.Free(); while (m_Queue.Count > 0) { Item item = (Item)m_Queue.Dequeue(); if (item is UOACZOilLocation) { Timer.DelayCall(TimeSpan.FromSeconds(.2), delegate { if (item == null) { return; } if (item.Deleted) { return; } UOACZOilLocation oilLocation = item as UOACZOilLocation; oilLocation.Ignite(from); }); } } Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (Deleted) { return; } UOACZFirefield firefield = new UOACZFirefield(from); firefield.MoveToWorld(Location, Map); Delete(); }); }
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); } }); }); }