Esempio n. 1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is VampireCorpse)
                {
                    VampireCorpse c = (VampireCorpse)targeted;
                    if (c.Staked)
                    {
                        return;
                    }

                    double stakechance = m_Stake.StakeChance;

                    if (c.Owner is BaseVampire)
                    {
                        stakechance = ((BaseVampire)c.Owner).StakeVariance(m_Stake, stakechance);
                    }

                    if (stakechance <= 0)
                    {
                        from.SendMessage("You have no chance of killing this vampire with that!");
                    }
                    else if (stakechance >= Utility.RandomDouble())
                    {
                        //int message = 600282 + Utility.Random( 4 );

                        from.PlaySound(1170);
                        from.SendMessage("You stake the vampire through its heart, ensuring a swift death.");

                        c.Staked        = true;
                        c.Owner.Blessed = false;
                        c.Owner.Kill();
                    }
                    else
                    {
                        from.SendMessage("You miss the vampire's heart.");                           // completely miss
                    }
                    if ((m_Stake.Amount -= 1) <= 0)
                    {
                        m_Stake.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042600);
                }
            }
Esempio n. 2
0
        public static Container Mobile_CreateCorpseHandler(Mobile owner, HairInfo hair, FacialHairInfo facialhair, List <Item> initialContent, List <Item> equipItems)
        {
            bool shouldFillCorpse = true;

            //if ( owner is BaseCreature )
            //	shouldFillCorpse = !((BaseCreature)owner).IsBonded;

            Corpse c;

            if (owner is MilitiaFighter)
            {
                c = new MilitiaFighterCorpse(owner, hair, facialhair, shouldFillCorpse ? equipItems : new List <Item>());
            }
            else if (owner is BaseVampire)
            {
                c = new VampireCorpse(owner, hair, facialhair, shouldFillCorpse ? equipItems : new List <Item>());
            }
            else
            {
                c = new Corpse(owner, hair, facialhair, shouldFillCorpse ? equipItems : new List <Item>());
            }

            owner.Corpse = c;

            if (shouldFillCorpse)
            {
                for (int i = 0; i < initialContent.Count; ++i)
                {
                    Item item = initialContent[i];

                    if (Core.AOS && owner.Player && item.Parent == owner.Backpack)
                    {
                        c.AddItem(item);
                    }
                    else
                    {
                        c.DropItem(item);
                    }

                    if (owner.Player && Core.AOS)
                    {
                        c.SetRestoreInfo(item, item.Location);
                    }
                }

                if (!owner.Player)
                {
                    c.AssignInstancedLoot();
                }
                else if (Core.AOS)
                {
                    PlayerMobile pm = owner as PlayerMobile;

                    if (pm != null)
                    {
                        c.RestoreEquip = pm.EquipSnapshot;
                    }
                }
            }
            else
            {
                c.Carved = true;                 // TODO: Is it needed?
            }

            Point3D loc = owner.Location;
            Map     map = owner.Map;

            if (map == null || map == Map.Internal)
            {
                loc = owner.LogoutLocation;
                map = owner.LogoutMap;
            }

            c.MoveToWorld(loc, map);

            return(c);
        }