예제 #1
0
        public void OnConcentrationTick(NWCreature creature, NWObject target, int spellTier, int tick)
        {
            int amount;

            switch (spellTier)
            {
            case 1:
                amount = 5;
                break;

            case 2:
                amount = 6;
                break;

            case 3:
                amount = 7;
                break;

            case 4:
                amount = 8;
                break;

            case 5:
                amount = 10;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Dark);

            // +/- percent change based on resistance
            float delta = 0.01f * result.Delta;

            amount = amount + (int)(amount * delta);

            if (target.GetLocalInt("FORCE_DRAIN_IMMUNITY") == 1)
            {
                amount = 0;
            }

            creature.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(amount, DamageType.Negative), target);
            });

            // Only apply a heal if caster is not at max HP. Otherwise they'll get unnecessary spam.
            if (creature.CurrentHP < creature.MaxHP)
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectHeal(amount), creature);
            }

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }

            _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Com_Hit_Negative), target);
        }
예제 #2
0
        private void ApplyEffect(NWCreature creature, NWObject target, int spellTier)
        {
            float radiusSize = _.RADIUS_SIZE_SMALL;

            Effect confusionEffect = _.EffectConfused();

            // Handle effects for differing spellTier values
            switch (spellTier)
            {
            case 1:
                if ((creature.Wisdom > _.GetAbilityModifier(_.ABILITY_WISDOM, target) || creature == target) && _.GetDistanceBetween(creature.Object, target) <= radiusSize)
                {
                    creature.AssignCommand(() =>
                    {
                        _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, confusionEffect, target, 6.1f);
                        // Play VFX
                        _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_IMP_CONFUSION_S), target);
                    });
                    if (creature.IsPlayer)
                    {
                        SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
                    }
                }
                break;

            case 2:
                NWCreature targetCreature = _.GetFirstObjectInShape(_.SHAPE_SPHERE, radiusSize, creature.Location, 1, _.OBJECT_TYPE_CREATURE);
                while (targetCreature.IsValid)
                {
                    if (targetCreature.RacialType == (int)CustomRaceType.Robot || _.GetIsReactionTypeHostile(targetCreature, creature) == 0)
                    {
                        // Do nothing against droids or non-hostile creatures, skip object
                        targetCreature = _.GetNextObjectInShape(_.SHAPE_SPHERE, radiusSize, creature.Location, 1, _.OBJECT_TYPE_CREATURE);
                        continue;
                    }

                    if (creature.Wisdom > targetCreature.Wisdom)
                    {
                        var targetCreatureCopy = targetCreature;     // Closure can modify the iteration variable so we copy it first.
                        creature.AssignCommand(() =>
                        {
                            _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, confusionEffect, targetCreatureCopy, 6.1f);
                            // Play VFX
                            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_IMP_CONFUSION_S), targetCreatureCopy);
                        });

                        if (creature.IsPlayer)
                        {
                            SkillService.RegisterPCToNPCForSkill(creature.Object, targetCreature, SkillType.ForceAlter);
                        }
                    }

                    targetCreature = _.GetNextObjectInShape(_.SHAPE_SPHERE, radiusSize, creature.Location, 1, _.OBJECT_TYPE_CREATURE);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }
        }
예제 #3
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            int damage;
            int intMod = creature.IntelligenceModifier;

            switch (spellTier)
            {
            case 1:
                damage = 10 + intMod;
                break;

            case 2:
                damage = 15 + intMod;
                break;

            case 3:
                damage = 20 + ((intMod * 15) / 10);
                break;

            case 4:
                damage = 25 + ((intMod * 17) / 10);
                break;

            case 5:
                damage = 30 + (intMod * 2);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Universal, true);

            // +/- percent change based on resistance
            float delta = 0.01f * result.Delta;

            damage = damage + (int)(damage * delta);
            var targetLocation = _.GetLocation(creature);
            var delay          = _.GetDistanceBetweenLocations(creature.Location, targetLocation) / 18.0f + 0.35f;

            creature.AssignCommand(() =>
            {
                _.PlaySound("plr_force_blast");
                DoFireball(target);
            });

            creature.DelayAssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage), target);
                _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Silence), target);
                _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.VFX_IMP_KIN_L), target);
            }, delay);


            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }
        }
