public virtual void Explode(Mobile from, Mobile m, Map map) { if (Deleted || map == null) { return; } Consume(); // Check if any other players are using this potion for (int i = 0; i < m_Users.Count; i++) { ThrowTarget targ = m_Users[i].Target as ThrowTarget; if (targ != null && targ.Potion == this) { Target.Cancel(from); } } // Effects Effects.PlaySound(m.Location, map, 285); m.Damage(0); Effects.SendPacket(m.Location, m.Map, new ParticleEffect(EffectType.FixedFrom, Serial, Serial.Zero, 0x373A, m.Location, m.Location, 10, 10, false, false, 0, 0, 0, 5051, 1, Serial.Zero, 89, 0)); int amount = 0; if (m.Backpack != null) { foreach (BasePotion p in m.Backpack.FindItemsByType <BasePotion>()) { amount += p.Amount; } } if (amount < 20) { from.SendLocalizedMessage(1115760, from.Name); // ~1_NAME~'s shatter potion hits you, but nothing happens. } else { int p = (int)(amount * 0.2); if (p > 1) { from.SendLocalizedMessage(1115762, string.Format("{0}\t{1}", from.Name, p)); // ~1_NAME~'s shatter potion destroys ~2_NUM~ potions in your inventory. } else { from.SendLocalizedMessage(1115761, from.Name); // ~1_NAME~'s shatter potion destroys a potion in your inventory. } for (int i = 0; i < p; i++) { List <BasePotion> potions = m.Backpack.FindItemsByType <BasePotion>(); potions[Utility.Random(potions.Count)].Consume(); } } }
public override void Drink(Mobile from) { if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendAsciiMessage("You can not use a purple potion while paralyzed."); // You can not use a purple potion while paralyzed. return; } ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); if (m_Users == null) { m_Users = new ArrayList(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer == null) { from.SendAsciiMessage("You should throw it now!"); // You should throw it now! m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); } }
public override void Drink(Mobile from) { ThrowTarget targ = from.Target as ThrowTarget; this.Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode. if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); if (m_Users == null) { m_Users = new ArrayList(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer == null) { from.SendLocalizedMessage(500236); // You should throw it now! m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 2.6 seconds explosion delay } }
public virtual void Explode(Mobile from, Point3D loc, Map map) { if (Deleted || map == null) { return; } Consume(); // Check if any other players are using this potion for (int i = 0; i < m_Users.Count; i++) { ThrowTarget targ = m_Users[i].Target as ThrowTarget; if (targ != null && targ.Potion == this) { Target.Cancel(from); } } // Effects Effects.PlaySound(loc, map, 0x207); Geometry.Circle2D(loc, map, Radius, new DoEffect_Callback(BlastEffect), 270, 90); Timer.DelayCall(TimeSpan.FromSeconds(0.3), new TimerStateCallback(CircleEffect2), new object[] { loc, map }); foreach (Mobile mobile in map.GetMobilesInRange(loc, Radius)) { this.DoClumsy(from); } }
public virtual void Explode(Mobile from, Point3D loc, Map map) { if (this.Deleted || map == null) return; this.Consume(); // Check if any other players are using this potion for (int i = 0; i < this.m_Users.Count; i ++) { ThrowTarget targ = this.m_Users[i].Target as ThrowTarget; if (targ != null && targ.Potion == this) Target.Cancel(from); } // Effects Effects.PlaySound(loc, map, 0x20C); for (int i = -2; i <= 2; i ++) { for (int j = -2; j <= 2; j ++) { Point3D p = new Point3D(loc.X + i, loc.Y + j, map.GetAverageZ(loc.X + i, loc.Y + j)); if (map.CanFit(p, 12, true, false) && from.InLOS(p)) new InternalItem(from, p, map, this.MinDamage, this.MaxDamage); } } }
public override void Drink(Mobile from) { if (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } ThrowTarget targ = from.Target as ThrowTarget; Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode. if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); from.Target = new ThrowTarget(this); if (m_Timer == null) { from.SendLocalizedMessage(500236); // You should throw it now! m_Timer = Timer.DelayCall( TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 3.6 seconds explosion delay } }
public override void Drink(Mobile from) { if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendLocalizedMessage(1062725); // You can not use that potion while paralyzed. return; } int delay = GetDelay(from); if (delay > 0) { from.SendLocalizedMessage(1072529, String.Format("{0}\t{1}", delay, delay > 1 ? "seconds." : "second.")); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~ return; } ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); }
public override void Drink(Mobile from) { Target t; if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. } else if (!from.Region.AllowHarmful(from, from)) { from.SendMessage("That doesn't feel like a good idea."); return; } else if ((from.FollowersMax - from.Followers) < 1) { from.SendMessage("You have too many followers to control the slime."); return; } else { from.SendMessage("Where do you want to dump the mixture?"); ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); from.Target = new ThrowTarget(this); } }
public override void Drink(Mobile from) { ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); if (m_Users == null) { m_Users = new ArrayList(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer == null || !m_Timer.Running) { from.SendLocalizedMessage(500236); // You should throw it now! int val = 3 + Utility.Random(4); m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), val + 1, new TimerStateCallback(Detonate_OnTick), new object[] { from, val }); } }
public override void Drink(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. } else if (!from.Region.AllowHarmful(from, from)) { from.SendMessage("That doesn't feel like a good idea."); return; } else if (Server.Items.MonsterSplatter.TooMuchSplatter(from)) { from.SendMessage("There is too much liquid on the ground already."); return; } else { from.SendMessage("Where do you want to dump the poison?"); ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); from.Target = new ThrowTarget(this); Misc.Titles.AwardKarma(from, -40, true); } }
public override void Drink(Mobile from) { int skillLevel = 50; if (this is PoisonPotion) { skillLevel = 60; } else if (this is GreaterPoisonPotion) { skillLevel = 70; } else if (this is DeadlyPoisonPotion) { skillLevel = 80; } else if (this is LethalPoisonPotion) { skillLevel = 90; } if (from.Skills[SkillName.Poisoning].Value >= skillLevel) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. } else if (!from.Region.AllowHarmful(from, from)) { from.SendMessage("That doesn't feel like a good idea."); return; } else if (Server.Items.MonsterSplatter.TooMuchSplatter(from)) { from.SendMessage("There is too much liquid on the ground already."); return; } else { from.SendMessage("Where do you want to dump the poison?"); ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); from.Target = new ThrowTarget(this); Misc.Titles.AwardKarma(from, -40, true); } } else { DoPoison(from); BasePotion.PlayDrinkEffect(from); this.Consume(); } }
public override void Drink(Mobile from) { if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); if (m_Users == null) { m_Users = new ArrayList(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } if (from is PlayerMobile) { PlayerMobile mob = (PlayerMobile)from; if (mob.ExploPot == null) { from.Target = new ThrowTarget(this); if (m_Timer == null) { int time = (Utility.RandomBool() ? 3 : 4); from.SendLocalizedMessage(500236); // You should throw it now! m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), (time + 1), new TimerStateCallback(Detonate_OnTick), new object[] { from, time }); } mob.ExploPot = this; Timer.DelayCall(TimeSpan.FromSeconds(Delay), new TimerStateCallback(ReleaseExploLock), from); } else if (mob.ExploPot == this) { from.Target = new ThrowTarget(this); } else { from.SendMessage(0x22, "You must wait 4 seconds before using another explosion potion."); } } }
// private List<Mobile> m_Users; public override void Drink(Mobile from) { if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendLocalizedMessage(1062725); // You can not use that potion while paralyzed. } else { ThrowTarget targ = from.Target as ThrowTarget; this.Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode. if (targ != null && targ.Potion == this) //Already have a targeter from this potion { return; } from.RevealingAction(); // if ( m_Users == null ) // m_Users = new List<Mobile>(); if (m_Timer == null) //Is this already ticking? { if (from.BeginAction(typeof(BaseExplosionPotion))) //Can we throw another potion? { // if ( !m_Users.Contains( from ) ) // m_Users.Add( from ); from.Target = new ThrowTarget(this); from.SendLocalizedMessage(500236); // You should throw it now! int count = Utility.Random(3, 2); if (Core.ML) { m_Timer = Timer.DelayCall <ExplodeCount>(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5, new TimerStateCallback <ExplodeCount>(Detonate_OnTick), new ExplodeCount(from, count)); // 3.6 seconds explosion delay } else { m_Timer = Timer.DelayCall <ExplodeCount>(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, new TimerStateCallback <ExplodeCount>(Detonate_OnTick), new ExplodeCount(from, count)); // 2.6 seconds explosion delay } Timer.DelayCall <Mobile>(TimeSpan.FromSeconds(Delay), new TimerStateCallback <Mobile>(ReleaseExplosionLock), from); } else { from.LocalOverheadMessage(MessageType.Regular, 0x22, false, "You must wait a moment before using another explosion potion."); } } else { from.Target = new ThrowTarget(this); } } }
public override void ExplodeEffect(MapTile landingTile) { var grenade = new Equipments.Utilities.Grenades.SmokeGrenade(); var aoeTile = ThrowTarget.FindAOETiles(landingTile.UiTile, grenade.BlastAreaOfEffect, grenade.ShrapnelAreaOfEffect); foreach (var mapTile in aoeTile.Item1) { mapTile.CreateProp(Resources.Load("Prefabs/Battle/Map/Props/SmokeEffect", typeof(GameObject)) as GameObject); } //AbilityPause.StartPause(1.5F, this, "EndAbility"); }
public virtual void Explode(Mobile from, Point3D loc, Map map) { double PoisonChance = .1; if (Deleted || map == null) { return; } Consume(); // Check if any other players are using this potion for (int i = 0; i < m_Users.Count; i++) { ThrowTarget targ = m_Users[i].Target as ThrowTarget; if (targ != null && targ.Potion == this) { Target.Cancel(from); } } // Effects Effects.PlaySound(loc, map, 0x207); Geometry.Circle2D(loc, map, Radius, new DoEffect_Callback(BlastEffect), 270, 90); Timer.DelayCall(TimeSpan.FromSeconds(0.3), new TimerStateCallback(CircleEffect2), new object[] { loc, map }); foreach (Mobile mobile in map.GetMobilesInRange(loc, Radius)) { if (mobile is BaseCreature) { BaseCreature mon = (BaseCreature)mobile; if (mon.Controlled || mon.Summoned) { continue; } mon.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(5.0)); // TODO check if (Poison != null) { PoisonChance = 10; PoisonChance += ((from.Skills[SkillName.Poisoning].Value + from.Skills[SkillName.Alchemy].Value + from.Skills[SkillName.TasteID].Value) / 333); if (PoisonChance > Utility.RandomDouble()) { mon.ApplyPoison(Poisoner, Poison); } } } } }
public override void Drink(Mobile from) { PlayerMobile pm = from as PlayerMobile; if (pm.Level < RequiredLevel) { from.SendMessage("Your level isn't high enough to use this potion."); return; } if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } ThrowTarget targ = from.Target as ThrowTarget; this.Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode. if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); if (m_Users == null) { m_Users = new ArrayList(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer == null) { from.SendLocalizedMessage(500236); // You should throw it now! if (Core.ML) { m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 3.6 seconds explosion delay } else { m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 2.6 seconds explosion delay } } }
public override void Drink(Mobile from) { if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } // you must be skilled to detonate a bomb off the ground (or other non-backpack location) if (!this.IsChildOf(from.Backpack) && !(ChanceBasedOnAbility(from) >= Utility.RandomDouble())) { from.SendMessage("You fail in your attempt to arm the purple potion."); return; } //reset from's swingtimer BaseWeapon weapon = from.Weapon as BaseWeapon; if (weapon != null) { from.NextCombatTime = DateTime.Now + weapon.GetDelay(from); } ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.Potion == this) { return; } // we will also reveal on target. Tageting is now a criminal action from.RevealingAction(); if (m_Users == null) { m_Users = new ArrayList(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer == null) { from.SendLocalizedMessage(500236); // You should throw it now! int numberoftics = 3; //minimum numberoftics += Utility.Random(0, 3); // add 0,1,or 2 tics to make the total time 3-5 seconds m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), numberoftics + 1, new TimerStateCallback(Detonate_OnTick), new object[] { from, numberoftics }); } }
public override void Drink(Mobile from) { if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } if (!from.BeginAction(typeof(BaseExplosionPotion))) { from.PrivateOverheadMessage(MessageType.Regular, 0x22, false, "You must wait a few seconds before using another explosion potion.", from.NetState); return; } ThrowTarget targ = from.Target as ThrowTarget; this.Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode. if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); if (m_Users == null) { m_Users = new ArrayList(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer == null) { if (from.Region is UOACZRegion) { Timer.DelayCall(TimeSpan.FromSeconds(60.0), new TimerStateCallback(ReleaseExploLock), from); } else { Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(ReleaseExploLock), from); } from.SendLocalizedMessage(500236); // You should throw it now! m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); } }
public override void Drink(Mobile from) { ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); from.Target = new ThrowTarget(this); }
public override void Drink(Mobile from) { if (!from.CanBeginAction(typeof(BaseExplosionPotion))) //Checking the block { from.SendMessage("You should wait before reusing this potion"); return; } if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } ThrowTarget targ = from.Target as ThrowTarget; this.Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode. if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); if (m_Users == null) { m_Users = new List <Mobile>(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer == null) { from.SendLocalizedMessage(500236); // You should throw it now! if (Core.ML) { m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 3.6 seconds explosion delay } else { m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 5, new TimerStateCallback(Detonate_OnTick), new object[] { from, Utility.RandomMinMax(3, 4) }); // 2.6 seconds explosion delay } } }
public override void Drink(Mobile from) { if (Core.AOS && (from.Paralyzed || from.Blessed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendMessage("You cannot do that yet."); return; } else if (!from.Region.AllowHarmful(from, from)) { from.SendMessage("That doesn't feel like a good idea."); return; } ThrowTarget targ = from.Target as ThrowTarget; this.Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode. if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); if (m_Users == null) { m_Users = new ArrayList(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer == null) { from.SendLocalizedMessage(500236); // You should throw it now! if (Core.ML) { m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 3.6 seconds explosion delay } else { m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 2.6 seconds explosion delay } } }
public override void OnDoubleClick(Mobile from) { if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. return; } if (from.Paralyzed || from.Frozen) { from.SendAsciiMessage("You cannot use this while frozen"); return; } if (!from.CanBeginAction(typeof(ThrowableItem))) { from.SendAsciiMessage("You must wait before throwing again"); return; } ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.ThrowableItem == this) { return; } from.RevealingAction(); from.BeginAction(typeof(ThrowableItem)); Timer.DelayCall(TimeSpan.FromSeconds(m_UseDelay), new TimerStateCallback(EndThrowableDelay), from); if (m_Users == null) { m_Users = new ArrayList(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer == null && m_DetonationDelay > 0) { from.SendLocalizedMessage(500236); // You should throw it now! m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), m_DetonationDelay + 1, new TimerStateCallback(Detonate_OnTick), new object[] { from, m_DetonationDelay }); } }
public virtual void Explode(Mobile from, Point3D loc, Map map) { if (Deleted || map == null) { return; } Consume(); // Check if any other players are using this potion for (int i = 0; i < m_Users.Count; i++) { ThrowTarget targ = m_Users[i].Target as ThrowTarget; if (targ != null && targ.Potion == this) { Target.Cancel(from); } } // Effects Effects.PlaySound(loc, map, 0x207); Geometry.Circle2D(loc, map, Radius, new DoEffect_Callback(TarEffect), 270, 90); Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(CircleEffect2), new object[] { loc, map }); IPooledEnumerable eable = map.GetMobilesInRange(loc, Radius); foreach (Mobile mobile in eable) { if (mobile != from) { if (mobile is PlayerMobile) { PlayerMobile player = (PlayerMobile)mobile; player.SendLocalizedMessage(1095151); } mobile.SendSpeedControl(SpeedControlType.WalkSpeed); Timer.DelayCall(TimeSpan.FromMinutes(1.0), delegate() { mobile.SendSpeedControl(SpeedControlType.Disable); }); } } eable.Free(); }
public void Targeting() { if (TargetingType == TargetingTypes.Cone) { var coneTarget = new ConeTarget(); coneTarget.SubscribeToHoverTile(); } if (TargetingType == TargetingTypes.Point) { var throwTarget = new ThrowTarget(10, 1, 3); throwTarget.SubscribeToHoverTile(); } }
public override void Drink(Mobile from) { if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } if (from.BeginAction(typeof(BaseExplosionPotion))) { from.EndAction(typeof(BaseExplosionPotion)); //Timer should start when targeting ThrowTarget targ = from.Target as ThrowTarget; Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode. if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); if (m_Users == null) { m_Users = new ArrayList(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer == null) { from.SendLocalizedMessage(500236); // You should throw it now! //if (Core.ML) // m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5, new TimerStateCallback(Detonate_OnTick), new object[] {from, 3}); // 3.6 seconds explosion delay //else m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 2.6 seconds explosion delay } } else { from.SendAsciiMessage("You can't use another explosion potion yet!"); } }
public override void Drink(Mobile from) { if (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.Potion == this) { return; } if (!from.BeginAction(typeof(BaseExplosionPotion))) { from.SendLocalizedMessage(500119); // You must wait to perform another action return; } from.RevealingAction(); if (m_Users == null) { m_Users = new List <Mobile>(); } foreach (Mobile m in m_Users) { m.EndAction(typeof(BaseExplosionPotion)); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer != null) { m_Timer.Stop(); } from.SendLocalizedMessage(500236); // You should throw it now! m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); }
public override void Drink(Mobile from) { if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } //reset from's swingtimer BaseWeapon weapon = from.Weapon as BaseWeapon; if (weapon != null) { from.NextCombatTime = DateTime.Now + weapon.GetDelay(from); } ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); if (m_Users == null) { m_Users = new ArrayList(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer == null) { from.SendLocalizedMessage(500236); // You should throw it now! int numberoftics = 3; //minimum numberoftics += Utility.Random(0, 3); // add 0,1,or 2 tics to make the total time 3-5 seconds m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), numberoftics + 1, new TimerStateCallback(Detonate_OnTick), new object[] { from, numberoftics }); } }
public override void Drink(Mobile from) { int Delay = 5; // <- Added this line to set the delay between use if (from.BeginAction(typeof(BaseExplosionPotion))) // <- Added this line and set it to BaseExplosionPotion { if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } ThrowTarget targ = from.Target as ThrowTarget; if (targ != null && targ.Potion == this) { return; } from.RevealingAction(); if (m_Users == null) { m_Users = new ArrayList(); } if (!m_Users.Contains(from)) { m_Users.Add(from); } from.Target = new ThrowTarget(this); Timer.DelayCall(TimeSpan.FromSeconds(Delay), new TimerStateCallback(ReleaseExploderLock), from); // <- Added this line to set the timer for allowing you to throw another if (m_Timer == null) { from.SendLocalizedMessage(500236); // You should throw it now! m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 5, new TimerStateCallback(Detonate_OnTick), new object[] { from, Utility.RandomMinMax(3, 4) }); } } else { from.SendMessage("You must wait a few seconds before using another explosion potion."); } }
public virtual void Explode(Mobile from, Point3D loc, Map map) { if (Deleted || map == null) { return; } Consume(); // Check if any other players are using this potion for (int i = 0; i < m_Users.Count; i++) { ThrowTarget targ = m_Users[i].Target as ThrowTarget; if (targ != null && targ.Potion == this) { Target.Cancel(from); } } Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(TarEffect), new object[] { loc, map }); IPooledEnumerable eable = map.GetMobilesInRange(loc, Radius); foreach (Mobile mobile in eable) { if (mobile != from && from.CanBeHarmful(mobile, false)) { double chance = (double)(((4 * mobile.Skills[SkillName.MagicResist].Value) + 150) / 700); if (chance < Utility.RandomDouble()) { mobile.SendLocalizedMessage(1115815); // You resist the effects of the Fear Essence. } else { Point3D p = mobile.Location; Effects.SendPacket(p, mobile.Map, new ParticleEffect(EffectType.FixedFrom, Serial, Serial.Zero, 0x376A, p, p, 9, 32, false, false, 0, 0, 0, 5039, 1, Serial.Zero, 254, 0)); mobile.Damage(0, from); mobile.Paralyze(TimeSpan.FromSeconds(3)); from.DoHarmful(mobile); } } } eable.Free(); }
public override void Drink(Mobile from) { if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell?.IsCasting == true)) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } ThrowTarget targ = from.Target as ThrowTarget; Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode. if (targ?.Potion == this) { return; } from.RevealingAction(); Users ??= new List <Mobile>(); if (!Users.Contains(from)) { Users.Add(from); } from.Target = new ThrowTarget(this); if (m_Timer == null) { from.SendLocalizedMessage(500236); // You should throw it now! int timer = 3; if (Core.ML) { m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5, () => Detonate_OnTick(from, timer--)); // 3.6 seconds explosion delay } else { m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, () => Detonate_OnTick(from, timer--)); // 2.6 seconds explosion delay } } }