Ejemplo n.º 1
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            NWPlayer player = NWPlayer.Wrap(user.Object);

            target.RemoveEffect(EFFECT_TYPE_REGENERATE);
            PCSkill skill             = _skill.GetPCSkill(player, SkillType.FirstAid);
            int     luck              = _perk.GetPCPerkLevel(player, PerkType.Lucky);
            int     perkDurationBonus = _perk.GetPCPerkLevel(player, PerkType.HealingKitExpert) * 6 + (luck * 2);
            float   duration          = 30.0f + (skill.Rank * 0.4f) + perkDurationBonus;
            int     restoreAmount     = 1 + item.GetLocalInt("HEALING_BONUS") + player.EffectiveFirstAidBonus;

            int perkBlastBonus = _perk.GetPCPerkLevel(player, PerkType.ImmediateImprovement);

            if (perkBlastBonus > 0)
            {
                int blastHeal = restoreAmount * perkBlastBonus;
                if (_random.Random(100) + 1 <= luck / 2)
                {
                    blastHeal *= 2;
                }
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(blastHeal), target.Object);
            }

            Effect regeneration = _.EffectRegenerate(restoreAmount, 6.0f);

            _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, regeneration, target.Object, duration);
            player.SendMessage("You successfully treat " + target.Name + "'s wounds.");

            int xp = (int)_skill.CalculateRegisteredSkillLevelAdjustedXP(100, item.RecommendedLevel, skill.Rank);

            _skill.GiveSkillXP(player, SkillType.FirstAid, xp);
        }
Ejemplo n.º 2
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            NWPlayer player         = (user.Object);
            var      effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player);

            target.RemoveEffect(EFFECT_TYPE_REGENERATE);
            int   rank = SkillService.GetPCSkillRank(player, SkillType.Medicine);
            int   luck = PerkService.GetPCPerkLevel(player, PerkType.Lucky);
            int   perkDurationBonus    = PerkService.GetPCPerkLevel(player, PerkType.HealingKitExpert) * 6 + (luck * 2);
            float duration             = 30.0f + (rank * 0.4f) + perkDurationBonus;
            int   restoreAmount        = 1 + item.GetLocalInt("HEALING_BONUS") + effectiveStats.Medicine + item.MedicineBonus;
            int   delta                = item.RecommendedLevel - rank;
            float effectivenessPercent = 1.0f;

            if (delta > 0)
            {
                effectivenessPercent = effectivenessPercent - (delta * 0.1f);
            }

            restoreAmount = (int)(restoreAmount * effectivenessPercent);

            int perkBlastBonus = PerkService.GetPCPerkLevel(player, PerkType.ImmediateImprovement);

            if (perkBlastBonus > 0)
            {
                int blastHeal = restoreAmount * perkBlastBonus;
                if (RandomService.Random(100) + 1 <= luck / 2)
                {
                    blastHeal *= 2;
                }
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(blastHeal), target.Object);
            }

            float          interval   = 6.0f;
            BackgroundType background = (BackgroundType)player.Class1;

            if (background == BackgroundType.Medic)
            {
                interval *= 0.5f;
            }

            _.PlaySound("use_bacta");
            Effect regeneration = _.EffectRegenerate(restoreAmount, interval);

            _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, regeneration, target.Object, duration);
            player.SendMessage("You successfully treat " + target.Name + "'s wounds. The healing kit will expire in " + duration + " seconds.");

            _.DelayCommand(duration + 0.5f, () => { player.SendMessage("The healing kit that you applied to " + target.Name + " has expired."); });

            if (target.IsPlayer)
            {
                int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(300, item.RecommendedLevel, rank);
                SkillService.GiveSkillXP(player, SkillType.Medicine, xp);
            }
        }