예제 #4
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            int damage;
            int mod = creature.WisdomModifier;

            switch (spellTier)
            {
            case 1:
                damage = 5 + mod;
                break;

            case 2:
                damage = 10 + ((mod * 125) / 100);
                break;

            case 3:
                damage = 10 + ((mod * 15) / 10);
                break;

            case 4:
                damage = 15 + ((mod * 175) / 100);
                break;

            case 5:
                damage = 15 + (mod * 2);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Universal, true);

            // +/- percent change based on resistance
            var delta = 0.01f * result.Delta;

            damage = damage + (int)(damage * delta);
            var targetLocation = _.GetLocation(creature);
            var delay          = _.GetDistanceBetweenLocations(creature.Location, targetLocation) / 18.0f + 0.35f;

            creature.AssignCommand(() =>
            {
                DoRock(target);
                _.PlaySound("plr_force_throw");
            });

            creature.DelayAssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage, DamageType.Bludgeoning), target);
                _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Dust_Explosion), target);
            }, delay);

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }
        }
예제 #5
0
        public static void grenadeAoe(NWObject oTarget, string grenadeType)
        {
            if (oTarget.ObjectType != ObjectType.Creature)
            {
                return;
            }
            NWCreature user           = GetAreaOfEffectCreator(_.OBJECT_SELF);
            int        perkLevel      = PerkService.GetCreaturePerkLevel(user, PerkType.GrenadeProficiency);
            int        duration       = 1;
            Effect     impactEffect   = null;
            Effect     durationEffect = null;

            //Console.WriteLine("In grenadeAoe for grenade type " + grenadeType + " on " + GetName(oTarget));

            switch (grenadeType)
            {
            case "SMOKE":
                durationEffect = EffectInvisibility(InvisibilityType.Normal);
                break;

            case "BACTABOMB":
                durationEffect = EffectRegenerate(perkLevel * 2 + 1, 6.0f);
                break;

            case "INCENDIARY":
                impactEffect = EffectDamage(perkLevel + 1 + RandomService.D6(perkLevel), DamageType.Fire);
                duration     = RandomService.D6(1);
                break;

            case "GAS":
                impactEffect = EffectDamage(perkLevel + 1 + RandomService.D6(perkLevel), DamageType.Acid);
                duration     = RandomService.D6(1);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(grenadeType));
            }

            if (GetIsObjectValid(oTarget) == true)
            {
                if (impactEffect != null)
                {
                    ApplyEffectToObject(DurationType.Instant, impactEffect, oTarget);
                }
                if (durationEffect != null)
                {
                    ApplyEffectToObject(DurationType.Temporary, durationEffect, oTarget, duration * 6.0f);
                }
                if (!oTarget.IsPlayer)
                {
                    SkillService.RegisterPCToNPCForSkill(user.Object, oTarget, SkillType.Throwing);
                }
            }
        }
예제 #6
0
        public void OnConcentrationTick(NWCreature creature, NWObject target, int spellTier, int tick)
        {
            int amount;
            int mod = ((creature.WisdomModifier + creature.IntelligenceModifier) / 2);

            switch (spellTier)
            {
            case 1:
                amount = 2 + mod;
                break;

            case 2:
                amount = 3 + mod;
                break;

            case 3:
                amount = 4 + mod;
                break;

            case 4:
                amount = 5 + mod;
                break;

            case 5:
                amount = 6 + mod;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Dark);

            // +/- percent change based on resistance
            float delta = 0.01f * result.Delta;

            amount = amount + (int)(amount * delta);


            creature.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(amount, DamageType.Bludgeoning), target);
            });

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }
            _.PlaySound("plr_force_choke");
            _.ApplyEffectToObject(DurationType.Temporary, _.EffectVisualEffect(VisualEffect.Vfx_Fnf_Demon_Hand), target, 6.1f);
            _.ApplyEffectToObject(DurationType.Temporary, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Starburst_Red), target, 6.1f);
        }
예제 #7
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            int damage;
            int intMod = creature.IntelligenceModifier;

            switch (spellTier)
            {
            case 1:
                damage = 10 + intMod;
                break;

            case 2:
                damage = 15 + intMod;
                break;

            case 3:
                damage = 20 + ((intMod * 15) / 10);
                break;

            case 4:
                damage = 25 + ((intMod * 17) / 10);
                break;

            case 5:
                damage = 30 + (intMod * 2);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Dark, true);

            // +/- percent change based on resistance
            float delta = 0.01f * result.Delta;

            damage = damage + (int)(damage * delta);

            creature.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage), target);
            });

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }

            _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Silence), target);
        }
