public static void ApplyProtectionEffect(Mobile target, Mobile caster) { if (caster != null && !caster.CanBeBeneficial(target, false)) return; //Stop the old protection timer, if we have any. StopTimer(target); // Temporary "easy way out" fix for stacking protection on server restarts. // I'll get to fixing this properly soon. I know the problems it causes // but this can't be abused as much in the meantime - Malik //if (target is PlayerMobile) // StopTimer(target); target.VirtualArmor += ArmorModValue; Timer protectionTimer = new InternalTimer(target); protectionTimer.Start(); //Register it with the list m_Timers.Add(target, protectionTimer); target.FixedParticles(0x373A, 10, 15, 5016, EffectLayer.Waist); target.PlaySound(493); }
public void Target( Mobile m ) { if ( !Caster.CanSee( m ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( CheckBSequence( m ) ) { SpellHelper.Turn( Caster, m ); Effects.SendLocationParticles( EffectItem.Create( new Point3D( m.X, m.Y, m.Z + 16 ), Caster.Map, EffectItem.DefaultDuration ), 0x376A, 10, 15, 5045 ); m.PlaySound( 0x3C4 ); m.Hidden = true; RemoveTimer( m ); TimeSpan duration = TimeSpan.FromSeconds( Caster.Skills[SkillName.Magery].Value * 1.2 ); // 120% of magery Timer t = new InternalTimer( m, duration ); m_Table[m] = t; t.Start(); } FinishSequence(); }
public static void DoSleep( Mobile from, Mobile m ) { double alchemy = from.Skills.Alchemy.Value; double resist = m.Skills.MagicResist.Value; double enhancePotions = GetEnhancePotions( from ); int seconds = (int) ( alchemy + ( enhancePotions / 2 ) - ( resist + 40 ) ) / 10; if ( seconds > 0 ) { BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.Paralyze, 1095150, 1095151, TimeSpan.FromSeconds( seconds ), m, seconds.ToString() ) ); Timer t = new InternalTimer( m, DateTime.Now + TimeSpan.FromSeconds( seconds ) ); t.Start(); m_SleptTable[m] = t; m.ForcedWalk = true; } else { from.SendLocalizedMessage( 1095149 ); // Your target resists the exploding tar potion. m.SendLocalizedMessage( 1095148 ); // You resist the exploding tar potion. } }
public SGEFieldEast(Point3D from, Map map) : base(from, map) { Map = map; InternalTimer t = new InternalTimer(this); t.Start(); }
public void Target( Mobile m ) { if ( !Caster.CanSee( m ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( CheckBSequence( m ) ) { //Stop the old reflect timer, if we have any. StopTimer(m); m.MagicDamageAbsorb = 15; //to make sure it will reflect any spell. Timer protectionTimer = new InternalTimer(m); protectionTimer.Start(); //Register it with the list m_Timers.Add(m, protectionTimer); m.FixedParticles(0x373A, 10, 15, 5016, EffectLayer.Waist); m.PlaySound( Sound ); } FinishSequence(); }
public ChickenEggLayer() : base( AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4 ) { Name = "egg laying chicken"; Body = 0xD0; BaseSoundID = 0x6E; SetStr( 5 ); SetDex( 15 ); SetInt( 5 ); SetHits( 3 ); SetMana( 0 ); SetDamage( 1 ); SetDamageType( ResistanceType.Physical, 100 ); SetResistance( ResistanceType.Physical, 1, 5 ); SetSkill( SkillName.MagicResist, 4.0 ); SetSkill( SkillName.Tactics, 5.0 ); SetSkill( SkillName.Wrestling, 5.0 ); Fame = 150; Karma = 0; VirtualArmor = 2; Tamable = true; ControlSlots = 1; MinTameSkill = -0.9; Timer PondTimer = new InternalTimer(this); PondTimer.Start(); }
public static void BeginGuardOff( Mobile m, Mobile caster ) { if ( m_Table.ContainsKey( m.Serial ) ) { Timer timer = m_Table[m.Serial]; timer.Stop(); m_Table.Remove( m.Serial ); } List<ResistanceMod> mods = new List<ResistanceMod>(); mods.Add( new ResistanceMod( ResistanceType.Physical, -(m.PhysicalResistance / 2) ) ); mods.Add( new ResistanceMod( ResistanceType.Fire, -(m.FireResistance / 2) ) ); mods.Add( new ResistanceMod( ResistanceType.Cold, -(m.ColdResistance / 2) ) ); mods.Add( new ResistanceMod( ResistanceType.Poison, -(m.PoisonResistance / 2) ) ); mods.Add( new ResistanceMod( ResistanceType.Energy, -(m.EnergyResistance / 2) ) ); Double duration = ( BlueSpell.ScaleBySkill( caster, SkillName.Forensics ) * 3.0 ); InternalTimer timertostart = new InternalTimer( m, mods, duration ); timertostart.Start(); m_Table.Add( m.Serial, timertostart ); for ( int i = 0; i < mods.Count; ++i ) m.AddResistanceMod( mods[i] ); m.SendMessage( "Your guard has been lowered" ); }
public void Target( Mobile m ) { if ( !Caster.CanSee( m ) ) { Caster.SendAsciiMessage( "Target can not be seen." ); } else if ( CheckBSequence( m ) ) { SpellHelper.Turn( Caster, m ); Effects.SendLocationParticles( EffectItem.Create( new Point3D( m.X, m.Y, m.Z + 16 ), Caster.Map, EffectItem.DefaultDuration ), 0x376A, 10, 15, 5045 ); m.PlaySound( 0x203 ); m.Hidden = true; RemoveTimer( m ); TimeSpan duration = TimeSpan.FromSeconds( ((6 * Caster.Skills.Magery.Fixed) / 50) + 1 ); Timer t = new InternalTimer( m, duration ); m_Table[m] = t; t.Start(); } FinishSequence(); }
public override void Drink( Mobile m ) { TimeSpan duration = TimeSpan.FromMinutes( 1 ); if (m.Hidden == false) { m.FixedParticles( 0x376A, 9, 32, 5007, EffectLayer.Waist ); m.PlaySound( 0x3C4 ); BuffInfo.RemoveBuff( m, BuffIcon.HidingAndOrStealth ); BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.Invisibility, 1075825 ) ); //Invisibility/Invisible BasePotion.PlayDrinkEffect( m ); this.Consume(); m.Hidden = true; RemoveTimer( m ); Timer t = new InternalTimer( m, duration ); m_Table[m] = t; t.Start(); } else { m.SendMessage( "An invisibility potion is already taking effect on your person." ); //An invisibility potion is already taking effect on your person. } }
public void Target( Mobile m ) { if ( !Caster.CanSee( m ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( m is Mobiles.BaseVendor || m is Mobiles.PlayerVendor || m is Mobiles.PlayerBarkeeper || m.AccessLevel > Caster.AccessLevel ) { Caster.SendLocalizedMessage( 501857 ); // This spell won't work on that! } else if ( CheckBSequence( m ) ) { SpellHelper.Turn( Caster, m ); Effects.SendLocationParticles( EffectItem.Create( new Point3D( m.X, m.Y, m.Z + 16 ), Caster.Map, EffectItem.DefaultDuration ), 0x376A, 10, 15, 5045 ); m.PlaySound( 0x3C4 ); m.Hidden = true; BuffInfo.RemoveBuff( m, BuffIcon.HidingAndOrStealth ); BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.Invisibility, 1075825 ) ); //Invisibility/Invisible RemoveTimer( m ); TimeSpan duration = TimeSpan.FromSeconds( ((6 * Caster.Skills.Magery.Fixed) / 50) + 1 ); Timer t = new InternalTimer( m, duration ); m_Table[m] = t; t.Start(); } FinishSequence(); }
public WildHorse( string name ) : base( name, 0xE2, 0x3EA0, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4 ) { int random = Utility.Random( 4 ); Body = m_IDs[random * 2]; ItemID = m_IDs[random * 2 + 1]; BaseSoundID = 0xA8; SetStr( 22, 98 ); SetDex( 56, 75 ); SetInt( 6, 10 ); SetHits( 28, 45 ); SetMana( 0 ); SetDamage( 3, 4 ); SetDamageType( ResistanceType.Physical, 100 ); SetResistance( ResistanceType.Physical, 15, 20 ); SetSkill( SkillName.MagicResist, 25.1, 30.0 ); SetSkill( SkillName.Tactics, 29.3, 44.0 ); SetSkill( SkillName.Wrestling, 29.3, 44.0 ); Fame = 300; Karma = 300; Tamable = true; ControlSlots = 1; MinTameSkill = 29.1; Timer PondTimer = new InternalTimer(this); PondTimer.Start(); }
public static void AddTimer( Mobile m, TimeSpan duration ) { Timer t = new InternalTimer( m, duration ); m_Table[m] = t; t.Start(); }
public GuardianTreasureChest( int itemID ) : base(itemID) { for ( int i = 0; i < 5; i++ ) Fill(); m_Timer = new InternalTimer( this ); m_Timer.Start(); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadEncodedInt(); m_Timer = new InternalTimer( this, TimeSpan.Zero ); m_Timer.Start(); }
public static void StartTimer( Mobile from, Mobile to ) { if ( !m_Table.Contains( to ) ) { Timer t = new InternalTimer( to, from ); t.Start(); m_Table[to] = t; } }
public void DoTimer(Mobile from, SiegeCatapult weapon, IEntity target, Point3D targetloc, Item projectile, TimeSpan damagedelay, int step) { if (m_Timer != null) m_Timer.Stop(); if (step > 4 || step < 0) return; m_Timer = new InternalTimer(from, weapon, target, targetloc, projectile, damagedelay, step); m_Timer.Start(); }
public FactionObelisk(int itemid) : base(itemid) { Movable = false; timer = new InternalTimer(this); timer.Start(); FactionObelisks.Register(this); ObeliskUsers = new Dictionary<Account, DateTime>(); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); /*int version = */ reader.ReadInt(); m_Timer = new InternalTimer( this ); m_Timer.Start(); }
public void GiveToothAche(Mobile from, int seq) { if (toothache != null) toothache.Stop(); from.SendLocalizedMessage(1077388 + seq); if (seq < 5) { toothache = new InternalTimer(this, from, seq, TimeSpan.FromSeconds(15)); toothache.Start(); } }
public PersonalAttendant( string title ) : base( AIType.AI_Vendor, FightMode.None, 22, 1, 0.15, 0.2 ) { Title = title; Blessed = true; ControlSlots = 0; InitBody(); InitOutfit(); m_Timer = new InternalTimer( this, TimeSpan.FromSeconds( 2 ) ); m_Timer.Start(); }
public SR_RuneGate( Point3D target, Map map ) : base( target, map ) { Map = map; if ( ShowFeluccaWarning && map == Map.Felucca ) ItemID = 0xDDA; Dispellable = false; InternalTimer t = new InternalTimer( this ); t.Start(); }
public static void BeginTalon( Mobile m, Mobile from, int damage ) { Timer t = (Timer) m_Table[m]; if ( t != null ) t.Stop(); t = new InternalTimer( from, m, damage ); m_Table[m] = t; t.Start(); }
public static void BeginBleed( Mobile m, Mobile from ) { Timer t = (Timer)m_Table[m]; if ( t != null ) t.Stop(); t = new InternalTimer( from, m ); m_Table[m] = t; t.Start(); }
public static void BeginImmunity( Mobile m, TimeSpan duration ) { Timer t = (Timer)m_Table[m]; if ( t != null ) t.Stop(); t = new InternalTimer( m, duration ); m_Table[m] = t; t.Start(); }
public static void BeginConfidence( Mobile m ) { Timer t = (Timer)m_Table[m]; if ( t != null ) t.Stop(); t = new InternalTimer( m ); m_Table[m] = t; t.Start(); }
public static void StartCountering( Mobile m ) { Timer t = (Timer)m_Table[m]; if ( t != null ) t.Stop(); t = new InternalTimer( m ); m_Table[m] = t; t.Start(); }
public static void BeginEvasion(Mobile m) { Timer t = (Timer)m_Table[m]; if (t != null) t.Stop(); t = new InternalTimer(m, GetEvadeDuration(m)); m_Table[m] = t; t.Start(); }
public MushroomGateCircle(Point3D target, Map map, int item) { m_ItemID=item; if ( ShowFeluccaWarning && map == Map.Felucca ) { Hue = 1175; ItemID=m_ItemID; } InternalTimer t = new InternalTimer( this ); t.Start(); }
public static void BeginWound( Mobile m, TimeSpan duration ) { Timer t = (Timer)m_Table[m]; if ( t != null ) t.Stop(); t = new InternalTimer( m, duration ); m_Table[m] = t; t.Start(); m.YellowHealthbar = true; }
public FinalStone() : base() { ItemID = 5154; Name = "Final Stone(Timer)"; Movable = false; Visible = false; Weight = 0; StopTimer(this); Timer t = new InternalTimer(this); m_Timers[this] = t; t.Start(); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Item.Deleted) { return; } if (targeted is BowlFlour) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a cake mix"); if (m_Item.Parent == null) { new CakeMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new CakeMix()); } m_Item.Consume(); ((BowlFlour)targeted).Use(from); } /*else if ( targeted is SackFlourOpen ) * { * if(!((Item)targeted).Movable) return; * from.SendMessage("You made a cake mix"); * if( m_Item.Parent == null ) * new CakeMix().MoveToWorld( m_Item.Location, m_Item.Map ); * else * from.AddToBackpack( new CakeMix() ); * m_Item.Consume(); * ((SackFlourOpen)targeted).Use( from ); * }*/ else if (targeted is JarHoney) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a cookie mix"); if (m_Item.Parent == null) { new CookieMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new CookieMix()); } m_Item.Consume(); ((JarHoney)targeted).Consume(); } else if (IsHeatSource(targeted)) { if (from.BeginAction(typeof(Item))) { from.PlaySound(0x225); m_Item.Consume(); InternalTimer t = new InternalTimer(from, targeted as IPoint3D, from.Map, m_Item.MinSkill, m_Item.MaxSkill, m_Item.CookedFood /*, m_Item.BurnedFood*/); t.Start(); } else { from.SendLocalizedMessage(500119); // You must wait to perform another action } } }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!Validate(attacker)) //Mana check after check that there are targets { return; } ClearCurrentAbility(attacker); Map map = attacker.Map; if (map == null) { return; } BaseWeapon weapon = attacker.Weapon as BaseWeapon; if (weapon == null) { return; } ArrayList list = new ArrayList(); foreach (Mobile m in attacker.GetMobilesInRange(1)) { list.Add(m); } ArrayList targets = new ArrayList(); for (int i = 0; i < list.Count; ++i) { Mobile m = (Mobile)list[i]; if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m)) { if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m)) { continue; } if (!attacker.InRange(m, weapon.MaxRange)) { continue; } if (attacker.InLOS(m)) { targets.Add(m); } } } if (targets.Count > 0) { if (!CheckMana(attacker, true)) { return; } attacker.FixedEffect(0x3728, 10, 15); attacker.PlaySound(0x2A1); // 5-15 damage int amount = (int)(10.0 * ((Math.Max(attacker.Skills[SkillName.Bushido].Value, attacker.Skills[SkillName.Ninjitsu].Value) - 50.0) / 70.0 + 5)); for (int i = 0; i < targets.Count; ++i) { Mobile m = (Mobile)targets[i]; attacker.DoHarmful(m, true); Timer t = Registry[m] as Timer; if (t != null) { t.Stop(); Registry.Remove(m); } t = new InternalTimer(attacker, m, amount); t.Start(); Registry.Add(m, t); } Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(RepeatEffect), attacker); } }
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; if (p is Mobile) { to = (Mobile)p; } else { to = new DummyEntity(Serial.Zero, new Point3D(p), map); } Effects.SendMovingEffect(from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0); Effects.SendLocationParticles(EffectItem.Create(new Point3D(p.X, p.Y, p.Z), from.Map, EffectItem.DefaultDuration), 0x376A, 9, 4, 0, 0, 0x13AE, 0); int length = 0; switch (m_Potion.AreaSize) { case 1: length = 3; break; case 2: length = 15; break; case 3: length = 31; break; case 4: length = 55; break; case 5: length = 83; break; case 6: length = 123; break; case 7: length = 163; break; } for (int i = 0; i <= length; ++i) { OffsetEntry oe = Offsets[i] as OffsetEntry; Effects.SendLocationParticles(EffectItem.Create(new Point3D(p.X + oe.X, p.Y + oe.Y, p.Z), from.Map, EffectItem.DefaultDuration), 0x376A, 9, 4, 0, 0, 0x13AE, 0); } var eable = from.Map.GetMobilesInRange(new Point3D(p.X, p.Y, p.Z), m_Potion.AreaSize); foreach (object obj in eable) { if (obj is BaseCreature) { BaseCreature m = obj as BaseCreature; if (m != null && !m.Controlled) { m.Frozen = true; InternalTimer timer = new InternalTimer(new Point3D(p.X, p.Y, p.Z), m_Potion.AreaSize, from); timer.Start(); } } } m_Potion.SetNextDrinkTime(from); m_Potion.Consume(); }
public void GiveBonus(int chant, Mobile from) { if (VirtueEffect == chant) { from.SendLocalizedMessage(1079544, String.Format("{0}", m_ShrineWords[chant])); // You already feel ~1_VIRTUE~ from your earlier contemplation of the virtues. } TimeSpan delay = m_LastUse - DateTime.UtcNow; if (delay < TimeSpan.Zero) { delay = TimeSpan.Zero; } if (delay > TimeSpan.Zero) { int seconds = (int)delay.TotalSeconds; int minutes = 0; int hours = 0; if (seconds >= 60) { minutes = (seconds + 59) / 60; } if (minutes >= 60) { hours = (seconds + 3599) / 3600; } if (hours > 1) { from.SendLocalizedMessage(1079566, String.Format("{0}", hours)); // You feel as if you should contemplate what you've learned for another ~1_TIME~ hours. } else if (hours == 1) { from.SendLocalizedMessage(1079565); // You feel as if you should contemplate what you've learned for another hour or so. } else if (minutes > 0) { from.SendLocalizedMessage(1079568, String.Format("{0}", minutes)); // You feel as if you should contemplate what you've learned for another ~1_TIME~ minutes. } else if (seconds > 0) { from.SendLocalizedMessage(1079567, String.Format("{0}", seconds)); // You feel almost ready to learn more about the virtue again. } return; } double chance = Utility.RandomDouble(); switch (chant) { case 0: //Compassion { Attributes.RegenHits = 2; break; } case 1: //Honesty { Attributes.RegenMana = 2; break; } case 2: //Honor { Attributes.RegenStam = (chance >= 0.75) ? 2 : 1; Attributes.RegenMana = (chance <= 0.25) ? 2 : 1; break; } case 3: //Humility { if (chance >= 0.66) { Attributes.RegenHits = 3; } else if (chance >= 0.33) { Attributes.RegenStam = 3; } else { Attributes.RegenMana = 3; } break; } case 4: //Justice { Attributes.RegenHits = (chance >= 0.75) ? 2 : 1; Attributes.RegenMana = (chance <= 0.25) ? 2 : 1; break; } case 5: //Sacrifice { Attributes.RegenHits = (chance >= 0.75) ? 2 : 1; Attributes.RegenStam = (chance <= 0.25) ? 2 : 1; break; } case 6: //Spirituality { Attributes.RegenHits = (chance >= 0.25) ? 2 : 1; chance = Utility.RandomDouble(); Attributes.RegenStam = (chance >= 0.25) ? 2 : 1; chance = Utility.RandomDouble(); Attributes.RegenMana = (chance >= 0.25) ? 2 : 1; break; } case 7: //Valor { Attributes.RegenStam = 2; break; } } if (IsUseful) { Attributes.RegenHits *= 3; Attributes.RegenStam *= 3; Attributes.RegenMana *= 3; } m_LastUse = DateTime.UtcNow + TimeSpan.FromMinutes(61); VirtueEffect = chant; Timer timer = new InternalTimer(this); timer.Start(); m_Timer = timer; from.SendLocalizedMessage(1079546, String.Format("{0}", m_ShrineWords[chant])); // Contemplating at the shrine has left you feeling more ~1_VIRTUE~. }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 8: { m_MinimumDuelers = (int)reader.ReadInt(); m_LastReset = (DateTime)reader.ReadDateTime(); goto case 7; } case 7: { m_TimerEnabled = (bool)reader.ReadBool(); goto case 6; } case 6: { m_CoinsPerRound = (int)reader.ReadInt(); m_CoinsWinner = (int)reader.ReadInt(); goto case 5; } case 5: { m_BroadcastHue = (int)reader.ReadInt(); goto case 4; } case 4: { m_WallHue = (int)reader.ReadInt(); m_WallID = (int)reader.ReadInt(); goto case 3; } case 3: { m_WallMidPoint = (Point3D)reader.ReadPoint3D(); m_WallExtendWidth = (int)reader.ReadInt();; m_WallNorthToSouth = (bool)reader.ReadBool(); goto case 2; } case 2: { m_CurrentRound = (int)reader.ReadInt(); m_TotalParticipants = (int)reader.ReadInt(); goto case 1; } case 1: { m_Running = (bool)reader.ReadBool(); m_AcceptingPlayers = (bool)reader.ReadBool(); m_MapLocation = (Map)reader.ReadMap(); goto case 0; } case 0: { m_EventRate = (TimeSpan)reader.ReadTimeSpan(); m_StartLocation = (Point3D)reader.ReadPoint3D(); m_LostLocation = (Point3D)reader.ReadPoint3D(); m_DuelLocation1 = (Point3D)reader.ReadPoint3D(); m_DuelLocation2 = (Point3D)reader.ReadPoint3D(); m_LastEvent = (DateTime)reader.ReadDateTime(); m_DuelingArea = (Rectangle2D)reader.ReadRect2D(); m_StageingArea = (Rectangle2D)reader.ReadRect2D(); m_ViewingArea = (Rectangle2D)reader.ReadRect2D(); break; } } if (version == 7) { m_LastReset = DateTime.UtcNow; } if (version == 5) { m_CoinsPerRound = 2; m_CoinsWinner = 10; } if (version == 4) { m_BroadcastHue = 269; } if (version == 3) { m_WallHue = 0; m_WallID = 0x0081; } if (m_DuelList == null) { m_DuelList = new List <Mobile>(); } if (m_CurrentDuelers == null) { m_CurrentDuelers = new List <Mobile>(); } if (m_WallList == null) { m_WallList = new List <Item>(); } if (m_BroadcastList == null) { m_BroadcastList = new List <Mobile>(); } m_CountDown = 0; UpdateRegions(false); m_RestartTimer = new InternalTimer(this, TimeSpan.FromSeconds(1.0)); if (m_TimerEnabled) { m_RestartTimer.Start(); } }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!Validate(attacker)) //Mana check after check that there are targets { return; } ClearCurrentAbility(attacker); Map map = attacker.Map; if (map == null) { return; } BaseWeapon weapon = attacker.Weapon as BaseWeapon; if (weapon == null) { return; } List <Mobile> targets = new List <Mobile>(); IPooledEnumerable eable = attacker.GetMobilesInRange(2); foreach (Mobile m in eable) { if (m != attacker && SpellHelper.ValidIndirectTarget(attacker, m)) { if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m)) { continue; } if (!attacker.InRange(m, weapon.MaxRange)) { continue; } if (attacker.InLOS(m)) { targets.Add(m); } } } eable.Free(); if (targets.Count > 0) { if (!CheckMana(attacker, true)) { return; } attacker.FixedEffect(0x3728, 10, 15); attacker.PlaySound(0x2A1); for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; attacker.DoHarmful(m, true); if (m_Registry.ContainsKey(m) && m_Registry[m] != null) { m_Registry[m].Stop(); } Timer t = new InternalTimer(attacker, m); t.Start(); m_Registry[m] = t; m.Send(SpeedControl.WalkSpeed); } } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Item.Deleted) { return; } if (IsHeatSource(targeted)) { if (from.BeginAction(typeof(Item))) { from.PlaySound(0x225); m_Item.Consume(); InternalTimer t = new InternalTimer(from, targeted as IPoint3D, from.Map, m_Item.MinSkill, m_Item.MaxSkill, m_Item.CookedFood); t.Start(); } else { from.SendLocalizedMessage(500119); // You must wait to perform another action } } else if (targeted is Banana || targeted is Bananas) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a banana cake mix"); if (m_Item.Parent == null) { new BananaCakeMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new BananaCakeMix()); } m_Item.Consume(); ((Item)targeted).Consume(); } else if (targeted is Cantaloupe) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a cantaloupe cake mix"); if (m_Item.Parent == null) { new CantaloupeCakeMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new CantaloupeCakeMix()); } m_Item.Consume(); ((Item)targeted).Consume(); } else if (targeted is Carrot) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a carrot cake mix"); if (m_Item.Parent == null) { new CarrotCakeMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new CarrotCakeMix()); } m_Item.Consume(); ((Item)targeted).Consume(); } else if (targeted is Coconut || targeted is SplitCoconut) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a coconut cake mix"); if (m_Item.Parent == null) { new CoconutCakeMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new CoconutCakeMix()); } m_Item.Consume(); ((Item)targeted).Consume(); } else if (targeted is Grapes) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a grape cake mix"); if (m_Item.Parent == null) { new GrapeCakeMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new GrapeCakeMix()); } m_Item.Consume(); ((Item)targeted).Consume(); } else if (targeted is HoneydewMelon) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a honeydew melon cake mix"); if (m_Item.Parent == null) { new HoneydewMelonCakeMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new HoneydewMelonCakeMix()); } m_Item.Consume(); ((Item)targeted).Consume(); } else if (targeted is Lemon) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a lemon cake mix"); if (m_Item.Parent == null) { new LemonCakeMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new LemonCakeMix()); } m_Item.Consume(); ((Item)targeted).Consume(); } else if (targeted is Lime) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a key lime cake mix"); if (m_Item.Parent == null) { new KeyLimeCakeMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new KeyLimeCakeMix()); } m_Item.Consume(); ((Item)targeted).Consume(); } else if (targeted is Peach) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a peach cake mix"); if (m_Item.Parent == null) { new PeachCakeMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new PeachCakeMix()); } m_Item.Consume(); ((Item)targeted).Consume(); } else if (targeted is Pumpkin) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a pumpkin cake mix"); if (m_Item.Parent == null) { new PumpkinCakeMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new PumpkinCakeMix()); } m_Item.Consume(); ((Item)targeted).Consume(); } else if (targeted is Watermelon) { if (!((Item)targeted).Movable) { return; } from.SendMessage("You made a watermelon cake mix"); if (m_Item.Parent == null) { new WatermelonCakeMix().MoveToWorld(m_Item.Location, m_Item.Map); } else { from.AddToBackpack(new WatermelonCakeMix()); } m_Item.Consume(); ((Item)targeted).Consume(); } }
public InternalItem() { InternalTimer t = new InternalTimer(this); t.Start(); }
public AwesomeDisturbingPortraitComponent() : base(0x2A5D) { m_Timer = new InternalTimer(this, TimeSpan.FromSeconds(1)); m_Timer.Start(); }