Exemple #1
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            SkillType skillType = GetSkillType(item);
            int       tech      = item.GetLocalInt("TECH_LEVEL");
            float     maxDurabilityReductionPenalty = item.GetLocalFloat("MAX_DURABILITY_REDUCTION_PENALTY");
            int       repairAmount = tech * 2;

            if (skillType == SkillType.Armorsmith)
            {
                repairAmount += item.CraftBonusArmorsmith;
            }
            else if (skillType == SkillType.Weaponsmith)
            {
                repairAmount += item.CraftBonusWeaponsmith;
            }

            float minReduction    = 0.05f * tech;
            float maxReduction    = 0.15f * tech;
            float reductionAmount = _random.RandomFloat(minReduction, maxReduction);

            _durability.RunItemRepair(user.Object, target.Object, repairAmount, reductionAmount + maxDurabilityReductionPenalty);
        }
Exemple #2
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            SkillType skillType  = GetSkillType(item);
            NWItem    targetitem = (target.Object);
            int       tech       = item.GetLocalInt("TECH_LEVEL");
            float     maxDurabilityReductionPenalty = item.GetLocalFloat("MAX_DURABILITY_REDUCTION_PENALTY");
            int       repairAmount = tech * 2;
            int       skillRank;
            int       level  = targetitem.RecommendedLevel;
            int       delta  = 0;
            int       baseXP = 0;

            if (skillType == SkillType.Armorsmith)
            {
                skillRank     = (_skill.GetPCSkillRank(user.Object, skillType));
                repairAmount += item.CraftBonusArmorsmith + (_perk.GetPCPerkLevel(user.Object, PerkType.ArmorRepair) * 2);
                delta         = level - skillRank;
            }
            else if (skillType == SkillType.Weaponsmith)
            {
                skillRank     = (_skill.GetPCSkillRank(user.Object, skillType));
                repairAmount += item.CraftBonusWeaponsmith + (_perk.GetPCPerkLevel(user.Object, PerkType.WeaponRepair) * 2);
                delta         = level - skillRank;
            }
            else if (skillType == SkillType.Engineering)
            {
                skillRank     = (_skill.GetPCSkillRank(user.Object, skillType));
                repairAmount += item.CraftBonusEngineering + (_perk.GetPCPerkLevel(user.Object, PerkType.ElectronicRepair) * 2);
                delta         = level - skillRank;
            }
            float minReduction    = 0.05f * tech;
            float maxReduction    = 0.15f * tech;
            float reductionAmount = _random.RandomFloat(minReduction, maxReduction);

            if (delta >= 6)
            {
                baseXP = 400;
            }
            else if (delta == 5)
            {
                baseXP = 350;
            }
            else if (delta == 4)
            {
                baseXP = 325;
            }
            else if (delta == 3)
            {
                baseXP = 300;
            }
            else if (delta == 2)
            {
                baseXP = 250;
            }
            else if (delta == 1)
            {
                baseXP = 225;
            }
            else if (delta == 0)
            {
                baseXP = 200;
            }
            else if (delta == -1)
            {
                baseXP = 150;
            }
            else if (delta == -2)
            {
                baseXP = 100;
            }
            else if (delta == -3)
            {
                baseXP = 50;
            }
            else if (delta == -4)
            {
                baseXP = 25;
            }
            _skill.GiveSkillXP(user.Object, skillType, baseXP);
            _durability.RunItemRepair(user.Object, target.Object, repairAmount, reductionAmount + maxDurabilityReductionPenalty);
        }