public void AreaPeace() { if (Combatant == null || Deleted || !Alive || m_NextPeace > DateTime.UtcNow || 0.1 < Utility.RandomDouble()) { return; } TimeSpan duration = TimeSpan.FromSeconds(Utility.RandomMinMax(20, 80)); IPooledEnumerable eable = GetMobilesInRange(RangePerception); foreach (Mobile m in eable) { PlayerMobile p = m as PlayerMobile; if (IsValidTarget(p)) { p.PeacedUntil = DateTime.UtcNow + duration; p.SendLocalizedMessage(1072065); // You gaze upon the dryad's beauty, and forget to continue battling! p.FixedParticles(0x376A, 1, 20, 0x7F5, EffectLayer.Waist); p.Combatant = null; } } eable.Free(); m_NextPeace = DateTime.UtcNow + TimeSpan.FromSeconds(10); PlaySound(0x1D3); }
private void Teleport() { List <PlayerMobile> toTele = new List <PlayerMobile>(); foreach (IDamageable target in SpellHelper.AcquireIndirectTargets(this, Location, Map, StrikingRange)) { if (target is PlayerMobile mobile) { toTele.Add(mobile); } } if (toTele.Count > 0) { PlayerMobile from = toTele[Utility.Random(toTele.Count)]; if (from != null) { Combatant = from; from.MoveToWorld(GetSpawnPosition(1), Map); from.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist); from.PlaySound(0x1FE); from.ApplyPoison(this, HitPoison); } } ColUtility.Free(toTele); m_Teleport = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(40, 60)); }
public void Peace(Mobile target) { if (target == null || Deleted || !Alive || m_NextPeace > DateTime.UtcNow || 0.1 < Utility.RandomDouble()) { return; } PlayerMobile p = target as PlayerMobile; if (p != null && p.PeacedUntil < DateTime.UtcNow && !p.Hidden && CanBeHarmful(p)) { p.PeacedUntil = DateTime.UtcNow + TimeSpan.FromMinutes(1); p.SendLocalizedMessage(500616); // You hear lovely music, and forget to continue battling! p.FixedParticles(0x376A, 1, 32, 0x15BD, EffectLayer.Waist); p.Combatant = null; PlaySound(0x58D); } m_NextPeace = DateTime.UtcNow + TimeSpan.FromSeconds(10); }
public void AddPeaceEffects(PlayerMobile p) { p.SendLocalizedMessage(1072065); // You gaze upon the dryad's beauty, and forget to continue battling! p.FixedParticles(0x376A, 1, 20, 0x7F5, EffectLayer.Waist); p.Warmode = false; p.Combatant = null; if (Peaced == null) { Peaced = new Dictionary <Mobile, Timer>(); } if (Peaced.ContainsKey(p)) { Peaced[p].Stop(); } p.PeacedUntil = DateTime.UtcNow + PeaceDuration; Peaced[p] = Timer.DelayCall(PeaceDuration, RemoveTimer, p); }
public virtual void BonusAction(PlayerMobile player, Mobile attacker) { Unicorn c = new Unicorn(); c.SetControlMaster(this); c.MoveToWorld(this.Location, this.Map); c.ControlOrder = OrderType.Guard; new InternalTimer(c).Start(); if (player != null && player.Poisoned) { if (player.CurePoison(this)) { player.SendLocalizedMessage(1010059); //You have been cured of all poisons. player.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist); player.PlaySound(0x1E0); } } }
private void Teleport() { System.Collections.Generic.List <PlayerMobile> toTele = SpellHelper.AcquireIndirectTargets(this, Location, Map, StrikingRange).OfType <PlayerMobile>().ToList(); if (toTele.Count > 0) { PlayerMobile from = toTele[Utility.Random(toTele.Count)]; if (from != null) { Combatant = from; from.MoveToWorld(GetSpawnPosition(1), Map); from.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist); from.PlaySound(0x1FE); from.ApplyPoison(this, HitPoison); } } ColUtility.Free(toTele); m_Teleport = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(40, 60)); }
public void Peace(Mobile target) { if (target == null || Deleted || !Alive || m_NextPeace > DateTime.Now) { return; } PlayerMobile p = target as PlayerMobile; if (p != null && p.PeacedUntil < DateTime.Now && !p.Hidden && CanBeHarmful(p)) { p.PeacedUntil = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(20, 45)); p.SendLocalizedMessage(500616); // You hear lovely music, and forget to continue battling! p.FixedParticles(0x376A, 1, 32, 0x15BD, EffectLayer.Waist); p.Combatant = null; target.Warmode = false; UndressItem(target, Layer.OneHanded); UndressItem(target, Layer.TwoHanded); PlaySound(SpeechHue); } m_NextPeace = DateTime.Now + TimeSpan.FromSeconds(50); }
public virtual void BonusAction( PlayerMobile player, Mobile attacker ) { Unicorn c = new Unicorn(); c.SetControlMaster( this ); c.MoveToWorld( this.Location, this.Map ); c.ControlOrder = OrderType.Guard; new InternalTimer( c ).Start(); if( player != null && player.Poisoned ) { if( player.CurePoison( this ) ) { player.SendLocalizedMessage( 1010059 ); //You have been cured of all poisons. player.FixedParticles( 0x373A, 10, 15, 5012, EffectLayer.Waist ); player.PlaySound( 0x1E0 ); } } }
public BerserkTimer( PlayerMobile owner ) : base(TimeSpan.FromSeconds( 2.0 ), TimeSpan.FromSeconds( 2.0 )) { m_Owner = owner; m_Owner.PlaySound( 0x20F ); m_Owner.PlaySound( m_Owner.Body.IsFemale ? 0x338 : 0x44A ); m_Owner.FixedParticles( 0x376A, 1, 31, 9961, 1160, 0, EffectLayer.Waist ); m_Owner.FixedParticles( 0x37C4, 1, 31, 9502, 43, 2, EffectLayer.Waist ); BuffInfo.AddBuff( m_Owner, new BuffInfo( BuffIcon.Berserk, 1080449, 1115021, "15\t3", false ) ); m_Owner.Berserk = true; }
public static void JailThem( PlayerMobile player, JailOption option ) { if ( null == player || player.AccessLevel >= JailConfig.JailImmuneLevel ) return; if ( JailOption.Squelch == option ) player.Squelched = true; foreach ( Item item in player.Items ) { if ( item is JailHammer ) // Jailed while jailed gets them another load of rock to mine { if ( 0 > ( ((JailHammer)item).UsesRemaining += JailConfig.UsesRemaining ) ) // handle integer overflow ((JailHammer)item).UsesRemaining *= -1; Banker.Withdraw( player, JailConfig.FineAmount ); player.SendMessage( "Your remaining sentence has been increased!" ); player.SendMessage( "You have been fined {0} gold and are being kicked!", JailConfig.FineAmount ); // This gives a nice little delay for the message to be read s_KickProcessingQueue.Enqueue( player ); player.Squelched = true; Server.Timer.DelayCall( TimeSpan.FromSeconds( kSecondsTillKick ), new Server.TimerCallback( KickPlayerInQueue ) ); return; } } // If mounted, dismount them and stable mount if ( player.Mounted ) { if ( player.Mount is EtherealMount ) { EtherealMount pet = player.Mount as EtherealMount; pet.Internalize(); pet.Rider = null; } else if ( player.Mount is BaseMount ) { BaseMount pet = player.Mount as BaseMount; pet.Rider = null; Jail.StablePet( player, pet ); } } // Stable all other pets foreach ( Mobile mobile in World.Mobiles.Values ) { if ( mobile is BaseCreature ) { BaseCreature bc = mobile as BaseCreature; if ( null != bc && (bc.Controlled && bc.ControlMaster == player) || (bc.Summoned && bc.SummonMaster == player) ) Jail.StablePet( player, bc ); } } // Move all items to a bag and move that to the bank Container backpack = player.Backpack; Backpack bag = new Backpack(); bag.Hue = JailConfig.RobeHue; ArrayList equipedItems = new ArrayList( player.Items ); foreach ( Item item in equipedItems ) { if ( item.Layer == Layer.Bank || item.Layer == Layer.Backpack || item.Layer == Layer.Hair || item.Layer == Layer.FacialHair || item is DeathShroud ) continue; bag.DropItem( item ); } ArrayList backpackItems = new ArrayList( backpack.Items ); foreach ( Item item in backpackItems ) { if ( item is JailRock ) item.Delete(); else if ( item.Movable ) // Non movable pack items must remain (i.e. skill balls) bag.DropItem( item ); } // Remember their access level and make them a player JailHammer hammer = new JailHammer(); hammer.PlayerAccessLevel = player.AccessLevel; player.AccessLevel = AccessLevel.Player; // Bank the bag of belongings, give them a hammer and welcome them player.BankBox.DropItem( bag ); player.AddItem( hammer ); // Explosively move player to jail player.BoltEffect( 0 ); player.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Waist ); player.PlaySound( 0x307 ); player.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot ); player.PlaySound( 0x225 ); // This gives a nice little delay for the effect to complete s_JailProcessingQueue.Enqueue( player ); Server.Timer.DelayCall( TimeSpan.FromSeconds( kSecondsTillJail ), new Server.TimerCallback( JailPlayerInQueue ) ); }
public bool ApplyNightSight(PlayerMobile Wearer) { Spell spell = new NightSightSpell(Wearer,null); if( Wearer == null ) return false; if (Wearer.Region.OnBeginSpellCast( Wearer, spell ) == false) { Wearer.SendMessage("The magic normally within this object seems absent."); return false; } //Pix: this was borrowed from the NightSight spell... else if( Wearer.BeginAction( typeof( LightCycle ) ) ) { new LightCycle.NightSightTimer( Wearer ).Start(); int level = 25; Wearer.LightLevel = level; Wearer.FixedParticles( 0x376A, 9, 32, 5007, EffectLayer.Waist ); Wearer.PlaySound( 0x1E3 ); return true; } return false; }
public bool ApplyMagicReflectEffect(PlayerMobile Wearer) { if (Wearer == null) return false; Spell spell = new MagicReflectSpell(Wearer,null); if ( Wearer.MagicDamageAbsorb > 0 ) { Wearer.SendMessage("The magic of this item is already protecting you."); return false; } else if (Wearer.Region.OnBeginSpellCast( Wearer, spell ) == false) { Wearer.SendMessage("The magic normally within this object seems absent."); return false; } else if ( !Wearer.CanBeginAction( typeof( DefensiveSpell ) ) ) { Wearer.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time. return false; } else { if ( Wearer.BeginAction( typeof( DefensiveSpell ) ) ) { int value = (int)((Utility.Random(51) + 50) + (Utility.Random(51) + 50)); // Random value of up to 100 for magery and up to 100 for scribing - lowest though is 50 magery/50 scribing equivalent strength value = (int)(8 + (value/200)*7.0);//absorb from 8 to 15 "circles" Wearer.MagicDamageAbsorb = value; Wearer.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist ); Wearer.PlaySound( 0x1E9 ); Wearer.SendMessage("You feel the magic of the item envelope you."); return true; } else { Wearer.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time. return false; } } }
public SummonTimer(BellOfSummoning b, PlayerMobile p) : base(TimeSpan.FromSeconds(b.DelaySeconds)) { m_Bell = b; m_Player = p; p.Frozen = true; p.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.RightHand); p.PlaySound(b.Sound); p.NonlocalOverheadMessage(Server.Network.MessageType.Emote, 123, true, "*begins to ring a magical bell*"); p.LocalOverheadMessage(Server.Network.MessageType.Emote, 123, true, "*You begin to ring the magical bell*"); Priority = TimerPriority.OneSecond; }
public void IncogMode(PlayerMobile pm) { string originalName = pm.Name; pm.HueMod = pm.Race.RandomSkinHue(); pm.NameMod = pm.Female ? NameList.RandomName("female") : NameList.RandomName("male"); LoggingCustom.LogDisguise(DateTime.Now + "\t" + originalName + "\t" + pm.NameMod); if (pm.Race != null) { pm.SetHairMods(pm.Race.RandomHair(pm.Female), pm.Race.RandomFacialHair(pm.Female)); pm.HairHue = pm.Race.RandomHairHue(); pm.FacialHairHue = pm.Race.RandomHairHue(); } pm.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head); pm.PlaySound(0x3BD); BaseArmor.ValidateMobile(pm); BaseClothing.ValidateMobile(pm); //BuffInfo.AddBuff( Caster, new BuffInfo( BuffIcon.Incognito, 1075819, length, Caster ) ); }
public void DoExplode(PlayerMobile pm) { pm.Emote("*The gaze of the asylum guardian melts the flesh from your bones and causes your organs to explode.*"); int range = Utility.RandomMinMax(5, 7); int zOffset = pm.Mounted ? 20 : 10; Point3D src = pm.Location.Clone3D(0, 0, zOffset); Point3D[] points = src.GetAllPointsInRange(pm.Map, 0, range); Effects.PlaySound(pm.Location, pm.Map, 0x19C); pm.FixedParticles(0x36BD, 20, 10, 5044, 137, 0, EffectLayer.Head); pm.PlaySound(0x307); Timer.DelayCall( TimeSpan.FromMilliseconds(100), () => { int i = 0; int place = 0; int[] BodyPartArray = {7584, 7583, 7586, 7585, 7588, 7587}; foreach (Point3D trg in points) { i++; int bodypartID = Utility.RandomMinMax(4650, 4655); if (Utility.RandomDouble() <= 0.1 && place < BodyPartArray.Count()) { bodypartID = BodyPartArray[place]; place++; } new MovingEffectInfo(src, trg.Clone3D(0, 0, 2), pm.Map, bodypartID).MovingImpact( info => { Item bodypart; if (bodypartID <= 4655 && bodypartID >= 4650) { bodypart = new Blood { ItemID = bodypartID }; bodypart.MoveToWorld(info.Target.Location, info.Map); } switch (bodypartID) { case 7584: bodypart = new Head(); bodypart.MoveToWorld(info.Target.Location, info.Map); break; case 7583: bodypart = new Torso(); bodypart.MoveToWorld(info.Target.Location, info.Map); break; case 7586: bodypart = new RightArm(); bodypart.MoveToWorld(info.Target.Location, info.Map); break; case 7585: bodypart = new LeftArm(); bodypart.MoveToWorld(info.Target.Location, info.Map); break; case 7588: bodypart = new RightLeg(); bodypart.MoveToWorld(info.Target.Location, info.Map); break; case 7587: bodypart = new LeftLeg(); bodypart.MoveToWorld(info.Target.Location, info.Map); break; } Effects.PlaySound(info.Target, info.Map, 0x028); }); } }); pm.Damage(pm.Hits + 5); Timer.DelayCall( TimeSpan.FromMilliseconds(100), () => { var corpse = pm.Corpse as Corpse; if (corpse != null && !corpse.Deleted) { corpse.TurnToBones(); } }); }