当前位置: 首页>>代码示例>>C#>>正文


C# BaseCreature.EquipItem方法代码示例

本文整理汇总了C#中BaseCreature.EquipItem方法的典型用法代码示例。如果您正苦于以下问题:C# BaseCreature.EquipItem方法的具体用法?C# BaseCreature.EquipItem怎么用?C# BaseCreature.EquipItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseCreature的用法示例。


在下文中一共展示了BaseCreature.EquipItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MimicThem

        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 (var 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)
                        {
                            var 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)
                        {
                            var weapontomake = new Broadsword();
                            weapontomake.ItemID = item.ItemID;
                            weapontomake.Hue = item.Hue;
                            weapontomake.Layer = item.Layer;
                            weapontomake.Movable = false;
                            weapontomake.Name = item.Name;

                            var 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
                        {
                            var 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 (var 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;

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

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

//.........这里部分代码省略.........
开发者ID:rokann,项目名称:JustUO,代码行数:101,代码来源:Abilities.cs


注:本文中的BaseCreature.EquipItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。