コード例 #1
0
ファイル: Abilities.cs プロジェクト: nydehi/imagine-uo
        public static void MimicThem(BaseCreature from, Mobile targ, bool allowskillchanges, bool allowAIchanges)
        {
            if (targ == null)
            {
                return;
            }

            if (from.BodyMod == 0)
            {
                from.BodyMod = targ.Body;
                from.Hue     = targ.Hue;

                from.NameMod = targ.Name;
                from.Title   = targ.Title;

                from.HairItemID       = targ.HairItemID;
                from.FacialHairItemID = targ.FacialHairItemID;

                from.VirtualArmor = targ.VirtualArmor;

                foreach (Item item in targ.Items)
                {
                    if (item.Layer != Layer.Backpack && item.Layer != Layer.Mount)
                    {
                        /*
                         * We don't dupe armor because the creatures base seed stacks with armor
                         * By duping a high resistance player we shoot the creature up into the 100's in res
                         * Imagine being the player facing your 400+ HP creature and EVERY attack & spell only deals 1 damage to them.
                         */

                        if (item is BaseShield)
                        {
                            Buckler shieldtomake = new Buckler();
                            shieldtomake.PoisonBonus = 0;
                            shieldtomake.ItemID      = item.ItemID;
                            shieldtomake.Hue         = item.Hue;
                            shieldtomake.Layer       = item.Layer;
                            shieldtomake.Movable     = false;
                            shieldtomake.Name        = item.Name;
                            from.EquipItem(shieldtomake);
                        }
                        else if (item is BaseWeapon)
                        {
                            Broadsword weapontomake = new Broadsword();
                            weapontomake.ItemID  = item.ItemID;
                            weapontomake.Hue     = item.Hue;
                            weapontomake.Layer   = item.Layer;
                            weapontomake.Movable = false;
                            weapontomake.Name    = item.Name;

                            BaseWeapon weapon = item as BaseWeapon;
                            weapontomake.Animation = weapon.Animation;
                            weapontomake.HitSound  = weapon.HitSound;
                            weapontomake.MissSound = weapon.MissSound;
                            weapontomake.MinDamage = weapon.MinDamage;
                            weapontomake.MaxDamage = weapon.MaxDamage;
                            weapontomake.Speed     = weapon.Speed;
                            from.EquipItem(weapontomake);
                        }
                        else
                        {
                            Item itemtomake = new Item(item.ItemID);
                            itemtomake.Hue     = item.Hue;
                            itemtomake.Layer   = item.Layer;
                            itemtomake.Movable = false;
                            itemtomake.Name    = item.Name;
                            from.EquipItem(itemtomake);
                        }
                    }
                }

                /*
                 * Duping skills can mess up the AI.
                 * What good is trying to melee when you have 0 tactics?
                 * On the other side, What good is stopping it's attack to try and cast something it can't do?
                 * The bool allows you to use it as a staff command or spell or make clone creatures that don't run around with the same exact skills as the others.
                 */

                if (allowskillchanges)
                {
                    for (int i = 0; i < targ.Skills.Length && i < from.Skills.Length; i++)
                    {
                        from.Skills[i].Base = targ.Skills[i].Base;
                    }
                }
            }
            else
            {
                from.BodyMod = 0;
                from.Hue     = 0;

                from.NameMod = null;
                from.Title   = null;

                from.HairItemID       = 0;
                from.FacialHairItemID = 0;

                from.VirtualArmor = 0;

                List <Item> list = new List <Item>(from.Items);

                foreach (Item item in list)
                {
                    if (item != null)
                    {
                        item.Delete();
                    }
                }

                if (allowskillchanges)
                {
                    for (int i = 0; i < targ.Skills.Length; ++i)
                    {
                        from.Skills[i].Base = 50.0;
                    }
                }
            }

            return;
        }