示例#1
0
        protected IEnchantment EnchantArmor(IItem item)
        {
            IEnchantment enchantment = null;
            IArmor       armor       = item as IArmor;

            if (armor != null)
            {
                switch (GlobalReference.GlobalValues.Random.Next(2))
                {
                case 0:
                    enchantment                = new DamageReceivedBeforeDefenseEnchantment();
                    enchantment.Effect         = GetRandomDefenseEffect();
                    enchantment.Parameter.Dice = GlobalReference.GlobalValues.DefaultValues.DiceForArmorLevel(item.Level);
                    break;

                case 1:
                    enchantment        = new DamageReceivedAfterDefenseEnchantment();
                    enchantment.Effect = new Effect.Damage();
                    Damage.Damage damage = new Damage.Damage();
                    damage.Dice = GlobalReference.GlobalValues.DefaultValues.DiceForWeaponLevel(item.Level);
                    damage.Type = GetRandomDamageType();
                    break;
                }
            }

            return(enchantment);
        }
示例#2
0
        protected IEnchantment EnchantWeapon(IItem item)
        {
            IEnchantment enchantment = new DamageDealtBeforeDefenseEnchantment();

            enchantment.Effect = new Effect.Damage();
            Damage.Damage damage = new Damage.Damage();
            damage.Dice = GlobalReference.GlobalValues.DefaultValues.DiceForWeaponLevel(item.Level);
            damage.Type = GetRandomDamageType();

            return(enchantment);
        }
示例#3
0
文件: Craftsman.cs 项目: elavanis/Mud
        public IResult Build(INonPlayerCharacter craftsman, IPlayerCharacter performer, AvalableItemPosition position, int level, string keyword, string sentenceDescription, string shortDescription, string lookDescription, string examineDescription, DamageType damageType = DamageType.Slash)
        {
            IResult result;
            IItem   item = null;

            switch (position)
            {
            case Equipment.AvalableItemPosition.Held:
                IEquipment equipment = new Equipment();
                result = BuildItem(craftsman, performer, position, level, keyword, sentenceDescription, shortDescription, lookDescription, examineDescription, equipment);
                item   = equipment;
                break;

            case Equipment.AvalableItemPosition.Wield:
                IWeapon weapon = new Weapon();
                result = BuildItem(craftsman, performer, position, level, keyword, sentenceDescription, shortDescription, lookDescription, examineDescription, weapon);
                IDamage damage = new Damage.Damage(GlobalReference.GlobalValues.DefaultValues.DiceForWeaponLevel(weapon.Level));
                damage.Type = damageType;
                weapon.DamageList.Add(damage);
                item = weapon;
                break;

            case Equipment.AvalableItemPosition.NotWorn:
                craftsman.EnqueueCommand($"Tell {performer.KeyWords[0]} I can not build that.");
                result = new Result("", true);
                break;

            default:
                IArmor armor = new Armor();
                result = BuildItem(craftsman, performer, position, level, keyword, sentenceDescription, shortDescription, lookDescription, examineDescription, armor);
                item   = armor;
                break;
            }

            if (!result.AllowAnotherCommand)
            {
                ICraftsmanObject craftsmanObject = new CraftsmanObject();
                craftsmanObject.CraftsmanId          = new BaseObjectId(craftsman);
                craftsmanObject.CraftmanDescripition = craftsman.ShortDescription;
                craftsmanObject.Completion           = DateTime.Now.AddMinutes(item.Level); //make it take 1 hour game for each level
                craftsmanObject.Item = item;
                performer.CraftsmanObjects.Add(craftsmanObject);
            }

            return(result);
        }