Beispiel #1
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);
                }
            }
        }
Beispiel #2
0
        private void DoDiceRoll(NWPlayer user, int sides, int number)
        {
            int value;

            if (number < 1)
            {
                number = 1;
            }
            else if (number > 10)
            {
                number = 10;
            }

            switch (sides)
            {
            case 2:
                value = RandomService.D2(number);
                break;

            case 4:
                value = RandomService.D4(number);
                break;

            case 6:
                value = RandomService.D6(number);
                break;

            case 8:
                value = RandomService.D8(number);
                break;

            case 10:
                value = RandomService.D10(number);
                break;

            case 20:
                value = RandomService.D20(number);
                break;

            case 100:
                value = RandomService.D100(number);
                break;

            default:
                value = 0;
                break;
            }

            string dieRoll = number + "d" + sides;
            string message = ColorTokenService.SkillCheck("Dice Roll: ") + dieRoll + ": " + value;

            user.SpeakString(message);
        }
Beispiel #3
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            int hp = user.MaxHP;

            // Restores HP to max
            ApplyEffectToObject(DurationType.Instant, EffectHeal(hp), user);

            // But reduces one random attribute by 50 for 2 minutes.
            int stat   = RandomService.D6(1) - 1;
            var effect = EffectAbilityDecrease(stat, 50);

            ApplyEffectToObject(DurationType.Temporary, effect, user, 120f);
        }
Beispiel #4
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            int   damage;
            float length;

            switch (perkLevel)
            {
            case 1:
                damage = RandomService.D4(1);
                length = 6.0f;
                break;

            case 2:
                damage = RandomService.D4(2);
                length = 6.0f;
                break;

            case 3:
                damage = RandomService.D6(2);
                length = 6.0f;
                break;

            case 4:
                damage = RandomService.D6(2);
                length = 9.0f;
                break;

            case 5:
                damage = RandomService.D6(3);
                length = 9.0f;
                break;

            case 6:
                damage = RandomService.D8(3);
                length = 9.0f;
                break;

            default: return;
            }

            _.ApplyEffectToObject(DurationType.Temporary, AbilityService.EffectKnockdown(target, length), target.Object, length);
            _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage, DamageType.Bludgeoning), target);
        }
Beispiel #5
0
        public void OnImpact(NWPlayer player, NWObject target, int perkLevel, int spellFeatID)
        {
            int   damage;
            float length;

            switch (perkLevel)
            {
            case 1:
                damage = RandomService.D4(1);
                length = 6.0f;
                break;

            case 2:
                damage = RandomService.D4(2);
                length = 6.0f;
                break;

            case 3:
                damage = RandomService.D6(2);
                length = 6.0f;
                break;

            case 4:
                damage = RandomService.D6(2);
                length = 9.0f;
                break;

            case 5:
                damage = RandomService.D6(3);
                length = 9.0f;
                break;

            case 6:
                damage = RandomService.D8(3);
                length = 9.0f;
                break;

            default: return;
            }

            _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectKnockdown(), target.Object, length);
            _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_BLUDGEONING), target);
        }
Beispiel #6
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);
                }
            }
        }