예제 #8
0
        public void OnConcentrationTick(NWCreature creature, NWObject target, int spellTier, int tick)
        {
            int amount;

            switch (spellTier)
            {
            case 1:
                amount = 2 + (int)(creature.IntelligenceModifier);
                break;

            case 2:
                amount = 4 + (int)(creature.IntelligenceModifier * 1.15);
                break;

            case 3:
                amount = 6 + (int)(creature.IntelligenceModifier * 1.25);
                break;

            case 4:
                amount = 8 + (int)(creature.IntelligenceModifier * 1.5);
                break;

            case 5:
                amount = 10 + (int)(creature.IntelligenceModifier * 2);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Dark);

            // +/- percent change based on resistance
            float delta = 0.01f * result.Delta;

            amount = amount + (int)(amount * delta);

            creature.AssignCommand(() =>
            {
                _.PlaySound("plr_force_lightn");
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(amount, DamageType.Electrical), target);
                _.ApplyEffectToObject(DurationType.Temporary, _.EffectBeam(VisualEffect.Vfx_Beam_Silent_Lightning, creature, BodyNode.Hand), target, 1.0F);
            });

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }
        }
예제 #9
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            int damage;

            switch (spellTier)
            {
            case 1:
                damage = 100;
                break;

            case 2:
                damage = 125;
                break;

            case 3:
                damage = 160;
                break;

            case 4:
                damage = 200;
                break;

            case 5:
                damage = 250;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Dark, true);

            // +/- percent change based on resistance
            float delta = 0.01f * result.Delta;

            damage = damage + (int)(damage * delta);

            creature.AssignCommand(() =>
            {
                _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectDamage(damage), target);
            });

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }

            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_IMP_SILENCE), target);
        }
예제 #10
0
        public void OnConcentrationTick(NWCreature creature, NWObject target, int spellTier, int tick)
        {
            int amount;

            switch (spellTier)
            {
            case 1:
                amount = 10;
                break;

            case 2:
                amount = 12;
                break;

            case 3:
                amount = 14;
                break;

            case 4:
                amount = 16;
                break;

            case 5:
                amount = 20;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Dark);

            // +/- percent change based on resistance
            float delta = 0.01f * result.Delta;

            amount = amount + (int)(amount * delta);

            creature.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(amount, DamageType.Electrical), target);
            });

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }

            _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Lightning_S), target);
        }
예제 #11
0
        private void RunEffect(NWCreature creature, NWObject target)
        {
            var concentrationEffect = AbilityService.GetActiveConcentrationEffect(target.Object);

            if (concentrationEffect.Type == PerkType.MindShield)
            {
                creature.SendMessage("Your target is immune to tranquilization effects.");
                return;
            }

            AbilityResistanceResult result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Dark);

            // Tranquilization effect - Daze target(s). Occurs on succeeding the DC check.
            Effect successEffect = EffectDazed();

            successEffect = EffectLinkEffects(successEffect, EffectVisualEffect(VisualEffect.Vfx_Dur_Iounstone_Blue));
            successEffect = TagEffect(successEffect, "TRANQUILIZER_EFFECT");

            // AC & AB decrease effect - Occurs on failing the DC check.
            Effect failureEffect = EffectLinkEffects(EffectAttackDecrease(5), EffectACDecrease(5));



            if (!result.IsResisted)
            {
                creature.AssignCommand(() =>
                {
                    ApplyEffectToObject(DurationType.Temporary, successEffect, target, 6.1f);
                });
            }
            else
            {
                creature.AssignCommand(() =>
                {
                    ApplyEffectToObject(DurationType.Temporary, failureEffect, target, 6.1f);
                });
            }

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }

            EnmityService.AdjustEnmity(target.Object, creature, 1);
        }
