public override void OnCast() { TransformationSpellHelper.OnCast(Caster, this); FinishSequence(); }
protected override void OnTick() { bool usingPetals = OrangePetals.UnderEffect(m_Mobile); if (Core.SA && usingPetals && m_Poison.RealLevel >= 3 && 0.25 > Utility.RandomDouble()) { OrangePetals.RemoveContext(m_Mobile); usingPetals = false; m_Mobile.LocalOverheadMessage(MessageType.Regular, 0x3F, 1053093); // * The strength of the poison overcomes your resistance! * } if ((Core.AOS && m_Poison.RealLevel < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) || (m_Poison.RealLevel <= 3 && usingPetals) || AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn))) { if (m_Mobile.CurePoison(m_Mobile)) { m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, 1053092); // * You feel yourself resisting the effects of the poison * m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, 1114442, m_Mobile.Name); // * ~1_NAME~ seems resistant to the poison * Stop(); return; } } if (m_Index++ == m_Poison.m_Count) { m_Mobile.SendLocalizedMessage(502136); // The poison seems to have worn off. m_Mobile.Poison = null; if (m_Mobile is PlayerMobile) { BuffInfo.RemoveBuff((PlayerMobile)m_Mobile, BuffIcon.Poison); } Stop(); return; } int damage; if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool()) { damage = m_LastDamage; } else { damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar); if (damage < m_Poison.m_Minimum) { damage = m_Poison.m_Minimum; } else if (damage > m_Poison.m_Maximum) { damage = m_Poison.m_Maximum; } m_LastDamage = damage; } if (m_From != null) { if (m_From is BaseCreature && ((BaseCreature)m_From).RecentSetControl && ((BaseCreature)m_From).GetMaster() == m_Mobile) { m_From = null; } else { m_From.DoHarmful(m_Mobile, true); } } IHonorTarget honorTarget = m_Mobile as IHonorTarget; if (honorTarget != null && honorTarget.ReceivedHonorContext != null) { honorTarget.ReceivedHonorContext.OnTargetPoisoned(); } #region Mondain's Legacy if (Core.ML) { if (m_From != null && m_Mobile != m_From && !m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 10 && m_Poison.m_Level <= 13) // darkglow { m_From.SendLocalizedMessage(1072850); // Darkglow poison increases your damage! damage = (int)Math.Floor(damage * 1.1); } if (m_From != null && m_Mobile != m_From && m_From.InRange(m_Mobile.Location, 1) && m_Poison.m_Level >= 14 && m_Poison.m_Level <= 18) // parasitic { int toHeal = Math.Min(m_From.HitsMax - m_From.Hits, damage); if (toHeal > 0) { m_From.SendLocalizedMessage(1060203, toHeal.ToString()); // You have had ~1_HEALED_AMOUNT~ hit points of damage healed. m_From.Heal(toHeal, m_Mobile, false); } } } #endregion AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0); if ((m_Index % m_Poison.m_MessageInterval) == 0) { m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison); } }
public bool CanDispel(Mobile m) { return((TransformationSpellHelper.GetContext(m) != null) || !m.CanBeginAction(typeof(PolymorphSpell)) || AnimalForm.UnderTransformation(m) || TransformationSpellHelper.UnderTransformation(m) || (m is BaseCreature && ((BaseCreature)m).Summoned && m_Mobile.CanBeHarmful(m, false) && !((BaseCreature)m).IsAnimatedDead)); }
protected override void OnTarget(object o) { IDamageable m = o as IDamageable; if (m != null) { if (CheckHSequence(m)) { IDamageable target = m; IDamageable source = Caster; SpellHelper.Turn(Caster, target); if (SpellHelper.CheckReflect(0, ref source, ref target)) { Server.Timer.DelayCall(TimeSpan.FromSeconds(.5), () => { source.MovingParticles(target, 0x9BB5, 7, 0, false, true, 9502, 4019, 0x160); source.PlaySound(0x5CE); }); } double skill = (Caster.Skills[CastSkill].Value + GetWeaponSkill() + (GetMasteryLevel() * 40)) / 3; double damage = skill + (double)Caster.Karma / 1000; damage += Utility.RandomMinMax(0, 5); if (m is BaseCreature && IsUndead((BaseCreature)m)) { damage *= 1.5; } else if (m is PlayerMobile) { damage = Math.Min(35, damage); } Caster.MovingParticles(m, 0x9BB5, 7, 0, false, true, 9502, 4019, 0x160); Caster.PlaySound(0x5CE); if (m is Mobile) { damage *= GetDamageScalar((Mobile)m); } int sdiBonus = SpellHelper.GetSpellDamageBonus(Caster, m, CastSkill, m is Mobile ? Caster.Player && ((Mobile)m).Player : false); damage *= (100 + sdiBonus); damage /= 100; SpellHelper.Damage(this, target, damage, 0, 0, 0, 0, 100); if (target is Mobile && !CheckResisted((Mobile)target) && ((Mobile)target).NetState != null) { Mobile mob = target as Mobile; if (!TransformationSpellHelper.UnderTransformation(mob, typeof(AnimalForm))) { mob.SendSpeedControl(SpeedControlType.WalkSpeed); } Server.Timer.DelayCall(TimeSpan.FromSeconds(skill / 60), () => { if (!TransformationSpellHelper.UnderTransformation(mob, typeof(AnimalForm)) && !TransformationSpellHelper.UnderTransformation(mob, typeof(Server.Spells.Spellweaving.ReaperFormSpell))) { mob.SendSpeedControl(SpeedControlType.Disable); } }); } } } }
public BuffType GetRandomBuff(Mobile target) { List <BuffType> buffs = new List <BuffType>(); if (MagicReflectSpell.HasReflect(target)) { buffs.Add(BuffType.MagicReflect); } if (ReactiveArmorSpell.HasArmor(target)) { buffs.Add(BuffType.ReactiveArmor); } if (ProtectionSpell.HasProtection(target)) { buffs.Add(BuffType.Protection); } TransformContext context = TransformationSpellHelper.GetContext(target); if (context != null && context.Type != typeof(AnimalForm)) { buffs.Add(BuffType.Transformation); } if (BlessSpell.IsBlessed(target)) { buffs.Add(BuffType.Bless); } else { StatMod mod = target.GetStatMod("[Magic] Str Buff"); if (mod != null) { buffs.Add(BuffType.StrBonus); } mod = target.GetStatMod("[Magic] Dex Buff"); if (mod != null) { buffs.Add(BuffType.DexBonus); } mod = target.GetStatMod("[Magic] Int Buff"); if (mod != null) { buffs.Add(BuffType.IntBonus); } } if (EodonianPotion.IsUnderEffects(target, PotionEffect.Barrab)) { buffs.Add(BuffType.BarrabHemolymph); } if (EodonianPotion.IsUnderEffects(target, PotionEffect.Urali)) { buffs.Add(BuffType.UraliTrance); } if (buffs.Count == 0) { return(BuffType.None); } BuffType type = buffs[Utility.Random(buffs.Count)]; buffs.Clear(); return(type); }
protected override void OnTick() { if ((Core.AOS && m_Poison.Level < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) || (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) || AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn))) { if (m_Mobile.CurePoison(m_Mobile)) { m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true, "* You feel yourself resisting the effects of the poison *"); m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true, String.Format("* {0} seems resistant to the poison *", m_Mobile.Name)); Stop(); return; } } if (m_Index++ == m_Poison.m_Count) { m_Mobile.SendLocalizedMessage(502136); // The poison seems to have worn off. m_Mobile.Poison = null; Stop(); return; } int damage; if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool()) { damage = m_LastDamage; } else { damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar); if (damage < m_Poison.m_Minimum) { damage = m_Poison.m_Minimum; } else if (damage > m_Poison.m_Maximum) { damage = m_Poison.m_Maximum; } m_LastDamage = damage; } if (m_From != null) { m_From.DoHarmful(m_Mobile, true); } IHonorTarget honorTarget = m_Mobile as IHonorTarget; if (honorTarget != null && honorTarget.ReceivedHonorContext != null) { honorTarget.ReceivedHonorContext.OnTargetPoisoned(); } AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0); if (0.60 <= Utility.RandomDouble()) // OSI: randomly revealed between first and third damage tick, guessing 60% chance { m_Mobile.RevealingAction(); } if ((m_Index % m_Poison.m_MessageInterval) == 0) { m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison); } }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); List <Mobile> targets = new List <Mobile>(); Map map = Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 8); foreach (Mobile m in eable) { if ((m is BaseCreature) && (m as BaseCreature).IsDispellable && Caster.CanBeHarmful(m, false) || TransformationSpellHelper.UnderTransformation(m) || !m.CanBeginAction(typeof(PolymorphSpell)) || AnimalForm.UnderTransformation(Caster) || (TransformationSpellHelper.GetContext(m) != null)) { targets.Add(m); } } eable.Free(); } for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; BaseCreature bc = m as BaseCreature; if (TransformationSpellHelper.UnderTransformation(m)) { double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Necromancy.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); Caster.DoHarmful(m); TransformationSpellHelper.RemoveContext(m, true); } else { m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! Caster.DoHarmful(m); } } else if (!m.CanBeginAction(typeof(PolymorphSpell))) { double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Magery.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); PolymorphSpell.EndPolymorph(m); //TransformationSpellHelper.RemoveContext(m, true); Caster.DoHarmful(m); } else { Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (AnimalForm.UnderTransformation(Caster)) { double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Ninjitsu.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); AnimalForm.RemoveContext(m, true); Caster.DoHarmful(m); } else { Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (TransformationSpellHelper.GetContext(m) != null) { double dispelChance = Math.Pow((((Caster.Hunger + Caster.Thirst) / 2 + Caster.Skills.Magery.Value) / ((m.Hunger - m.Thirst) / 2 + m.Skills.Spellweaving.Value + m.Skills.MagicResist.Value + 1)), 4) / 2; if (dispelChance < 0) { dispelChance = 0.01; } if (dispelChance > 1) { dispelChance = 1; } if (dispelChance > Utility.RandomDouble()) { Caster.DoHarmful(m); Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); TransformationSpellHelper.RemoveContext(m, true); } else { Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else { if (bc == null) { continue; } double dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100; if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); m.Delete(); } else { Caster.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); } } } } FinishSequence(); }
public virtual bool CheckSequence() { int mana = ScaleMana(GetMana()); if (m_Caster.Deleted || !m_Caster.Alive || m_Caster.Spell != this || m_State != SpellState.Sequencing) { DoFizzle(); } else if (m_Scroll != null && !(m_Scroll is Runebook) && (m_Scroll.Amount <= 0 || m_Scroll.Deleted || m_Scroll.RootParent != m_Caster || (m_Scroll is BaseWand && (((BaseWand)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster)))) { DoFizzle(); } else if (!ConsumeReagents()) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502630); // More reagents are needed for this spell. } else if (m_Caster.Mana < mana) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana for this spell. } else if (Core.AOS && (m_Caster.Frozen || m_Caster.Paralyzed)) { m_Caster.SendLocalizedMessage(502646); // You cannot cast a spell while frozen. DoFizzle(); } else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow) { m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed. DoFizzle(); } else if (CheckFizzle()) { m_Caster.Mana -= mana; if (m_Scroll is SpellScroll) { m_Scroll.Consume(); } else if (m_Scroll is BaseWand) { ((BaseWand)m_Scroll).ConsumeCharge(m_Caster); m_Caster.RevealingAction(); } if (m_Scroll is BaseWand) { bool m = m_Scroll.Movable; m_Scroll.Movable = false; if (ClearHandsOnCast) { m_Caster.ClearHands(); } m_Scroll.Movable = m; } else { if (ClearHandsOnCast) { m_Caster.ClearHands(); } } int karma = ComputeKarmaAward(); if (karma != 0) { Misc.Titles.AwardKarma(Caster, karma, true); } if (TransformationSpellHelper.UnderTransformation(m_Caster, typeof(VampiricEmbraceSpell))) { bool garlic = false; for (int i = 0; !garlic && i < m_Info.Reagents.Length; ++i) { garlic = (m_Info.Reagents[i] == Reagent.Garlic); } if (garlic) { m_Caster.SendLocalizedMessage(1061651); // The garlic burns you! AOS.Damage(m_Caster, Utility.RandomMinMax(17, 23), 100, 0, 0, 0, 0); } } return(true); } else { DoFizzle(); } return(false); }
public override void OnCast() { if (!Caster.CanBeginAction <PolymorphSpell>()) { Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed. } else if (TransformationSpellHelper.UnderTransformation(Caster)) { Caster.SendLocalizedMessage(1063219); // You cannot mimic an animal while in that form. } else if (!Caster.CanBeginAction <IncognitoSpell>() || (Caster.IsBodyMod && GetContext(Caster) == null)) { DoFizzle(); } else if (CheckSequence()) { AnimalFormContext context = GetContext(Caster); int mana = ScaleMana(RequiredMana); if (mana > Caster.Mana) { Caster.SendLocalizedMessage(1060174, mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability. } else if (context != null) { RemoveContext(Caster, context, true); Caster.Mana -= mana; } else if (Caster is PlayerMobile) { bool skipGump = m_WasMoving || CasterIsMoving(); if (GetLastAnimalForm(Caster) == -1 || !skipGump) { Caster.CloseGump <AnimalFormGump>(); Caster.SendGump(new AnimalFormGump(Caster, Entries, this)); } else { if (Morph(Caster, GetLastAnimalForm(Caster)) == MorphResult.Fail) { DoFizzle(); } else { Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist); Caster.Mana -= mana; } } } else { if (Morph(Caster, GetLastAnimalForm(Caster)) == MorphResult.Fail) { DoFizzle(); } else { Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist); Caster.Mana -= mana; } } } FinishSequence(); }
public override void OnCast() { if (Caster.Flying) { Caster.SendLocalizedMessage(1113415); // You cannot use this ability while flying. } else if (Factions.Sigil.ExistsOn(Caster)) { Caster.SendLocalizedMessage(1010521); // You cannot polymorph while you have a Town Sigil } else if (!Caster.CanBeginAction(typeof(PolymorphSpell))) { if (Core.ML) { EndPolymorph(Caster); } else { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } } else if (TransformationSpellHelper.UnderTransformation(Caster)) { Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form. } else if (DisguiseTimers.IsDisguised(Caster)) { Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised. } else if (Caster.BodyMod == 183 || Caster.BodyMod == 184) { Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint } else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod) { DoFizzle(); } else if (CheckSequence()) { if (Caster.BeginAction(typeof(PolymorphSpell))) { if (m_NewBody != 0) { if (!((Body)m_NewBody).IsHuman) { Mobiles.IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } Caster.BodyMod = m_NewBody; if (m_NewBody == 400 || m_NewBody == 401) { Caster.HueMod = Utility.RandomSkinHue(); } else { Caster.HueMod = 0; } BaseArmor.ValidateMobile(Caster); BaseClothing.ValidateMobile(Caster); if (!Core.ML) { StopTimer(Caster); Timer t = new InternalTimer(Caster); m_Timers[Caster] = t; BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Polymorph, 1075824, 1075823, t.Delay, Caster, string.Format("{0}\t{1}", GetArticleCliloc(m_NewBody), GetFormCliloc(m_NewBody)))); t.Start(); } } } else { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } } FinishSequence(); }
public override void OnCast() { if (SphereSpellTarget is BaseWand) { BaseWand bw = SphereSpellTarget as BaseWand; bw.RechargeWand(Caster, this); } else if (TransformationSpellHelper.UnderTransformation(Caster)) { Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form. } else if (DisguiseTimers.IsDisguised(Caster)) { Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised. } else if (Caster.BodyMod == 183 || Caster.BodyMod == 184) { Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint } /* * else if ( !Caster.CanBeginAction( typeof( IncognitoSpell ) ) ) * { * DoFizzle(); * }*/ else if (CheckSequence()) { StopTimer(Caster); //Reset polymorph spell if (Caster.BeginAction(typeof(PolymorphSpell))) { if (m_PolymorphEntry.BodyID != 0) { if (!((Body)m_PolymorphEntry.BodyID).IsHuman) { IMount mt = Caster.Mount; if (mt != null) { mt.Rider = null; } } if (m_PolymorphEntry.BodyID == 0x3B) //Dragon, two different body IDs { Caster.BodyMod = Utility.RandomList(0x3B, 0xC); } else { Caster.BodyMod = m_PolymorphEntry.BodyID; } Caster.PlaySound(Sound); StopTimer(Caster); Timer t = new InternalTimer(Caster, m_PolymorphEntry); m_Timers.Add(Caster, t); t.Start(); BaseArmor.ValidateMobile(Caster); BaseWeapon.ValidateMobile(Caster); if (Caster.NameMod != null) //Caster has incognito, need to update name { Caster.NameMod = IncognitoSpell.GetNameMod(Caster.BodyValue); } } } else { Caster.SendLocalizedMessage(1005559); // This spell is already in effect. } } FinishSequence(); }
private Item TryStealItem(Item toSteal, ref bool caught) { Item stolen = null; object root = toSteal.RootParent; StealableArtifactsSpawner.StealableInstance si = null; if (toSteal.Parent == null || !toSteal.Movable) { si = toSteal is AddonComponent?StealableArtifactsSpawner.GetStealableInstance(((AddonComponent)toSteal).Addon) : StealableArtifactsSpawner.GetStealableInstance(toSteal); } if (!IsEmptyHanded(m_Thief)) { m_Thief.SendLocalizedMessage(1005584); // Both hands must be free to steal. } else if (root is Mobile && ((Mobile)root).Player && !IsInGuild(m_Thief)) { m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players. } else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0) { m_Thief.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild. } else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (root is PlayerVendor) { m_Thief.SendLocalizedMessage(502709); // You can't steal from vendors. } else if (!m_Thief.CanSee(toSteal)) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true)) { m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } else if (toSteal is VvVSigil && ViceVsVirtueSystem.Instance != null) { VvVPlayerEntry entry = ViceVsVirtueSystem.Instance.GetPlayerEntry <VvVPlayerEntry>(m_Thief); VvVSigil sig = (VvVSigil)toSteal; if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (root != null) // not on the ground { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (entry != null) { if (!m_Thief.CanBeginAction(typeof(IncognitoSpell))) { m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito } else if (DisguiseTimers.IsDisguised(m_Thief)) { m_Thief.SendLocalizedMessage(1010583); // You cannot steal the sigil while disguised } else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell))) { m_Thief.SendLocalizedMessage(1010582); // You cannot steal the sigil while polymorphed } else if (TransformationSpellHelper.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1061622); // You cannot steal the sigil while in that form. } else if (AnimalForm.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1063222); // You cannot steal the sigil while mimicking an animal. } else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 100.0, 120.0)) { if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true)) { m_Thief.SendLocalizedMessage(1010259); // The sigil has gone home because your backpack is full } else { m_Thief.SendLocalizedMessage(1010586); // YOU STOLE THE SIGIL!!! (woah, calm down now) sig.OnStolen(entry); return(sig); } } else { m_Thief.SendLocalizedMessage(1005594); // You do not have enough skill to steal the sigil } } else { m_Thief.SendLocalizedMessage(1155415); // Only participants in Vice vs Virtue may use this item. } } else if (si == null && (toSteal.Parent == null || !toSteal.Movable) && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (si == null && toSteal is Container && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0) { m_Thief.SendLocalizedMessage(1060025, "", 0x66D); // You're not skilled enough to attempt the theft of this item. } else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equiped. } else if (root == m_Thief) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && ((Mobile)root).IsStaff()) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root)) { } else if (root is Corpse) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else { double w = toSteal.Weight + toSteal.TotalWeight; if (w > 10) { m_Thief.SendMessage("That is too heavy to steal."); } else { if (toSteal.Stackable && toSteal.Amount > 1) { int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); if (maxAmount < 1) { maxAmount = 1; } else if (maxAmount > toSteal.Amount) { maxAmount = toSteal.Amount; } int amount = Utility.RandomMinMax(1, maxAmount); if (amount >= toSteal.Amount) { int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = toSteal; } } else { int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount); if (stolen == null) { stolen = toSteal; } } } } else { int iw = (int)Math.Ceiling(w); iw *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) { stolen = toSteal; } } // Non-movable stealable (not in fillable container) items cannot result in the stealer getting caught if (stolen != null && (root is FillableContainer || stolen.Movable)) { double skillValue = m_Thief.Skills[SkillName.Stealing].Value; if (root is FillableContainer) { caught = (Utility.Random((int)(skillValue / 2.5)) == 0); // 1 of 48 chance at 120 } else { caught = (skillValue < Utility.Random(150)); } } else { caught = false; } if (stolen != null) { m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. ItemFlags.SetTaken(stolen, true); ItemFlags.SetStealable(stolen, false); stolen.Movable = true; InvokeItemStoken(new ItemStolenEventArgs(stolen, m_Thief)); if (si != null) { toSteal.Movable = true; si.Item = null; } } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } } } return(stolen); }
public void OnTarget(Object o) { Mobile target = o as Mobile; if (target == null) { return; } if (m_CurseTable.ContainsKey(Caster)) { Caster.SendLocalizedMessage(1154212); //You may not use the Purge Magic spell while you are under its curse. } else if (m_ImmuneTable.ContainsKey(target) || m_CurseTable.ContainsKey(target)) { Caster.SendLocalizedMessage(1080119); // Your Purge Magic has been resisted! } else if (CheckHSequence(target)) { if (CheckResisted(target)) { target.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. Caster.SendLocalizedMessage(1080119); //Your Purge Magic has been resisted! } else { SpellHelper.CheckReflect((int)Circle, Caster, ref target); Caster.PlaySound(0x655); Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 1, 13, 0x834, 0, 0x13B2, 0); BuffType type = GetRandomBuff(target); if (type != BuffType.None) { string arg = ""; switch (type) { case BuffType.MagicReflect: MagicReflectSpell.EndReflect(target); arg = "magic reflect"; break; case BuffType.ReactiveArmor: ReactiveArmorSpell.EndArmor(target); arg = "reactive armor"; break; case BuffType.Protection: ProtectionSpell.EndProtection(target); arg = "protection"; break; case BuffType.Transformation: TransformationSpellHelper.RemoveContext(target, true); arg = "transformation spell"; break; case BuffType.StrBonus: arg = "strength bonus"; target.RemoveStatMod("[Magic] Str Buff"); BuffInfo.RemoveBuff(target, BuffIcon.Strength); break; case BuffType.DexBonus: arg = "dexterity bonus"; target.RemoveStatMod("[Magic] Dex Buff"); BuffInfo.RemoveBuff(target, BuffIcon.Agility); break; case BuffType.IntBonus: arg = "intelligence bonus"; target.RemoveStatMod("[Magic] Int Buff"); BuffInfo.RemoveBuff(target, BuffIcon.Cunning); break; case BuffType.BarrabHemolymph: arg = "Barrab hemolymph"; EodonianPotion.RemoveEffects(target, PotionEffect.Barrab); break; case BuffType.UraliTrance: arg = "Urali Trance"; EodonianPotion.RemoveEffects(target, PotionEffect.Urali); break; case BuffType.Bless: arg = "bless"; target.RemoveStatMod("[Magic] Str Buff"); target.RemoveStatMod("[Magic] Dex Buff"); target.RemoveStatMod("[Magic] Int Buff"); BuffInfo.RemoveBuff(target, BuffIcon.Bless); BlessSpell.RemoveBless(target); break; } target.SendLocalizedMessage(1080117, arg); //Your ~1_ABILITY_NAME~ has been purged. Caster.SendLocalizedMessage(1080118, arg); //Your target's ~1_ABILITY_NAME~ has been purged. int duration = (int)((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 15); if (duration <= 0) { duration = 1; } m_ImmuneTable.Add(target, new ImmuneTimer(target, TimeSpan.FromSeconds(duration))); } else { Caster.SendLocalizedMessage(1080120); //Your target has no magic that can be purged. int duration = (int)((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 28); if (duration <= 0) { duration = 1; } m_CurseTable.Add(target, new CurseTimer(target, Caster, TimeSpan.FromSeconds(duration))); } } } FinishSequence(); }
public static int MobileNotoriety(Mobile source, Mobile target) { if (Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier)) { return(Notoriety.Invulnerable); } if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (source.Player && !target.Player && source is PlayerMobile && target is BaseCreature) { BaseCreature bc = (BaseCreature)target; Mobile master = bc.GetMaster(); if (master != null && master.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (!bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } } if (target.Kills >= 5 || (target.Body.IsMonster && IsSummoned(target as BaseCreature) && !(target is BaseFamiliar) && !(target is ArcaneFey) && !(target is Golem)) || (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead))) { return(Notoriety.Murderer); } if (target.Criminal) { return(Notoriety.Criminal); } Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if (sourceGuild != null && targetGuild != null) { if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) { return(Notoriety.Ally); } else if (sourceGuild.IsEnemy(targetGuild)) { return(Notoriety.Enemy); } } Faction srcFaction = Faction.Find(source, true, true); Faction trgFaction = Faction.Find(target, true, true); if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet) { return(Notoriety.Enemy); } if (SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature && ((BaseCreature)target).AlwaysAttackable) { return(Notoriety.CanBeAttacked); } if (CheckHouseFlag(source, target, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature) && !TransformationSpellHelper.UnderTransformation(target) && !AnimalForm.UnderTransformation(target)) { return(Notoriety.CanBeAttacked); } } if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source) { return(Notoriety.CanBeAttacked); } } if (source is BaseCreature) { BaseCreature bc = (BaseCreature)source; Mobile master = bc.GetMaster(); if (master != null && CheckAggressor(master.Aggressors, target)) { return(Notoriety.CanBeAttacked); } } return(Notoriety.Innocent); }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (targeted is Mobile) { if (targeted is BaseCreature) { BaseCreature creature = (BaseCreature)targeted; if (!creature.Tamable) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cette créature ne peut être apprivoisée", from.NetState); // That creature cannot be tamed. } else if (creature.Controlled) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cet animal a déjà un maître", from.NetState); // That animal looks tame already. } else if (from.Female && !creature.AllowFemaleTamer) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Seul un homme peut approcher cette créature", from.NetState); // That creature can only be tamed by males. } else if (!from.Female && !creature.AllowMaleTamer) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Seule une femme peut approcher cette créature", from.NetState); // That creature can only be tamed by females. } else if (creature is CuSidhe && from.Race != Race.Elf) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous ne pouvez apprivoiser cela!", from.NetState); // You can't tame that! } else if (from.Followers + creature.ControlSlots > from.FollowersMax) { from.SendMessage("Vous avez trop d'animaux domestiques pour en apprivoiser un nouveau"); // You have too many followers to tame that creature. } else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cet animal a eu suffisamment de maître dans le passé et souhaite qu'on le laisse tranquille", from.NetState); // This animal has had too many owners and is too upset for you to tame. } else if (MustBeSubdued(creature)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous devez assujetir cette créature avant de l'apprivoiser", from.NetState); // You must subdue this creature before you can tame it! } else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill) { FactionWarHorse warHorse = creature as FactionWarHorse; if (warHorse != null) { Faction faction = Faction.Find(from); if (faction == null || faction != warHorse.Faction) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous ne pouvez apprivoiser cette créature", from.NetState); // You cannot tame this creature. return; } } if (m_BeingTamed.Contains(targeted)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Quelqu'un tente déjà de l'apprivoiser", from.NetState); // Someone else is already taming this. } else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble()) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous irritez la créature!", from.NetState); // You seem to anger the beast! creature.PlaySound(creature.GetAngerSound()); creature.Direction = creature.GetDirectionTo(from); if (creature.BardPacified && Utility.RandomDouble() > .24) { Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(ResetPacify), creature); } else { creature.BardEndTime = DateTime.Now; } creature.BardPacified = false; if (creature.AIObject != null) { creature.AIObject.DoMove(creature.Direction); } if (from is PlayerMobile && !(((PlayerMobile)from).HonorActive || TransformationSpellHelper.UnderTransformation(from, typeof(EtherealVoyageSpell)))) { creature.Combatant = from; } } else { m_BeingTamed[targeted] = from; from.LocalOverheadMessage(MessageType.Emote, 0x59, false, "Vous tentez d'apprivoiser la créature"); // You start to tame the creature. from.NonlocalOverheadMessage(MessageType.Emote, 0x59, false, "*tente d'apprivoiser une créature*"); // *begins taming a creature.* new InternalTimer(from, creature, Utility.Random(3, 2)).Start(); m_SetSkillTime = false; } } else { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous n'avez aucune chance d'apprivoiser cette créature", from.NetState); // You have no chance of taming this creature. } } else { ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Cela ne peut être apprivoisé", from.NetState); // That being cannot be tamed. } } else { from.SendMessage("Vous ne pouvez apprivoiser cela!"); // You can't tame that! } }
public bool Cast() { m_StartCastTime = Core.TickCount; if (Core.AOS && m_Caster.Spell is Spell && ((Spell)m_Caster.Spell).State == SpellState.Sequencing) { ((Spell)m_Caster.Spell).Disturb(DisturbType.NewCast); } if (!m_Caster.CheckAlive()) { return(false); } else if (m_Scroll is BaseWand && m_Caster.Spell != null && m_Caster.Spell.IsCasting) { m_Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen. } else if (m_Caster.Spell != null && m_Caster.Spell.IsCasting) { m_Caster.SendLocalizedMessage(502642); // You are already casting a spell. } else if (BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)) || (BlockedByAnimalForm && AnimalForm.UnderTransformation(m_Caster))) { m_Caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form. } else if (!(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen)) { m_Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen. } else if (CheckNextSpellTime && Core.TickCount - m_Caster.NextSpellTime < 0) { m_Caster.SendLocalizedMessage(502644); // You have not yet recovered from casting a spell. } else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow) { m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed. } #region Dueling else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast(m_Caster, this)) { } #endregion else if (m_Caster.Mana >= ScaleMana(GetMana())) { if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast() && m_Caster.Region.OnBeginSpellCast(m_Caster, this)) { m_State = SpellState.Casting; m_Caster.Spell = this; if (!(m_Scroll is BaseWand) && RevealOnCast) { m_Caster.RevealingAction(); } SayMantra(); TimeSpan castDelay = this.GetCastDelay(); if (ShowHandMovement && (m_Caster.Body.IsHuman || (m_Caster.Player && m_Caster.Body.IsMonster))) { int count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds); if (count != 0) { m_AnimTimer = new AnimTimer(this, count); m_AnimTimer.Start(); } if (m_Info.LeftHandEffect > 0) { Caster.FixedParticles(0, 10, 5, m_Info.LeftHandEffect, EffectLayer.LeftHand); } if (m_Info.RightHandEffect > 0) { Caster.FixedParticles(0, 10, 5, m_Info.RightHandEffect, EffectLayer.RightHand); } } if (ClearHandsOnCast) { m_Caster.ClearHands(); } if (Core.ML) { WeaponAbility.ClearCurrentAbility(m_Caster); } m_CastTimer = new CastTimer(this, castDelay); //m_CastTimer.Start(); OnBeginCast(); if (castDelay > TimeSpan.Zero) { m_CastTimer.Start(); } else { m_CastTimer.Tick(); } return(true); } else { return(false); } } else { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana } return(false); }
public override void OnCast() { if (CheckSequence()) { Caster.PlaySound(0xF5); Caster.PlaySound(0x299); Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head); var dispelSkill = ComputePowerValue(2); var chiv = Caster.Skills.Chivalry.Value; var targets = Caster.GetMobilesInRange(8) .Where(m => Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)); foreach (var m in targets) { if (m is BaseCreature bc) { if (bc.Summoned && !bc.IsAnimatedDead) { var dispelChance = (50.0 + 100 * (chiv - bc.DispelDifficulty) / (bc.DispelFocus * 2)) / 100; dispelChance *= dispelSkill / 100.0; if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles( EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042 ); Effects.PlaySound(m, m.Map, 0x201); m.Delete(); continue; } } var evil = !bc.Controlled && bc.Karma < 0; if (evil) { // TODO: Is this right? var fleeChance = (100 - Math.Sqrt(m.Fame / 2.0)) * chiv * dispelSkill; fleeChance /= 1000000; if (fleeChance > Utility.RandomDouble()) { bc.BeginFlee(TimeSpan.FromSeconds(30.0)); } } } var context = TransformationSpellHelper.GetContext(m); if (context?.Spell is NecromancerSpell) // Trees are not evil! TODO: OSI confirm? { // transformed .. var drainChance = 0.5 * (Caster.Skills.Chivalry.Value / Math.Max(m.Skills.Necromancy.Value, 1)); if (drainChance > Utility.RandomDouble()) { var drain = 5 * dispelSkill / 100; m.Stam -= drain; m.Mana -= drain; } } } } FinishSequence(); }
public override void OnCast() { if (CheckSequence()) { List <Mobile> targets = new List <Mobile>(); foreach (Mobile m in Caster.GetMobilesInRange(8)) { if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)) { targets.Add(m); } } Caster.PlaySound(0xF5); Caster.PlaySound(0x299); Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head); int dispelSkill = ComputePowerValue(2); double chiv = Caster.Skills.Chivalry.Value; for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; BaseCreature bc = m as BaseCreature; if (bc != null) { bool dispellable = bc.Summoned && !bc.IsAnimatedDead; if (dispellable) { double dispelChance = (50.0 + ((100 * (chiv - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100; dispelChance *= dispelSkill / 100.0; if (dispelChance > Utility.RandomDouble()) { Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); m.Delete(); continue; } } bool evil = !bc.Controlled && bc.Karma < 0; if (evil) { // TODO: Is this right? double fleeChance = (100 - Math.Sqrt(m.Fame / 2)) * chiv * dispelSkill; fleeChance /= 1000000; if (fleeChance > Utility.RandomDouble()) { // guide says 2 seconds, it's longer bc.BeginFlee(TimeSpan.FromSeconds(30.0)); } } } TransformContext context = TransformationSpellHelper.GetContext(m); if (context != null && context.Spell is NecromancerSpell) //Trees are not evil! TODO: OSI confirm? { // transformed .. double drainChance = 0.5 * (Caster.Skills.Chivalry.Value / Math.Max(m.Skills.Necromancy.Value, 1)); if (drainChance > Utility.RandomDouble()) { int drain = (5 * dispelSkill) / 100; m.Stam -= drain; m.Mana -= drain; } } } } FinishSequence(); }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (m.Alive && !m.IsDeadBondedPet && m.AccessLevel == AccessLevel.Player && !m.Hidden && !TransformationSpellHelper.UnderTransformation(m, typeof(EtherealVoyageSpell))) { if (0.2 > Utility.RandomDouble() && !m_TangleCooldown.Contains(m) && InRange(m, 6) && !FountainOfFortune.UnderProtection(m)) { m.Frozen = true; m.MoveToWorld(Location, Map); m.PlaySound(0x1FE); m.SendLocalizedMessage(1111641); // You become entangled in the acid drenched roots. m_TangleCooldown.Add(m); Timer.DelayCall(TimeSpan.FromSeconds(Utility.RandomMinMax(3, 6)), new TimerStateCallback <Mobile>(Untangle), m); Timer.DelayCall(TimeSpan.FromSeconds(15.0), new TimerStateCallback <Mobile>(RemoveCooldown), m); } if (m.InRange(this, 1) && !m_DamageTable.ContainsKey(m)) { // Should start the timer m_DamageTable[m] = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.0), new TimerStateCallback <Mobile>(DoDamage), m); } } }