Exemplo n.º 1
0
        public void OnImpact(NWPlayer player, NWObject target, int level, int spellFeatID)
        {
            int ticks;
            var spread = CustomEffectService.GetForceSpreadDetails(player);

            switch (level)
            {
            default:
                ticks = 300;
                break;

            case 5:
            case 6:
                ticks = 600;
                break;
            }

            int itemPotency  = CombatService.CalculateItemPotencyBonus(player.Object, ForceAbilityType.Light);
            int basePotency  = (int)(player.Wisdom + player.Intelligence * 0.5f + player.Charisma * 0.25f);
            int finalPotency = itemPotency + basePotency;

            ticks += finalPotency * 10; // +10 seconds per potency


            // Force Spread isn't active. This is a single target cast.
            if (spread.Level <= 0)
            {
                CustomEffectService.ApplyCustomEffect(player, target.Object, CustomEffectType.ForceAura, ticks, level, null);
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_IMP_AC_BONUS), target);
            }
            // Force Spread is active. Target nearby party members.
            else
            {
                spread.Uses--;
                var members = player.PartyMembers.Where(x => _.GetDistanceBetween(x, target) <= spread.Range ||
                                                        Equals(x, target));

                foreach (var member in members)
                {
                    CustomEffectService.ApplyCustomEffect(member, target.Object, CustomEffectType.ForceAura, ticks, level, null);
                    _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_IMP_AC_BONUS), member);
                }

                _.PlaySound("v_pro_frcaura");
                CustomEffectService.SetForceSpreadUses(player, spread.Uses);
                SkillService.RegisterPCToAllCombatTargetsForSkill(player, SkillType.ForceUtility, null);
            }

            SkillService.RegisterPCToAllCombatTargetsForSkill(player, SkillType.ForceSupport, null);
        }