예제 #12
0
        public void OnConcentrationTick(NWCreature creature, NWObject target, int spellTier, int tick)
        {
            int amount;

            switch (spellTier)
            {
            case 1:
                amount = 5;
                break;

            case 2:
                amount = 6;
                break;

            case 3:
                amount = 7;
                break;

            case 4:
                amount = 8;
                break;

            case 5:
                amount = 10;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Dark);

            // +/- percent change based on resistance
            float delta = 0.01f * result.Delta;

            amount = amount + (int)(amount * delta);

            if (target.GetLocalInt("FORCE_DRAIN_IMMUNITY") == 1)
            {
                amount = 0;
            }

            var targetLocation = _.GetLocation(creature);
            var delay          = _.GetDistanceBetweenLocations(creature.Location, targetLocation) / 18.0f + 0.35f;

            creature.AssignCommand(() =>
            {
                _.PlaySound("plr_force_absorb");
                _.ApplyEffectToObject(DurationType.Temporary, _.EffectBeam(VisualEffect.Vfx_Beam_Drain, target, BodyNode.Hand), creature, 2.0F);
                _.ApplyEffectToObject(DurationType.Temporary, _.EffectBeam(VisualEffect.Vfx_Beam_Drain, creature, BodyNode.Hand), target, 2.0F);
                _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Negative_Energy), target);
                _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Reduce_Ability_Score), target);
            });



            // Only apply a heal if caster is not at max HP. Otherwise they'll get unnecessary spam.
            if (creature.CurrentHP < creature.MaxHP)
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectHeal(amount), creature);
            }

            _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(amount, DamageType.Negative), target);

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
            }
        }
예제 #13
0
        public void DoImpact(NWCreature user, NWItem item, Location targetLocation, string grenadeType, int perkLevel, float fExplosionRadius, ObjectType nObjectFilter)
        {
            Effect damageEffect   = EffectDamage(0, DamageType.Negative);
            Effect durationEffect = null;
            int    duration       = perkLevel + 1;
            int    bonus          = item.DamageBonus;
            int    medbonus       = item.MedicineBonus;

            switch (grenadeType)
            {
            case "SMOKE":
                durationEffect = EffectAreaOfEffect(AreaOfEffect.FogOfBewilderment, "grenade_smoke_en", "grenade_smoke_hb", "");
                break;

            case "BACTABOMB":
                durationEffect = EffectAreaOfEffect(AreaOfEffect.FogMind, "grenade_bbomb_en", "grenade_bbomb_hb", "");
                break;

            case "INCENDIARY":
                durationEffect = EffectAreaOfEffect(AreaOfEffect.FogFire, "grenade_incen_en", "grenade_incen_hb", "");
                break;

            case "GAS":
                durationEffect = EffectAreaOfEffect(AreaOfEffect.FogAcid, "grenade_gas_en", "grenade_gas_hb", "");
                break;

            default:
                break;
            }

            if (durationEffect != null)
            {
                //Apply AOE
                ApplyEffectAtLocation(DurationType.Temporary, durationEffect, targetLocation, duration * 6.0f);
            }
            else
            {
                //Apply impact

                // Target the next nearest creature and do the same thing.
                NWObject targetCreature = GetFirstObjectInShape(Shape.Sphere, fExplosionRadius, targetLocation, true, nObjectFilter);
                while (targetCreature.IsValid)
                {
                    //Console.WriteLine("Grenade hit on " + targetCreature.Name);

                    switch (grenadeType)
                    {
                    case "FRAG":
                        damageEffect = EffectDamage(RandomService.D6(perkLevel) + bonus, DamageType.Fire);
                        damageEffect = EffectLinkEffects(EffectDamage(RandomService.D6(perkLevel) + bonus, DamageType.Piercing), damageEffect);
                        if (RandomService.D6(1) > 4)
                        {
                            //Console.WriteLine("grenade effect bleeding - frag");
                            CustomEffectService.ApplyCustomEffect(user, targetCreature.Object, CustomEffectType.Bleeding, duration * 6, perkLevel, Convert.ToString(perkLevel));
                        }
                        if (RandomService.D6(1) > 4)
                        {
                            //Console.WriteLine("grenade effects burning - frag");
                            CustomEffectService.ApplyCustomEffect(user, targetCreature.Object, CustomEffectType.Burning, duration * 6, perkLevel, Convert.ToString(perkLevel));
                        }
                        //Console.WriteLine("grenade effects set - frag");
                        break;

                    case "CONCUSSION":
                        damageEffect   = EffectDamage(RandomService.D12(perkLevel) + bonus, DamageType.Sonic);
                        durationEffect = EffectDeaf();
                        if (RandomService.D6(1) > 4)
                        {
                            FloatingTextStringOnCreature("Your ears ring and your body shakes.", targetCreature);
                            durationEffect = EffectLinkEffects(AbilityService.EffectKnockdown(targetCreature, duration), durationEffect);
                        }
                        break;

                    case "FLASHBANG":
                        duration       = RandomService.D4(1);
                        durationEffect = EffectDeaf();
                        if (RandomService.D6(1) > 4)
                        {
                            FloatingTextStringOnCreature("Your vision blurs and blacks out.", targetCreature);
                            durationEffect = EffectLinkEffects(EffectBlindness(), durationEffect);
                        }
                        break;

                    case "ION":
                        duration     = RandomService.D4(1);
                        damageEffect = EffectDamage(RandomService.D6(perkLevel) + bonus, DamageType.Electrical);
                        if (GetRacialType(targetCreature) == RacialType.Robot ||
                            (RandomService.D6(1) > 4 && GetRacialType(targetCreature) == RacialType.Cyborg))
                        {
                            FloatingTextStringOnCreature("Your circuits are overloaded.", targetCreature);
                            durationEffect = EffectStunned();
                        }
                        break;

                    case "BACTA":
                        damageEffect   = null;
                        durationEffect = EffectRegenerate(perkLevel + 1 + medbonus, 6.0f);
                        break;

                    case "ADHESIVE":
                        durationEffect = EffectSlow();
                        if (RandomService.D6(1) > 4)
                        {
                            FloatingTextStringOnCreature("You are slowed by the adhesive explosion.", targetCreature);
                            durationEffect = EffectLinkEffects(EffectCutsceneImmobilize(), durationEffect);
                        }
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(grenadeType));
                    }

                    //Console.WriteLine("applying effects to " + GetName(targetCreature));

                    if (damageEffect != null)
                    {
                        ApplyEffectToObject(DurationType.Instant, damageEffect, targetCreature);
                    }
                    if (durationEffect != null)
                    {
                        ApplyEffectToObject(DurationType.Temporary, durationEffect, targetCreature, duration * 6.0f);
                    }

                    if (!targetCreature.IsPlayer)
                    {
                        SkillService.RegisterPCToNPCForSkill(user.Object, targetCreature, SkillType.Throwing);
                    }

                    targetCreature = GetNextObjectInShape(Shape.Sphere, fExplosionRadius, targetLocation, true, nObjectFilter);
                }
            }
        }
