private void OnFirebombTimerTick() { if (Deleted) { m_Timer.Stop(); return; } if (Map == Map.Internal && HeldBy == null) { return; } switch (m_Ticks) { case 0: case 1: case 2: { ++m_Ticks; if (HeldBy != null) { HeldBy.PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } else if (RootParent == null) { PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } else if (RootParent is Mobile) { ((Mobile)RootParent).PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } break; } default: { if (HeldBy != null) { HeldBy.DropHolding(); } if (RootParent is Mobile) { Mobile parent = (Mobile)RootParent; parent.SendLocalizedMessage(1060583); //The firebomb explodes in your hand! AOS.Damage(parent, Utility.Random(3) + 4, 0, 100, 0, 0, 0); } else if (RootParent == null) { List <Mobile> toDamage = new List <Mobile>(); IPooledEnumerable eable = Map.GetMobilesInRange(Location, 1); foreach (Mobile m in eable) { toDamage.Add(m); } eable.Free(); Mobile victim; for (int i = 0; i < toDamage.Count; ++i) { victim = toDamage[i]; if (m_LitBy == null || (SpellHelper.ValidIndirectTarget(m_LitBy, victim) && m_LitBy.CanBeHarmful(victim, false))) { if (m_LitBy != null) { m_LitBy.DoHarmful(victim); } AOS.Damage(victim, m_LitBy, Utility.Random(3) + 4, 0, 100, 0, 0, 0); } } (new FirebombField(m_LitBy, toDamage)).MoveToWorld(Location, Map); } m_Timer.Stop(); Delete(); break; } } }
private void OnFirebombTimerTick() { if (Deleted) { m_Timer.Stop(); return; } if (Map == Map.Internal && HeldBy == null) { return; } switch (m_Ticks) { case 0: case 1: case 2: { ++m_Ticks; if (HeldBy != null) { HeldBy.PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } else if (RootParent == null) { PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } else if (RootParent is Mobile) { ((Mobile)RootParent).PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } break; } default: { if (HeldBy != null) { HeldBy.DropHolding(); } if (m_Users != null) { foreach (Mobile m in m_Users) { ThrowTarget targ = m.Target as ThrowTarget; if (targ != null && targ.Bomb == this) { Target.Cancel(m); } } m_Users.Clear(); m_Users = null; } if (RootParent is Mobile) { Mobile parent = (Mobile)RootParent; parent.SendLocalizedMessage(1060583); // The firebomb explodes in your hand! AOS.Damage(parent, Utility.Random(3) + 4, 0, 100, 0, 0, 0); } else if (RootParent == null) { IEnumerable <Mobile> targets = GetTargets(); foreach (Mobile victim in targets) { if (m_LitBy != null) { m_LitBy.DoHarmful(victim); } AOS.Damage(victim, m_LitBy, Utility.Random(3) + 4, 0, 100, 0, 0, 0); } new FirebombField(m_LitBy, targets.ToList()).MoveToWorld(Location, Map); } m_Timer.Stop(); Delete(); break; } } }
private void OnFirebombTimerTick() { if (Deleted) { m_Timer.Stop(); return; } if (Map == Map.Internal && HeldBy == null) { return; } switch (m_Ticks) { case 0: case 1: case 2: { ++m_Ticks; if (HeldBy != null) { HeldBy.PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } else if (RootParent == null) { PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } else if (RootParent is Mobile mobile) { mobile.PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } break; } default: { HeldBy?.DropHolding(); if (m_Users != null) { foreach (Mobile m in m_Users) { if (m.Target is ThrowTarget targ && targ.Bomb == this) { Target.Cancel(m); } } m_Users.Clear(); m_Users = null; } if (RootParent is Mobile parent) { parent.SendLocalizedMessage(1060583); // The firebomb explodes in your hand! AOS.Damage(parent, Utility.Random(3) + 4, 0, 100, 0, 0, 0); } else if (RootParent == null) { IPooledEnumerable <Mobile> eable = Map.GetMobilesInRange(Location, 1); List <Mobile> toDamage = eable.ToList(); eable.Free(); for (int i = 0; i < toDamage.Count; ++i) { Mobile victim = toDamage[i]; if (m_LitBy == null || (SpellHelper.ValidIndirectTarget(m_LitBy, victim) && m_LitBy.CanBeHarmful(victim, false))) { m_LitBy?.DoHarmful(victim); AOS.Damage(victim, m_LitBy, Utility.Random(3) + 4, 0, 100, 0, 0, 0); } } new FirebombField(m_LitBy, toDamage).MoveToWorld(Location, Map); } m_Timer.Stop(); Delete(); break; } } }
private void OnFirebombTimerTick() { if (Deleted) { _timerToken.Cancel(); return; } if (Map == Map.Internal && HeldBy == null) { return; } switch (m_Ticks) { case 0: case 1: case 2: { ++m_Ticks; if (HeldBy != null) { HeldBy.PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } else if (RootParent == null) { PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } else if (RootParent is Mobile mobile) { mobile.PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } break; } default: { HeldBy?.DropHolding(); if (m_Users != null) { foreach (var m in m_Users) { if (m.Target is ThrowTarget targ && targ.Bomb == this) { Target.Cancel(m); } } m_Users.Clear(); m_Users = null; } if (RootParent is Mobile parent) { parent.SendLocalizedMessage(1060583); // The firebomb explodes in your hand! AOS.Damage(parent, Utility.Random(3) + 4, 0, 100, 0, 0, 0); } else if (RootParent == null) { var eable = Map.GetMobilesInRange(Location, 1); using var targets = PooledRefQueue <Mobile> .Create(); foreach (var m in eable) { if (m_LitBy == null || SpellHelper.ValidIndirectTarget(m_LitBy, m) && m_LitBy.CanBeHarmful(m, false)) { targets.Enqueue(m); } } eable.Free(); while (targets.Count > 0) { var victim = targets.Dequeue(); m_LitBy?.DoHarmful(victim); AOS.Damage(victim, m_LitBy, Utility.Random(3) + 4, 0, 100, 0, 0, 0); } var loc = _thrownFromLocation; var eastToWest = SpellHelper.GetEastToWest(loc, Location); Effects.PlaySound(loc, Map, 0x20C); var itemID = eastToWest ? 0x398C : 0x3996; for (var i = -2; i <= 2; ++i) { var targetLoc = new Point3D(eastToWest ? loc.X + i : loc.X, eastToWest ? loc.Y : loc.Y + i, loc.Z); new FireFieldSpell.FireFieldItem(itemID, targetLoc, m_LitBy, Map, TimeSpan.FromSeconds(9), i); } } _timerToken.Cancel(); Delete(); break; } } }
private void OnFirebombTimerTick() { if (Deleted) { m_Timer.Stop(); return; } if (Map == Map.Internal && HeldBy == null) { return; } switch (m_Ticks) { case 0: case 1: case 2: { ++m_Ticks; if (HeldBy != null) { HeldBy.PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } else if (RootParent == null) { PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } else if (RootParent is Mobile mobile) { mobile.PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } break; } default: { if (HeldBy != null) { HeldBy.DropHolding(); } if (m_Users != null) { for (var index = 0; index < m_Users.Count; index++) { Mobile m = m_Users[index]; if (m.Target is ThrowTarget targ && targ.Bomb == this) { Target.Cancel(m); } } m_Users.Clear(); m_Users = null; } if (RootParent is Mobile mobile) { Mobile parent = mobile; parent.SendLocalizedMessage(1060583); // The firebomb explodes in your hand! AOS.Damage(parent, Utility.Random(3) + 4, 0, 100, 0, 0, 0); } else if (RootParent == null) { IEnumerable <Mobile> targets = GetTargets(); var enumerable = new List <Mobile>(); foreach (var target in targets) { enumerable.Add(target); } for (var index = 0; index < enumerable.Count; index++) { Mobile victim = enumerable[index]; if (m_LitBy != null) { m_LitBy.DoHarmful(victim); } AOS.Damage(victim, m_LitBy, Utility.Random(3) + 4, 0, 100, 0, 0, 0); } List <Mobile> list = new List <Mobile>(); for (var index = 0; index < enumerable.Count; index++) { var target = enumerable[index]; list.Add(target); } new FirebombField(m_LitBy, list).MoveToWorld(Location, Map); } m_Timer.Stop(); Delete(); break; } } }
private void OnFirebombTimerTick() { if (Deleted) { m_Timer.Stop(); return; } if (Map == Map.Internal && HeldBy == null) { return; } switch (m_Ticks) { case 0: case 1: case 2: { ++m_Ticks; if (HeldBy != null) { HeldBy.PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } else if (RootParent == null) { PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } else if (RootParent is Mobile) { ((Mobile)RootParent).PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString()); } break; } default: { if (HeldBy != null) { HeldBy.DropHolding(); } if (m_Users != null) { foreach (Mobile m in m_Users) { var targ = m.Target as ThrowTarget; if (targ != null && targ.Bomb == this) { Target.Cancel(m); } } m_Users.Clear(); m_Users = null; } if (RootParent is Mobile) { var parent = (Mobile)RootParent; parent.SendLocalizedMessage(1060583); // The firebomb explodes in your hand! parent.Damage(Utility.Random(3) + 4); } else if (RootParent == null) { Geometry.Circle2D(Location, Map, 4, FireBombEffect); } m_Timer.Stop(); Delete(); break; } } }