Beispiel #7
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            DateTime now            = DateTime.UtcNow;
            DateTime unlockDateTime = now;

            if (string.IsNullOrWhiteSpace(GetLocalString(user, "GRENADE_UNLOCKTIME")))
            {
                unlockDateTime = unlockDateTime.AddSeconds(-1);
            }
            else
            {
                unlockDateTime = DateTime.ParseExact(GetLocalString(user, "GRENADE_UNLOCKTIME"), "yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture);
            }
            //Console.WriteLine("IsValidTarget - Current Time = " + now.ToString("yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture));
            //Console.WriteLine("IsValidTarget - Unlocktime = " + unlockDateTime.ToString("yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture));
            //Console.WriteLine("IsValidTarget - DateTime.Compare = " + DateTime.Compare(unlockDateTime, now));

            // Check if we've passed the unlock date. Exit early if we have not.
            if (DateTime.Compare(unlockDateTime, now) > 0 || unlockDateTime > now)
            {
                string timeToWait = TimeService.GetTimeToWaitLongIntervals(now, unlockDateTime, false);
                //Console.WriteLine("IsValidTarget - That ability can be used in " + timeToWait + ".");
                SendMessageToPC(user, "That ability can be used in " + timeToWait + ".");
                return;
            }

            Effect impactEffect = null;
            var    spellId      = Spell.Invalid;
            string soundName    = null;
            int    perkLevel    = 1 + PerkService.GetCreaturePerkLevel(user, PerkType.GrenadeProficiency);
            int    skillLevel   = 5 + SkillService.GetPCSkillRank((NWPlayer)user, SkillType.Throwing);

            if (perkLevel == 0)
            {
                perkLevel += 1;
            }

            if (GetIsObjectValid(target) == true)
            {
                targetLocation = GetLocation(target);
            }
            string grenadeType = item.GetLocalString("TYPE");
            //Console.WriteLine("Throwing " + grenadeType + " grenade at perk level " + perkLevel);
            Location originalLocation = targetLocation;

            int roll = RandomService.D100(1);

            SendMessageToPC(user, roll + " vs. DC " + (100 - skillLevel));
            if (roll < (100 - skillLevel))
            {
                if (RandomService.D20(1) == 1)
                {
                    SendMessageToPC(user, "You threw... poorly.");
                    //targetLocation = VectorService.MoveLocation(targetLocation, GetFacing(user), (RandomService.D6(4) - 10) * 1.0f,
                    targetLocation = VectorService.MoveLocation(user.Location, RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1) + 60, RandomService.D4(2) * 1.0f,
                                                                RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1));
                    int count = 0;
                    while ((GetSurfaceMaterial(targetLocation) == 0 ||
                            LineOfSightVector(GetPositionFromLocation(targetLocation), GetPosition(user)) == false) &&
                           count < 10)
                    {
                        count         += 1;
                        targetLocation = VectorService.MoveLocation(user.Location, RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1) + 60, RandomService.D4(2) * 1.0f,
                                                                    RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1));
                    }
                }
                else
                {
                    SendMessageToPC(user, "Your throw was a bit off the mark.");
                    //targetLocation = VectorService.MoveLocation(targetLocation, GetFacing(user), (RandomService.D6(4) - 10) * 1.0f,
                    targetLocation = VectorService.MoveLocation(targetLocation, RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1) + 60, RandomService.D4(2) /*(RandomService.D6(4) - 10) */ * 1.0f,
                                                                RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1));
                    int count = 0;
                    while ((GetSurfaceMaterial(targetLocation) == 0 ||
                            LineOfSightVector(GetPositionFromLocation(targetLocation), GetPosition(user)) == false) &&
                           count < 10)
                    {
                        count         += 1;
                        targetLocation = VectorService.MoveLocation(targetLocation, RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1) + 60, RandomService.D4(2) /*(RandomService.D6(4) - 10) */ * 1.0f,
                                                                    RandomService.D100(1) + RandomService.D100(1) + RandomService.D100(1));
                    }
                }

                if (GetSurfaceMaterial(targetLocation) == 0 ||
                    LineOfSightVector(GetPositionFromLocation(targetLocation), GetPosition(user)) == false)
                {
                    targetLocation = originalLocation;
                }
            }

            switch (grenadeType)
            {
            case "FRAG":
                impactEffect = EffectVisualEffect(VisualEffect.Fnf_Fireball);
                // force a specific spell id (for projectile model) for this grenade.
                spellId   = Spell.Grenade10;
                soundName = "explosion2";
                break;

            case "CONCUSSION":
                impactEffect = EffectVisualEffect(VisualEffect.Vfx_Fnf_Sound_Burst_Silent);
                impactEffect = EffectLinkEffects(EffectVisualEffect(VisualEffect.Vfx_Fnf_Screen_Shake), impactEffect);
                spellId      = Spell.Grenade10;
                soundName    = "explosion1";
                break;

            case "FLASHBANG":
                impactEffect = EffectVisualEffect(VisualEffect.Vfx_Fnf_Mystical_Explosion);
                spellId      = Spell.Grenade10;
                soundName    = "explosion1";
                break;

            case "ION":
                impactEffect = EffectVisualEffect(VisualEffect.Vfx_Fnf_Electric_Explosion);
                spellId      = Spell.Grenade10;
                soundName    = "explosion1";
                break;

            case "BACTA":
                impactEffect = EffectVisualEffect(VisualEffect.Vfx_Fnf_Gas_Explosion_Nature);
                spellId      = Spell.Grenade10;
                //soundName = "explosion1";
                break;

            case "ADHESIVE":
                impactEffect = EffectVisualEffect(VisualEffect.Fnf_Dispel_Greater);
                spellId      = Spell.Grenade10;
                //soundName = "explosion1";
                break;

            case "SMOKE":
                impactEffect = null;
                spellId      = Spell.Grenade10;
                //soundName = "explosion1";
                break;

            case "BACTABOMB":
                impactEffect = null;
                spellId      = Spell.Grenade10;
                //soundName = "explosion1";
                break;

            case "INCENDIARY":
                impactEffect = null;
                spellId      = Spell.Grenade10;
                //soundName = "explosion1";
                break;

            case "GAS":
                impactEffect = null;
                spellId      = Spell.Grenade10;
                //soundName = "explosion1";
                break;

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

            if (spellId == 0)
            {
                // start 974 through 979 in spells.2da for grenades
                // lets randomly assign a projectile appearance for flavor?
                spellId = (Spell)(RandomService.D6(1) + 973);
            }

            float delay = GetDistanceBetweenLocations(user.Location, targetLocation) / 18.0f + 0.75f;

            delay += 0.4f; // added for animation
            user.ClearAllActions();
            //user.AssignCommand(() => _.ActionPlayAnimation(32));
            //user.DelayAssignCommand(() => _.ActionPlayAnimation(32), 0.0f);
            user.AssignCommand(() =>
            {
                ActionPlayAnimation(Animation.LoopingCustom12);
                ActionCastSpellAtLocation(spellId, targetLocation, MetaMagic.Any, true, ProjectilePathType.Ballistic, true);
                //ActionCastFakeSpellAtLocation(spellId, targetLocation, PROJECTILE_PATH_TYPE_BALLISTIC);
            });

            if (soundName != null)
            {
                user.DelayAssignCommand(() =>
                {
                    PlaySound(soundName);
                }, delay);
            }

            if (impactEffect != null)
            {
                user.DelayAssignCommand(() =>
                {
                    ApplyEffectAtLocation(DurationType.Instant, impactEffect, targetLocation);
                }, delay);
            }

            user.DelayAssignCommand(
                () =>
            {
                DoImpact(user, item, targetLocation, grenadeType, perkLevel, RadiusSize.Large, ObjectType.Creature);
            }, delay + 0.75f);


            perkLevel = PerkService.GetCreaturePerkLevel(user, PerkType.GrenadeProficiency);

            now = DateTime.UtcNow;
            DateTime unlockTime = now;

            if (perkLevel < 5)
            {
                unlockTime = unlockTime.AddSeconds(6);
            }
            else if (perkLevel < 10)
            {
                unlockTime = unlockTime.AddSeconds(3);
            }
            else
            {
                unlockTime = unlockTime.AddSeconds(2);
            }

            SetLocalString(user, "GRENADE_UNLOCKTIME", unlockTime.ToString("yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture));
            //Console.WriteLine("StartUseItem - Current Time = " + now.ToString("yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture));
            //Console.WriteLine("StartUseItem - Unlocktime Set To = " + unlockTime.ToString("yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture));
            if (user.IsCreature)
            {
                DurabilityService.RunItemDecay((NWPlayer)user, item, 1.0f);
            }
        }
Beispiel #8
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));
            }
        }