예제 #14
0
        public void OnImpact(NWCreature player, NWObject target, int perkLevel, int spellTier)
        {
            NWItem weapon = player.RightHand;
            int    iDamage;
            int    iRange = 15;
            int    iCount = 1;
            float  fDelay = 0;

            int saberDamage = player.RightHand.DamageBonus;

            if (saberDamage > 40)
            {
                saberDamage = 40;
            }

            if (weapon.CustomItemType == CustomItemType.Lightsaber ||
                weapon.CustomItemType == CustomItemType.Saberstaff)
            {
                iDamage = saberDamage + RandomService.D6(2) + player.StrengthModifier;
            }
            else
            {
                iDamage = (int)weapon.Weight + player.StrengthModifier + (saberDamage / 2);
            }

            NWObject oObject;

            // If player is in stealth mode, force them out of stealth mode.
            if (_.GetActionMode(player.Object, ActionMode.Stealth) == true)
            {
                _.SetActionMode(player.Object, ActionMode.Stealth, false);
            }

            // Make the player face their target.
            _.ClearAllActions();
            BiowarePosition.TurnToFaceObject(target, player);

            player.AssignCommand(() => _.ActionPlayAnimation(Animation.LoopingCustom10, 2));

            var   result = CombatService.CalculateAbilityResistance(player, target.Object, SkillType.ForceAlter, ForceBalanceType.Universal);
            float delta  = 0.01f * result.Delta;

            /*
             * // reset phenotype
             *  player.DelayAssignCommand(() =>
             *  {
             *      _.SetPhenoType(4, player);
             *  }, 2.0f);
             *
             *  player.DelayAssignCommand(() =>
             *  {
             *      _.SetPhenoType(iPheno, player);
             *  }, 2.5f);
             */

            // Handle effects for differing spellTier values
            switch (spellTier)
            {
            case 1:
                iDamage = (int)(iDamage * 1.0);
                iDamage = iDamage + (int)(iDamage * delta);

                fDelay = _.GetDistanceBetween(player, target) / 10.0f;

                player.DelayAssignCommand(() =>
                {
                    _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), target);
                }, fDelay);

                if (player.IsPlayer)
                {
                    SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter);
                }

                break;

            case 2:
                iDamage = (int)(iDamage * 1.25);
                iDamage = iDamage + (int)(iDamage * delta);

                fDelay = _.GetDistanceBetween(player, target) / 10.0f;

                player.DelayAssignCommand(() =>
                {
                    _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), target);
                }, fDelay);

                if (player.IsPlayer)
                {
                    SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter);
                }

                break;

            case 3:
                iDamage = (int)(iDamage * 1.5);
                iDamage = iDamage + (int)(iDamage * delta);

                fDelay = _.GetDistanceBetween(player, target) / 10.0f;

                player.DelayAssignCommand(() =>
                {
                    _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), target);
                }, fDelay);

                if (player.IsPlayer)
                {
                    SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter);
                }

                break;

            case 4:
                iDamage = (int)(iDamage * 1.6);
                iDamage = iDamage + (int)(iDamage * delta);

                // apply to target
                fDelay = _.GetDistanceBetween(player, target) / 10.0f;

                player.DelayAssignCommand(() =>
                {
                    _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), target);
                }, fDelay);

                if (player.IsPlayer)
                {
                    SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter);
                }

                iCount += 1;

                // apply to next nearest creature in the spellcylinder
                oObject = _.GetFirstObjectInShape(Shape.SpellCone, iRange, target.Location, true, ObjectType.Creature, _.GetPosition(player));
                while (oObject.IsValid && iCount < 3)
                {
                    if (oObject != target && oObject != player)
                    {
                        fDelay = _.GetDistanceBetween(player, oObject) / 10.0f;
                        var creature = oObject;
                        player.DelayAssignCommand(() =>
                        {
                            _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), creature);
                        }, fDelay);

                        if (player.IsPlayer)
                        {
                            SkillService.RegisterPCToNPCForSkill(player.Object, oObject, SkillType.ForceAlter);
                        }
                        iCount += 1;
                    }
                    oObject = _.GetNextObjectInShape(Shape.SpellCone, iRange, target.Location, true, ObjectType.Creature, _.GetPosition(player));
                }
                break;

            case 5:
                iDamage = (int)(iDamage * 1.75);
                iDamage = iDamage + (int)(iDamage * delta);

                // apply to target
                fDelay = _.GetDistanceBetween(player, target) / 10.0f;

                player.DelayAssignCommand(() =>
                {
                    _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), target);
                }, fDelay);

                if (player.IsPlayer)
                {
                    SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter);
                }
                iCount += 1;

                // apply to next nearest creature in the spellcylinder
                oObject = _.GetFirstObjectInShape(Shape.SpellCylinder, iRange, target.Location, true, ObjectType.Creature, _.GetPosition(player));
                while (oObject.IsValid && iCount < 4)
                {
                    if (oObject != target && oObject != player)
                    {
                        fDelay = _.GetDistanceBetween(player, oObject) / 10.0f;
                        var creature = oObject;
                        player.DelayAssignCommand(() =>
                        {
                            _.ApplyEffectToObject(DurationType.Instant, _.EffectLinkEffects(_.EffectVisualEffect(VisualEffect.Vfx_Imp_Sonic), _.EffectDamage(iDamage, DamageType.BaseWeapon)), creature);
                        }, fDelay);

                        if (player.IsPlayer)
                        {
                            SkillService.RegisterPCToNPCForSkill(player.Object, oObject, SkillType.ForceAlter);
                        }
                        iCount += 1;
                    }
                    oObject = _.GetNextObjectInShape(Shape.SpellCylinder, iRange, target.Location, true, ObjectType.Creature, _.GetPosition(player));
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }
        }
