public void Target(Mobile from, Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                // Seems like this should be responsibility of the targetting system.  --daleron
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
                goto Return;
            }

            if (!CheckSequence())
            {
                goto Return;
            }

            var c = m as BaseCreature;

            if (c == null)
            {
                Caster.SendMessage("You cannot sacrifice that.");
                goto Return;
            }

            if (c.ControlMaster != Caster)
            {
                Caster.SendMessage("You cannot sacrifice a creature that does not obey you.");
                goto Return;
            }

            if (c.Summoned)
            {
                Caster.SendMessage("There is not enough life there to sacrifice.");
            }


            Caster.BoltEffect(0);
            Caster.PlaySound(0x207);

            var dmg = c.Hits * SpellHelper.GetEffectiveness(Caster);

            dmg = ZuluUtil.RandomGaussian(dmg, dmg / 4);

            foreach (var target in Caster.Map.GetMobilesInRange(Caster.Location, 4))
            {
                if (!Caster.CanSee(target))
                {
                    continue;
                }

                Caster.DoHarmful(target);
                target.Damage((int)dmg, Caster /*, ElementalType.Necro*/);
            }

Return:
            FinishSequence();
        }
Example #2
0
 public override void OnCast()
 {
     if (m_Entry == null)
     {
         Caster.Target = new InternalTarget(this);
     }
     else
     {
         Effect(m_Entry.Location, m_Entry.Map, true);
     }
     Caster.BoltEffect(0);
 }
Example #3
0
        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);

                Caster.BoltEffect(0);
                Point3D loc  = new Point3D(p.X, p.Y, p.Z);
                Item    item = new InternalItem(loc, Caster.Map, Caster);
            }
            FinishSequence();
        }
