protected override void OnTarget(Mobile from, object targeted) { if (m_Potion.Deleted || m_Potion.Map == Map.Internal) { return; } IPoint3D p = targeted as IPoint3D; if (p == null) { return; } Map map = from.Map; if (map == null) { return; } SpellHelper.GetSurfaceTop(ref p); from.RevealingAction(); IEntity to; to = new Entity(Serial.Zero, new Point3D(p), map); if (p is Mobile) { if (!RelativeLocation) // explosion location = current mob location. { p = ((Mobile)p).Location; } else { to = (Mobile)p; } } Effects.SendMovingEffect(from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0); if (m_Potion.Amount > 1) { Mobile.LiftItemDupe(m_Potion, 1); } m_Potion.Internalize(); Timer.DelayCall( TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, p, map }); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Potion != null && !m_Potion.Deleted && m_Potion.Map != Map.Internal) { var mob = targeted as Mobile; var p = targeted as IPoint3D; if (p != null) { Map map = from.Map; if (map != null) { SpellHelper.GetSurfaceTop(ref p); from.RevealingAction(); IEntity to = new Entity(Serial.Zero, new Point3D(p), map); if (RelativeLocation && mob != null) { to = mob; } Effects.SendMovingEffect(from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0); var entity = targeted as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, m_Potion)) { Effects.PlaySound(p, map, 0x307); Effects.SendLocationEffect(p, map, 0x36BD, 9, 10, 0, 0); m_Potion.Consume(); return; } if (m_Potion.Amount > 1) { Mobile.LiftItemDupe(m_Potion, 1); } m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), m_Potion.Reposition_OnTick, new[] { from, to }); } } } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Potion.Deleted || m_Potion.Map == Map.Internal) { return; } Map map = from.Map; if (map == null) { return; } IPoint3D ip = targeted as IPoint3D; if (ip == null) { return; } Point3D p = new Point3D(ip); if (!SpellHelper.CheckSafeZone(p, from)) { from.SendMessage("Can't throw it there!"); from.Target = new ThrowTarget(m_Potion); return; } SpellHelper.GetSurfaceTop(ref ip); p.Z = ip.Z; from.RevealingAction(); IEntity to = new Entity(Serial.Zero, p, map); Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); if (m_Potion.Amount > 1) { Mobile.LiftItemDupe(m_Potion, 1); } m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, p, map }); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Potion.Deleted || m_Potion.Map == Map.Internal) { return; } IPoint3D ip = targeted as IPoint3D; if (ip == null) { return; } Map map = from.Map; if (map == null) { return; } SpellHelper.GetSurfaceTop(ref ip); Point3D p = new Point3D(ip); from.RevealingAction(); IEntity to; /* if ( p is Mobile ) * to = (Mobile)p; * else */ to = new Entity(Serial.Zero, new Point3D(p), map); Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 10, 0, false, false, m_Potion.Hue, 0); if (m_Potion.Amount > 1) { Mobile.LiftItemDupe(m_Potion, 1); } m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(0.35), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, p, map }); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Potion.Deleted || m_Potion.Map == Map.Internal) { return; } IPoint3D p = targeted as IPoint3D; if (p == null) { return; } Map map = from.Map; if (map == null) { return; } SpellHelper.GetSurfaceTop(ref p); from.RevealingAction(); IEntity to; Point3D pt = new Point3D(p); if (p is Mobile) { to = (Mobile)p; } else { to = new Entity(Serial.Zero, pt, map); } Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, pt, map }); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Potion.Deleted || m_Potion.Map == Map.Internal) { return; } IPoint3D p = targeted as IPoint3D; if (p == null) { return; } Map map = from.Map; if (map == null) { return; } SpellHelper.GetSurfaceTop(ref p); from.RevealingAction(); IEntity to = new Entity(Serial.Zero, new Point3D(p), map); Effects.SendMovingEffect(from, (RelativeLocation && p is Mobile) ? (Mobile)p : to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0); if (m_Potion.Amount > 1) { Mobile.LiftItemDupe(m_Potion, 1); } m_Potion.Internalize(); Timer.DelayCall <IEntity[]>(TimeSpan.FromSeconds(1.0), new TimerStateCallback <IEntity[]>(m_Potion.Reposition_OnTick), new IEntity[] { from, to }); }
protected override void OnTarget(Mobile from, object targeted) { //reset from's swingtimer BaseWeapon weapon = from.Weapon as BaseWeapon; if (weapon != null) { from.NextCombatTime = DateTime.Now + weapon.GetDelay(from); } if (m_Potion.Deleted || m_Potion.Map == Map.Internal) { return; } IPoint3D p = targeted as IPoint3D; if (p == null) { return; } Map map = from.Map; if (map == null) { return; } SpellHelper.GetSurfaceTop(ref p); // erl: 04/27/05, spawn mobile check at target location if (!map.CanSpawnMobile(p.X, p.Y, p.Z) && !(p is Mobile)) { from.SendLocalizedMessage(501942); // That location is blocked. return; } // adam: add target 'under house' exploit check if (!from.CanSee(p) || (p is Server.Targeting.LandTarget && Server.Multis.BaseHouse.FindHouseAt(((Server.Targeting.LandTarget)(p)).Location, from.Map, 16) != null)) { from.SendLocalizedMessage(500237); // Target can not be seen. return; } // reveal on throw from.RevealingAction(); // adam: criminal action on throw if (m_Potion.InTown(from)) { from.CriminalAction(true); } IEntity to; bool bMobile = CoreAI.ExplosionPotionTargetMethod == CoreAI.EPTM.MobileBased; // IN TOWN // if we're in town and the town uses smart guards, and a guard is on us and they have hit us at least once, ... if (m_Potion.InTown(from) && (from.Region as Regions.GuardedRegion).IsSmartGuards && from.Hits < from.HitsMax && m_Potion.IsGuardAttacking(from)) { if (m_Potion.ChanceBasedOnAbility(from) >= Utility.RandomDouble()) { // cool, just throw as per normal to = new Entity(Serial.Zero, new Point3D(p), map); Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, to, map }); } else { switch (Utility.Random(3)) { case 0: // You fumble and drop the potion to your feet. m_Potion.SetFlag(PotFlags.Dud1pt); // minimize collateral damage from.SendMessage("You fumble and drop the potion to your feet."); to = from; Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, to, map }); break; case 1: // The guard blocks you and the potion remains in your backpack! from.SendMessage("The guard blocks you and the potion remains in your backpack!"); break; case 2: // You attempt to toss the potion, but the guard bats it away. m_Potion.SetFlag(PotFlags.Dud1pt); // minimize collateral damage from.SendMessage("You attempt to toss the potion, but the guard bats it away."); to = new Entity(Serial.Zero, Server.Mobiles.Spawner.GetSpawnPosition(from.Map, from.Location, 7, false, m_Potion), map); Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, to, map }); break; } } } // OUT ON THE FIELD // Adam: You must be in top condition to target the player directly //if( bMobile && (from.Stam >= from.StamMax) && (from.Hits >= from.HitsMax) ) else if (bMobile && m_Potion.CheckHealth(from.Stam, from.StamMax, CoreAI.ExplosionPotionThreshold) && m_Potion.CheckHealth(from.Hits, from.HitsMax, CoreAI.ExplosionPotionThreshold)) { if (p is Mobile) { to = (Mobile)p; } else { to = new Entity(Serial.Zero, new Point3D(p), map); } Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, p, map }); } else { to = new Entity(Serial.Zero, new Point3D(p), map); Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, to, map }); } }
protected override void OnTarget(Mobile from, object targeted) { //reset from's swingtimer BaseWeapon weapon = from.Weapon as BaseWeapon; if (weapon != null) { from.NextCombatTime = DateTime.Now + weapon.GetDelay(from); } if (m_Potion.Deleted || m_Potion.Map == Map.Internal) { return; } IPoint3D p = targeted as IPoint3D; if (p == null) { return; } Map map = from.Map; if (map == null) { return; } SpellHelper.GetSurfaceTop(ref p); // erl: 04/27/05, spawn mobile check at target location if (!map.CanSpawnMobile(p.X, p.Y, p.Z) && !(p is Mobile)) { from.SendLocalizedMessage(501942); return; } from.RevealingAction(); IEntity to; bool bMobile = CoreAI.ExplosionPotionTargetMethod == CoreAI.EPTM.MobileBased; // Adam: You must be in top condition to target the player directly //if( bMobile && (from.Stam >= from.StamMax) && (from.Hits >= from.HitsMax) ) if (bMobile && CheckHealth(from.Stam, from.StamMax, CoreAI.ExplosionPotionThreshold) && CheckHealth(from.Hits, from.HitsMax, CoreAI.ExplosionPotionThreshold)) { if (p is Mobile) { to = (Mobile)p; } else { to = new Entity(Serial.Zero, new Point3D(p), map); } Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, p, map }); } else { to = new Entity(Serial.Zero, new Point3D(p), map); Effects.SendMovingEffect(from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0); m_Potion.Internalize(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(m_Potion.Reposition_OnTick), new object[] { from, to, map }); } }