예제 #15
0
        public void OnImpact(NWPlayer player, NWObject target, int level, int spellFeatID)
        {
            float length;
            int   damage;

            switch (level)
            {
            case 1:
                damage = RandomService.D4(1);
                length = 3;
                break;

            case 2:
                damage = RandomService.D4(1);
                length = 6;
                break;

            case 3:
                damage = RandomService.D6(1);
                length = 6;
                break;

            case 4:
                damage = RandomService.D8(1);
                length = 6;
                break;

            case 5:
                damage = RandomService.D8(1);
                length = 9;
                break;

            default: return;
            }
            SkillService.RegisterPCToNPCForSkill(player, target, SkillType.ForceCombat);

            // Resistance affects length for this perk.
            ForceResistanceResult resistance = CombatService.CalculateResistanceRating(player, target.Object, ForceAbilityType.Mind);

            length = length * resistance.Amount;

            if (length <= 0.0f || resistance.Type != ResistanceType.Zero)
            {
                player.SendMessage("Your Force Push effect was resisted.");
                return;
            }

            var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player);
            int luck           = PerkService.GetPCPerkLevel(player, PerkType.Lucky) + effectiveStats.Luck;

            if (RandomService.Random(100) + 1 <= luck)
            {
                length = length * 2;
                player.SendMessage("Lucky force push!");
            }

            _.PlaySound("v_imp_frcpush");
            _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_POSITIVE), target);
            _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectKnockdown(), target, length);
            CombatService.AddTemporaryForceDefense(target.Object, ForceAbilityType.Light);
        }
