Beispiel #1
0
        /// <summary>
        /// Revives and heals user completely.
        /// </summary>
        /// <param name="user"></param>
        /// <param name="target"></param>
        /// <param name="targetLocation"></param>
        /// <param name="args"></param>
        public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args)
        {
            if (user.IsDead)
            {
                _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectResurrection(), user.Object);
            }

            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectHeal(999), user.Object);
            AbilityService.RestorePlayerFP(user, 9999);
        }
Beispiel #2
0
        /// <summary>
        /// Revives and heals user completely.
        /// </summary>
        /// <param name="user"></param>
        /// <param name="target"></param>
        /// <param name="targetLocation"></param>
        /// <param name="args"></param>
        public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args)
        {
            if (user.IsDead)
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectResurrection(), user.Object);
            }

            _.ApplyEffectToObject(DurationType.Instant, _.EffectHeal(999), user.Object);
            AbilityService.RestorePlayerFP(user, 9999);
        }
Beispiel #3
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            float percent = 0.0f;

            switch (spellTier)
            {
            case 1:
                percent = 0.10f;
                break;

            case 2:
                percent = 0.20f;
                break;

            case 3:
                percent = 0.35f;
                break;

            case 4:
                percent = 0.50f;
                break;
            }

            int recovery = (int)(target.CurrentHP * percent);

            if (recovery < 1)
            {
                recovery = 1;
            }

            // Damage user.
            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectDamage(recovery), creature);

            // Check lucky chance.
            int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky);

            if (RandomService.D100(1) <= luck)
            {
                recovery *= 2;
                creature.SendMessage("Lucky Force Body!");
            }

            // Recover FP on target.
            AbilityService.RestorePlayerFP(target.Object, recovery);

            // Play VFX
            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_IMP_HEAD_ODD), target);

            // Grant XP, if player.
            if (creature.IsPlayer)
            {
                SkillService.GiveSkillXP(creature.Object, SkillType.ForceControl, recovery * 2);
            }
        }
Beispiel #4
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            NWPlayer player               = (user.Object);
            var      effectiveStats       = PlayerStatService.GetPlayerItemEffectiveStats(player);
            int      rank                 = SkillService.GetPCSkillRank(player, SkillType.Medicine);
            int      luck                 = PerkService.GetCreaturePerkLevel(player, PerkType.Lucky);
            int      perkDurationBonus    = PerkService.GetCreaturePerkLevel(player, PerkType.HealingKitExpert) * 6 + (luck * 2);
            float    duration             = 30.0f + (rank * 0.4f) + perkDurationBonus + effectiveStats.Medicine;
            int      restoreAmount        = 1 + item.GetLocalInt("HEALING_BONUS") + (rank / 10);
            int      delta                = item.RecommendedLevel - rank;
            float    effectivenessPercent = 1.0f;

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

            restoreAmount = (int)(restoreAmount * effectivenessPercent) + item.MedicineBonus;

            int perkBlastBonus = PerkService.GetCreaturePerkLevel(player, PerkType.ImmediateForcePack);

            if (perkBlastBonus > 0)
            {
                int blastHeal = restoreAmount * perkBlastBonus;
                if (RandomService.Random(100) + 1 <= luck / 2)
                {
                    blastHeal *= 2;
                }

                AbilityService.RestorePlayerFP(target.Object, blastHeal);
            }

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

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

            string data = (int)interval + ", " + restoreAmount;

            CustomEffectService.ApplyCustomEffect(user, target.Object, CustomEffectType.ForcePack, (int)duration, restoreAmount, data);

            player.SendMessage("You successfully apply a force pack to " + target.Name + ". The force pack will expire in " + duration + " seconds.");

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

            int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(300, item.RecommendedLevel, rank);

            SkillService.GiveSkillXP(player, SkillType.Medicine, xp);
        }
Beispiel #5
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            string[] split    = data.Split(',');
            int      interval = Convert.ToInt32(split[0]);
            int      amount   = Convert.ToInt32(split[1]);

            if (currentTick % interval != 0)
            {
                return;
            }

            AbilityService.RestorePlayerFP(oTarget.Object, amount);
        }
Beispiel #6
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            AbilityService.EndConcentrationEffect(oCaster);

            NWPlayer player       = oTarget.Object;
            int      meditateTick = oTarget.GetLocalInt("MEDITATE_TICK") + 1;

            // Pull original position from data
            string[] values           = data.Split(',');
            Vector   originalPosition = _.Vector
                                        (
                Convert.ToSingle(values[0]),
                Convert.ToSingle(values[1]),
                Convert.ToSingle(values[2])
                                        );

            // Check position
            Vector position = player.Position;

            if ((Math.Abs(position.X - originalPosition.X) > 0.01f ||
                 Math.Abs(position.Y - originalPosition.Y) > 0.01f ||
                 Math.Abs(position.Z - originalPosition.Z) > 0.01f) ||
                !CanMeditate(player) ||
                !player.IsValid)
            {
                player.IsBusy = false;
                CustomEffectService.RemovePCCustomEffect(player, CustomEffectType.Meditate);
                return;
            }

            player.IsBusy = true;

            player.AssignCommand(() =>
            {
                _.ActionPlayAnimation(Animation.LoopingMeditate, 1.0f, 6.1f);
            });

            if (meditateTick >= 6)
            {
                int amount = CalculateAmount(player);

                AbilityService.RestorePlayerFP(player, amount);
                Effect vfx = _.EffectVisualEffect(VisualEffect.Vfx_Imp_Head_Mind);
                _.ApplyEffectToObject(DurationType.Instant, vfx, player);
                meditateTick = 0;
            }

            oTarget.SetLocalInt("MEDITATE_TICK", meditateTick);
        }