Example #4
0
        public void Target(object o)
        {
            if (o is Item)
            {
                Item targ = (Item)o;

                if (targ is LockableContainer)
                {
                    LockableContainer box = (LockableContainer)targ;
                    if (Multis.BaseHouse.CheckLockedDownOrSecured(box))
                    {
                        // You cannot cast this on a locked down item.
                        Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 501761);
                    }
                    else if (box.Locked || box.LockLevel == 0 || box is ParagonChest)
                    {
                        // Target must be an unlocked chest.
                        Caster.SendLocalizedMessage(501762);
                    }
                    else if (CheckSequence())
                    {
                        SpellHelper.Turn(Caster, box);

                        Point3D loc = box.GetWorldLocation();

                        Effects.SendLocationParticles(
                            EffectItem.Create(loc, box.Map, EffectItem.DefaultDuration),
                            0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5020, 0);

                        Effects.PlaySound(loc, box.Map, 0x1FA);

                        // The chest is now locked!
                        Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501763);

                        box.LockLevel = (int)(Caster.Skills[SkillName.Magery].Value);
                        if (box.LockLevel > 90)
                        {
                            box.LockLevel = 90;
                        }
                        if (box.LockLevel < 0)
                        {
                            box.LockLevel = 0;
                        }
                        box.MaxLockLevel  = box.LockLevel + 20;
                        box.RequiredSkill = box.LockLevel;

                        //box.LockLevel = -255; // signal magic lock
                        box.Locked = true;
                    }
                }
                else if (targ is BaseDoor)
                {
                    BaseDoor door = (BaseDoor)targ;
                    if (Server.Items.DoorType.IsDungeonDoor(door))
                    {
                        if (door.Locked == true)
                        {
                            Caster.SendMessage("That door is already locked!");
                        }
                        else
                        {
                            SpellHelper.Turn(Caster, door);

                            Point3D loc = door.GetWorldLocation();

                            Effects.SendLocationParticles(
                                EffectItem.Create(loc, door.Map, EffectItem.DefaultDuration),
                                0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 5020, 0);

                            Effects.PlaySound(loc, door.Map, 0x1FA);

                            Caster.SendMessage("That door is now locked!");

                            door.Locked = true;
                            Server.Items.DoorType.LockDoors(door);

                            new InternalTimer(door, Caster).Start();
                        }
                    }
                    else
                    {
                        Caster.SendMessage("This spell has no effect on that!");
                    }
                }
                else
                {
                    Caster.SendMessage("This spell has no effect on that!");
                }
            }
            else if (o is PlayerMobile)
            {
                Caster.SendMessage("That soul seems too strong to trap in the flask!");
            }
            else if (o is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)o;

                if (!bc.Alive)
                {
                    Caster.SendMessage("You cannot trap something that is dead!");
                }
                else if (bc.Controlled is LockedCreature)
                {
                    Caster.SendMessage("That creature cannot be trapped again!");
                }
                else if (bc.Controlled == true)
                {
                    Caster.SendMessage("That is under the control of another!");
                }
                else if (bc.EmoteHue == 505 || bc.ControlSlots >= 100)                   // SUMMON QUEST AND QUEST MONSTERS
                {
                    Server.Misc.IntelligentAction.FizzleSpell(Caster);
                    Caster.SendMessage("You are not powerful enough to trap that!");
                }
                else if (Caster.Backpack.FindItemByType(typeof(IronFlask)) == null)
                {
                    Caster.SendMessage("You need an empty iron flask to trap them!");
                }
                else
                {
                    int level  = Server.Misc.DifficultyLevel.GetCreatureLevel((Mobile)o) + 10;
                    int magery = (int)(Caster.Skills[SkillName.Magery].Value);

                    if (magery >= level)
                    {
                        int success = 10 + (magery - level);

                        if (Utility.RandomMinMax(1, 100) > success)
                        {
                            Server.Misc.IntelligentAction.FizzleSpell(Caster);
                            Caster.SendMessage("You fail to trap them in the flask!");
                        }
                        else
                        {
                            Item flask = Caster.Backpack.FindItemByType(typeof(IronFlask));
                            if (flask != null)
                            {
                                flask.Consume();
                            }

                            Caster.SendMessage("You trap " + bc.Name + " in the flask!");

                            IronFlaskFilled bottle = new IronFlaskFilled();

                            int hitpoison = 0;

                            if (bc.HitPoison == Poison.Lesser)
                            {
                                hitpoison = 1;
                            }
                            else if (bc.HitPoison == Poison.Regular)
                            {
                                hitpoison = 2;
                            }
                            else if (bc.HitPoison == Poison.Greater)
                            {
                                hitpoison = 3;
                            }
                            else if (bc.HitPoison == Poison.Deadly)
                            {
                                hitpoison = 4;
                            }
                            else if (bc.HitPoison == Poison.Lethal)
                            {
                                hitpoison = 5;
                            }

                            int immune = 0;

                            if (bc.PoisonImmune == Poison.Lesser)
                            {
                                immune = 1;
                            }
                            else if (bc.PoisonImmune == Poison.Regular)
                            {
                                immune = 2;
                            }
                            else if (bc.PoisonImmune == Poison.Greater)
                            {
                                immune = 3;
                            }
                            else if (bc.PoisonImmune == Poison.Deadly)
                            {
                                immune = 4;
                            }
                            else if (bc.PoisonImmune == Poison.Lethal)
                            {
                                immune = 5;
                            }

                            bottle.TrappedName        = bc.Name;
                            bottle.TrappedTitle       = bc.Title;
                            bottle.TrappedBody        = bc.Body;
                            bottle.TrappedBaseSoundID = bc.BaseSoundID;
                            bottle.TrappedHue         = bc.Hue;

                            // TURN HUMANOIDS TO GHOSTS SO I DON'T NEED TO WORRY ABOUT CLOTHES AND GEAR
                            if (bc.Body == 400 || bc.Body == 401 || bc.Body == 605 || bc.Body == 606)
                            {
                                bottle.TrappedBody        = 0x3CA;
                                bottle.TrappedHue         = 0x9C4;
                                bottle.TrappedBaseSoundID = 0x482;
                            }

                            bottle.TrappedAI = 2; if (bc.AI == AIType.AI_Mage)
                            {
                                bottle.TrappedAI = 1;
                            }
                            bottle.TrappedStr          = bc.RawStr;
                            bottle.TrappedDex          = bc.RawDex;
                            bottle.TrappedInt          = bc.RawInt;
                            bottle.TrappedHits         = bc.HitsMax;
                            bottle.TrappedStam         = bc.StamMax;
                            bottle.TrappedMana         = bc.ManaMax;
                            bottle.TrappedDmgMin       = bc.DamageMin;
                            bottle.TrappedDmgMax       = bc.DamageMax;
                            bottle.TrappedColdDmg      = bc.ColdDamage;
                            bottle.TrappedEnergyDmg    = bc.EnergyDamage;
                            bottle.TrappedFireDmg      = bc.FireDamage;
                            bottle.TrappedPhysicalDmg  = bc.PhysicalDamage;
                            bottle.TrappedPoisonDmg    = bc.PoisonDamage;
                            bottle.TrappedColdRst      = bc.ColdResistSeed;
                            bottle.TrappedEnergyRst    = bc.EnergyResistSeed;
                            bottle.TrappedFireRst      = bc.FireResistSeed;
                            bottle.TrappedPhysicalRst  = bc.PhysicalResistanceSeed;
                            bottle.TrappedPoisonRst    = bc.PoisonResistSeed;
                            bottle.TrappedVirtualArmor = bc.VirtualArmor;
                            bottle.TrappedCanSwim      = bc.CanSwim;
                            bottle.TrappedCantWalk     = bc.CantWalk;
                            bottle.TrappedSkills       = level + 5;
                            bottle.TrappedPoison       = hitpoison;
                            bottle.TrappedImmune       = immune;
                            bottle.TrappedAngerSound   = bc.GetAngerSound();
                            bottle.TrappedIdleSound    = bc.GetIdleSound();
                            bottle.TrappedDeathSound   = bc.GetDeathSound();
                            bottle.TrappedAttackSound  = bc.GetAttackSound();
                            bottle.TrappedHurtSound    = bc.GetHurtSound();

                            Caster.BoltEffect(0);
                            Caster.PlaySound(0x665);

                            Caster.AddToBackpack(bottle);

                            bc.BoltEffect(0);
                            bc.PlaySound(0x665);
                            bc.Delete();
                        }
                    }
                    else
                    {
                        Server.Misc.IntelligentAction.FizzleSpell(Caster);
                        Caster.SendMessage("You are not powerful enough to trap that!");
                    }
                }
            }

            FinishSequence();
        }