예제 #16
0
        private void ApplyEffect(NWCreature creature, NWObject target, int spellTier)
        {
            float radiusSize = 10f;

            Effect confusionEffect = _.EffectCharmed();

            // Handle effects for differing spellTier values
            switch (spellTier)
            {
            case 1:
                if (creature == target || (creature.Wisdom > _.GetAbilityModifier(AbilityType.Wisdom, target) && _.GetDistanceBetween(creature.Object, target) <= radiusSize))
                {
                    creature.AssignCommand(() =>
                    {
                        _.ApplyEffectToObject(DurationType.Temporary, confusionEffect, target, 18.1f);
                        // Play VFX
                        _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Pdk_Final_Stand), target);
                        // Success confirmation
                        creature.SendMessage("Confusion successful.");
                    });
                    if (!creature.IsPlayer)
                    {
                        SkillService.RegisterPCToNPCForSkill(creature.Object, target, SkillType.ForceAlter);
                    }
                }
                else
                {
                    creature.SendMessage("Confusion failed.");
                }
                break;

            case 2:
                NWCreature targetCreature = _.GetFirstObjectInShape(Shape.Sphere, radiusSize, creature.Location, true, ObjectType.Creature);
                while (targetCreature.IsValid)
                {
                    if (targetCreature.RacialType == RacialType.Robot || _.GetIsReactionTypeHostile(targetCreature, creature) == false)
                    {
                        // Do nothing against droids or non-hostile creatures, skip object
                        targetCreature = _.GetNextObjectInShape(Shape.Sphere, radiusSize, creature.Location, true, ObjectType.Creature);
                        continue;
                    }

                    if (creature.Wisdom > targetCreature.Wisdom)
                    {
                        var targetCreatureCopy = targetCreature;     // Closure can modify the iteration variable so we copy it first.
                        creature.AssignCommand(() =>
                        {
                            _.ApplyEffectToObject(DurationType.Temporary, confusionEffect, targetCreatureCopy, 18.1f);
                            // Play VFX
                            _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Pdk_Final_Stand), targetCreatureCopy);
                            creature.SendMessage("Confusion successful.");
                        });

                        if (!creature.IsPlayer)
                        {
                            SkillService.RegisterPCToNPCForSkill(creature.Object, targetCreature, SkillType.ForceAlter);
                        }
                    }
                    else
                    {
                        creature.SendMessage("Confusion failed.");
                    }

                    targetCreature = _.GetNextObjectInShape(Shape.Sphere, radiusSize, creature.Location, true, ObjectType.Creature);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }
        }
