private void OnBeginDream(PlayerMobile m) { if ((!m.Alive)) { return; } m.SendMessage("Thou hast fallen asleep."); //Create the player's box and label it MetalBox playerBox = new MetalBox(); playerBox.Name = m.Name; //Items list so we can remove them List <Item> equipItems = m.Items; //Remove clothing/equipment for (int x = m.Items.Count - 1; x >= 0; x--) { if (!(m.Items[x] is Backpack)) { playerBox.AddItem(m.Items[x]); } } //Create the box for the backpack items MetalBox backpackBox = new MetalBox(); playerBox.AddItem(backpackBox); //Remove backpack items for (int y = m.Backpack.Items.Count - 1; y >= 0; y--) { if ((m.Backpack.Items[y] is HelmOfCourage) || (m.Backpack.Items[y] is CrystalRoseOfLove) || (m.Backpack.Items[y] is MirrorOfTruth) || (m.Backpack.Items[y] is StaffOrb)) { } else { backpackBox.AddItem(m.Backpack.Items[y]); } } //Move the container away playerBox.MoveToWorld(new Point3D(0, 0, 0), Map.SerpentIsle); //Move pets away foreach (Mobile mobile in m.AllFollowers) { mobile.MoveToWorld(new Point3D(0, 0, 0), Map.SerpentIsle); mobile.Frozen = true; } //Send to random destination in the dream switch (Utility.Random(4)) { case 0: m.MoveToWorld(new Point3D(1988, 1536, 0), Map.SerpentIsle); m.SetDirection(Direction.East); break; case 1: m.MoveToWorld(new Point3D(2050, 1491, 0), Map.SerpentIsle); m.SetDirection(Direction.North); break; case 2: m.MoveToWorld(new Point3D(2040, 1389, 0), Map.SerpentIsle); m.SetDirection(Direction.East); break; case 3: m.MoveToWorld(new Point3D(1904, 1376, 0), Map.SerpentIsle); m.SetDirection(Direction.West); break; } //Restore player to full ((PlayerMobile)m).Hits = m.HitsMax; ((PlayerMobile)m).Mana = m.ManaMax; ((PlayerMobile)m).Stam = m.StamMax; ((PlayerMobile)m).Hunger = 20; ((PlayerMobile)m).Thirst = 20; ((PlayerMobile)m).Paralyzed = false; ((PlayerMobile)m).Poison = null; EvilOmenSpell.TryEndEffect(m); StrangleSpell.RemoveCurse(m); CorpseSkinSpell.RemoveCurse(m); CurseSpell.RemoveEffect(m); MortalStrike.EndWound(m); BloodOathSpell.RemoveCurse(m); MindRotSpell.ClearMindRotScalar(m); BuffInfo.RemoveBuff(m, BuffIcon.Clumsy); BuffInfo.RemoveBuff(m, BuffIcon.FeebleMind); BuffInfo.RemoveBuff(m, BuffIcon.Weaken); BuffInfo.RemoveBuff(m, BuffIcon.Curse); BuffInfo.RemoveBuff(m, BuffIcon.MassCurse); BuffInfo.RemoveBuff(m, BuffIcon.MortalStrike); BuffInfo.RemoveBuff(m, BuffIcon.Mindrot); //Additionally, remove any polymorphs PolymorphSpell.EndPolymorph(m); StoneFormSpell.EndEffect(m); m.BodyMod = 0; m.HueMod = -1; }
protected override void OnTarget(Mobile from, object o) { if (o is Mobile) { Mobile m = (Mobile)o; BaseCreature bc = m as BaseCreature; if (!from.CanSee(m)) { from.SendLocalizedMessage(500237); // Target can not be seen. } else if (TransformationSpellHelper.UnderTransformation(m)) { double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.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); from.DoHarmful(m); TransformationSpellHelper.RemoveContext(m, true); } else { m.FixedEffect(0x3779, 10, 20); from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! from.DoHarmful(m); } } else if (!m.CanBeginAction(typeof(PolymorphSpell))) { double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.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); //TransformationSpellHelper.RemoveContext(m, true); PolymorphSpell.EndPolymorph(m); from.DoHarmful(m); } else { m.FixedEffect(0x3779, 10, 20); from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (AnimalForm.UnderTransformation(m)) { double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.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); from.DoHarmful(m); } else { from.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (TransformationSpellHelper.GetContext(m) != null) { double dispelChance = Math.Pow((((from.Hunger + from.Thirst) / 2 + from.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()) { from.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 { from.DoHarmful(m); m.FixedEffect(0x3779, 10, 20); from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } else if (bc == null || !bc.IsDispellable) { from.SendLocalizedMessage(1005049); // That cannot be dispelled. } else if (m_Owner.CheckHSequence(m)) { SpellHelper.Turn(from, m); double dispelChance = (50.0 + ((100 * (from.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 { m.FixedEffect(0x3779, 10, 20); from.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it! } } } }