Beispiel #9
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);
        }
Beispiel #10
0
        public void OnImpact(NWPlayer player, NWObject target, int perkLevel, int spellFeatID)
        {
            int   damage   = 0;
            float duration = 0.0f;

            switch (perkLevel)
            {
            case 1:
                damage   = RandomService.D4(1);
                duration = 6;
                break;

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

            case 3:
                damage   = RandomService.D4(2);
                duration = 9;
                break;

            case 4:
                damage   = RandomService.D8(2);
                duration = 9;
                break;

            case 5:
                damage   = RandomService.D8(2);
                duration = 12;
                break;

            case 6:
                damage   = RandomService.D6(3);
                duration = 15;
                break;

            case 7:
                damage   = RandomService.D8(3);
                duration = 15;
                break;

            case 8:
                damage   = RandomService.D8(3);
                duration = 18;
                break;

            case 9:
                damage   = RandomService.D8(4);
                duration = 18;
                break;

            case 10:
                damage   = RandomService.D8(4);
                duration = 21;
                break;
            }

            _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_SLASHING), target);
            _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectACDecrease(3), target, duration);
            _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_IMP_HEAD_EVIL), target);

            player.SendMessage("Your target's armor has been breached.");
        }
Beispiel #11
0
        private void BuildSideDeck(NWObject player)
        {
            NWItem     collection  = player.GetLocalObject("ACTIVE_COLLECTION");
            List <int> deckToBuild = new List <int>(4);
            List <int> playerDeck  = new List <int>(10);

            int random;

            if (collection.IsValid)
            {
                // We have a player with a real deck.  Build the list and select 4 random cards from it.
                for (int ii = 1; ii <= 10; ii++)
                {
                    playerDeck.Add(PazaakService.GetCardInCollection(PazaakService.GetCardInDeck(ii, collection), collection));
                }
            }
            else
            {
                // This is an NPC.  Give them a deck with 6 random + cards, 3-4 random - cards and 0-1 random wild card.
                // See PazaakCard.cs for values.
                if (RandomService.D6(1) == 6)
                {
                    playerDeck.Add(RandomService.D6(1));
                    playerDeck.Add(RandomService.D6(1));
                    playerDeck.Add(RandomService.D6(1));
                    playerDeck.Add(RandomService.D6(1));
                    playerDeck.Add(RandomService.D6(1));
                    playerDeck.Add(RandomService.D6(1));

                    playerDeck.Add(RandomService.D6(1) * -1);
                    playerDeck.Add(RandomService.D6(1) * -1);
                    playerDeck.Add(RandomService.D6(1) * -1);

                    playerDeck.Add(RandomService.D6(1) + 100);
                }
                else
                {
                    playerDeck.Add(RandomService.D6(1));
                    playerDeck.Add(RandomService.D6(1));
                    playerDeck.Add(RandomService.D6(1));
                    playerDeck.Add(RandomService.D6(1));
                    playerDeck.Add(RandomService.D6(1));
                    playerDeck.Add(RandomService.D6(1));

                    playerDeck.Add(RandomService.D6(1) * -1);
                    playerDeck.Add(RandomService.D6(1) * -1);
                    playerDeck.Add(RandomService.D6(1) * -1);
                    playerDeck.Add(RandomService.D6(1) * -1);
                }
            }

            random = RandomService.Random(10);
            deckToBuild.Add(playerDeck[random]);
            playerDeck.Remove(random);

            random = RandomService.Random(9);
            deckToBuild.Add(playerDeck[random]);
            playerDeck.Remove(random);

            random = RandomService.Random(8);
            deckToBuild.Add(playerDeck[random]);
            playerDeck.Remove(random);

            random = RandomService.Random(7);
            deckToBuild.Add(playerDeck[random]);
            playerDeck.Remove(random);

            if (player1 == player)
            {
                player1SideDeck = deckToBuild;
            }
            else
            {
                player2SideDeck = deckToBuild;
            }
        }
Beispiel #12
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));
            }
        }
Beispiel #13
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            int   damage   = 0;
            float duration = 0.0f;

            switch (perkLevel)
            {
            case 1:
                damage   = RandomService.D4(1);
                duration = 6;
                break;

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

            case 3:
                damage   = RandomService.D4(2);
                duration = 9;
                break;

            case 4:
                damage   = RandomService.D8(2);
                duration = 9;
                break;

            case 5:
                damage   = RandomService.D8(2);
                duration = 12;
                break;

            case 6:
                damage   = RandomService.D6(3);
                duration = 15;
                break;

            case 7:
                damage   = RandomService.D8(3);
                duration = 15;
                break;

            case 8:
                damage   = RandomService.D8(3);
                duration = 18;
                break;

            case 9:
                damage   = RandomService.D8(4);
                duration = 18;
                break;

            case 10:
                damage   = RandomService.D8(4);
                duration = 21;
                break;
            }

            _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage, DamageType.Slashing), target);
            _.ApplyEffectToObject(DurationType.Temporary, _.EffectACDecrease(3), target, duration);
            _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Head_Evil), target);

            creature.SendMessage("Your target's armor has been breached.");
        }