예제 #17
0
        public void OnImpact(NWCreature player, NWObject target, int perkLevel, int spellTier)
        {
            NWItem weapon = player.RightHand;
            int    iDamage;
            int    iRange = 15;
            int    iCount = 1;
            float  fDelay = 0;

            if (weapon.CustomItemType == CustomItemType.Lightsaber ||
                weapon.CustomItemType == CustomItemType.Saberstaff)
            {
                iDamage = player.RightHand.DamageBonus + RandomService.D6(2) + player.IntelligenceModifier + player.StrengthModifier;
            }
            else
            {
                iDamage = (int)weapon.Weight + player.StrengthModifier;
            }

            NWObject oObject;

            // If player is in stealth mode, force them out of stealth mode.
            if (_.GetActionMode(player.Object, ACTION_MODE_STEALTH) == 1)
            {
                _.SetActionMode(player.Object, ACTION_MODE_STEALTH, 0);
            }

            // Make the player face their target.
            _.ClearAllActions();
            BiowarePosition.TurnToFaceObject(target, player);

            player.AssignCommand(() => _.ActionPlayAnimation(30, 2));

            _.SendMessageToPC(player, "Level " + spellTier);

            // Handle effects for differing spellTier values
            switch (spellTier)
            {
            case 1:
                iDamage = (int)(iDamage * 1.6);

                fDelay = _.GetDistanceBetween(player, target) / 10.0f;

                player.DelayAssignCommand(() =>
                {
                    _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), target);
                }, fDelay);

                if (player.IsPlayer)
                {
                    SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter);
                }

                break;

            case 2:
                iDamage = (int)(iDamage * 1.25);

                fDelay = _.GetDistanceBetween(player, target) / 10.0f;

                player.DelayAssignCommand(() =>
                {
                    _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), target);
                }, fDelay);

                if (player.IsPlayer)
                {
                    SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter);
                }

                break;

            case 3:
                iDamage = (int)(iDamage * 1.6);

                fDelay = _.GetDistanceBetween(player, target) / 10.0f;

                player.DelayAssignCommand(() =>
                {
                    _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), target);
                }, fDelay);

                if (player.IsPlayer)
                {
                    SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter);
                }

                break;

            case 4:
                iDamage = (int)(iDamage * 2.0);

                // apply to target
                fDelay = _.GetDistanceBetween(player, target) / 10.0f;

                player.DelayAssignCommand(() =>
                {
                    _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), target);
                }, fDelay);

                if (player.IsPlayer)
                {
                    SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter);
                }

                iCount += 1;

                // apply to next nearest creature in the spellcylinder
                oObject = _.GetFirstObjectInShape(_.SHAPE_SPELLCONE, iRange, target.Location, 1, _.OBJECT_TYPE_CREATURE, _.GetPosition(player));
                while (oObject.IsValid && iCount < 3)
                {
                    if (oObject != target && oObject != player)
                    {
                        fDelay = _.GetDistanceBetween(player, oObject) / 10.0f;
                        var creature = oObject;
                        player.DelayAssignCommand(() =>
                        {
                            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), creature);
                        }, fDelay);

                        if (player.IsPlayer)
                        {
                            SkillService.RegisterPCToNPCForSkill(player.Object, oObject, SkillType.ForceAlter);
                        }
                        iCount += 1;
                    }
                    oObject = _.GetNextObjectInShape(_.SHAPE_SPELLCONE, iRange, target.Location, 1, _.OBJECT_TYPE_CREATURE, _.GetPosition(player));
                }
                break;

            case 5:
                iDamage = (int)(iDamage * 2.5);

                // apply to target
                fDelay = _.GetDistanceBetween(player, target) / 10.0f;

                player.DelayAssignCommand(() =>
                {
                    _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), target);
                }, fDelay);

                if (player.IsPlayer)
                {
                    SkillService.RegisterPCToNPCForSkill(player.Object, target, SkillType.ForceAlter);
                }
                iCount += 1;

                // apply to next nearest creature in the spellcylinder
                oObject = _.GetFirstObjectInShape(_.SHAPE_SPELLCYLINDER, iRange, target.Location, 1, _.OBJECT_TYPE_CREATURE, _.GetPosition(player));
                while (oObject.IsValid && iCount < 4)
                {
                    if (oObject != target && oObject != player)
                    {
                        fDelay = _.GetDistanceBetween(player, oObject) / 10.0f;
                        var creature = oObject;
                        player.DelayAssignCommand(() =>
                        {
                            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectLinkEffects(_.EffectVisualEffect(VFX_IMP_SONIC), _.EffectDamage(iDamage, _.DAMAGE_TYPE_BASE_WEAPON)), creature);
                        }, fDelay);

                        if (player.IsPlayer)
                        {
                            SkillService.RegisterPCToNPCForSkill(player.Object, oObject, SkillType.ForceAlter);
                        }
                        iCount += 1;
                    }
                    oObject = _.GetNextObjectInShape(_.SHAPE_SPELLCYLINDER, iRange, target.Location, 1, _.OBJECT_TYPE_CREATURE, _.GetPosition(player));
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(spellTier));
            }
        }