コード例 #1
0
ファイル: LegShot.cs プロジェクト: NZNightwolf/SWLOR_NWN
        public void OnImpact(NWPlayer player, NWObject target, int level, int spellFeatID)
        {
            int   damage;
            float duration;

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

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

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

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

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

            case 6:
                damage   = RandomService.D8(4);
                duration = 12;
                break;

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

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

            case 9:
                damage   = RandomService.D8(6);
                duration = 24;
                break;

            default: return;
            }


            _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_PIERCING), target);
            _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectCutsceneImmobilize(), target, duration);
            _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectVisualEffect(VFX_IMP_ACID_L), target, duration);
        }
コード例 #2
0
        public void OnImpact(NWCreature creature, NWObject target, int level, int spellTier)
        {
            int   damage;
            float duration;

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

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

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

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

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

            case 6:
                damage   = RandomService.D8(4);
                duration = 12;
                break;

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

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

            case 9:
                damage   = RandomService.D8(6);
                duration = 24;
                break;

            default: return;
            }


            _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage, DamageType.Piercing), target);
            _.ApplyEffectToObject(DurationType.Temporary, _.EffectCutsceneImmobilize(), target, duration);
            _.ApplyEffectToObject(DurationType.Temporary, _.EffectVisualEffect(VisualEffect.Vfx_Imp_Acid_L), target, duration);
        }
コード例 #3
0
ファイル: Dice.cs プロジェクト: Terallis/SWLOR_NWN
        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);
        }
コード例 #4
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            if (currentTick % 2 != 0) return;
            int damage = RandomService.D4(1);
            oTarget.SetLocalInt(AbilityService.LAST_ATTACK + oCaster.GlobalID, AbilityService.ATTACK_DOT);

            oCaster.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage, DamageType.Divine), oTarget);
            });
            
        }
コード例 #5
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            if (currentTick % 2 != 0)
            {
                return;
            }
            int damage = RandomService.D4(1);

            oCaster.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage, DamageType.Cold), oTarget);
            });
        }
コード例 #6
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            if (currentTick % 2 != 0)
            {
                return;
            }
            int damage = RandomService.D4(1);

            oCaster.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_COLD), oTarget);
            });
        }
コード例 #7
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            if (currentTick % 2 != 0)
            {
                return;
            }
            int damage = RandomService.D4(1);

            oTarget.SetLocalInt(AbilityService.LAST_ATTACK + oCaster.GlobalID, AbilityService.ATTACK_DOT);
            oCaster.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_ACID), oTarget);
            });
        }
コード例 #8
0
ファイル: Knockdown.cs プロジェクト: zunath/SWLOR_NWN
        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);
        }
コード例 #9
0
ファイル: Knockdown.cs プロジェクト: NZNightwolf/SWLOR_NWN
        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);
        }
コード例 #10
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);
                }
            }
        }
コード例 #11
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);
            }
        }
コード例 #12
0
ファイル: PreciseToss.cs プロジェクト: NZNightwolf/SWLOR_NWN
        public void OnImpact(NWPlayer player, NWObject target, int level, int spellFeatID)
        {
            int damage;
            int seconds;
            int dotDamage;

            switch (level)
            {
            case 1:
                damage    = RandomService.D4(1);
                seconds   = 6;
                dotDamage = 1;
                break;

            case 2:
                damage    = RandomService.D8(1);
                seconds   = 6;
                dotDamage = 1;
                break;

            case 3:
                damage    = RandomService.D8(2);
                seconds   = 6;
                dotDamage = 1;
                break;

            case 4:
                damage    = RandomService.D8(2);
                seconds   = 12;
                dotDamage = 2;
                break;

            case 5:
                damage    = RandomService.D8(3);
                seconds   = 12;
                dotDamage = 2;
                break;

            case 6:
                damage    = RandomService.D8(4);
                seconds   = 12;
                dotDamage = 2;
                break;

            case 7:
                damage    = RandomService.D8(5);
                seconds   = 12;
                dotDamage = 3;
                break;

            case 8:
                damage    = RandomService.D8(5);
                seconds   = 18;
                dotDamage = 3;
                break;

            case 9:
                damage    = RandomService.D8(6);
                seconds   = 24;
                dotDamage = 3;
                break;

            default: return;
            }

            _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_PIERCING), target);
            CustomEffectService.ApplyCustomEffect(player, target.Object, CustomEffectType.Bleeding, seconds, level, Convert.ToString(dotDamage));
        }
コード例 #13
0
ファイル: ForcePush.cs プロジェクト: NZNightwolf/SWLOR_NWN
        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);
        }
コード例 #14
0
ファイル: CrossCut.cs プロジェクト: NZNightwolf/SWLOR_NWN
        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.");
        }
コード例 #15
0
ファイル: CrossCut.cs プロジェクト: zunath/SWLOR_NWN
        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.");
        }
コード例 #16
0
ファイル: PreciseToss.cs プロジェクト: Mithreas/SWLOR_NWN
        public void OnImpact(NWCreature creature, NWObject target, int level, int spellTier)
        {
            int damage;
            int seconds;
            int dotDamage;

            switch (level)
            {
            case 1:
                damage    = RandomService.D4(1);
                seconds   = 6;
                dotDamage = 1 + (creature.RightHand.DamageBonus / 5);
                break;

            case 2:
                damage    = RandomService.D8(1);
                seconds   = 6;
                dotDamage = 1 + (creature.RightHand.DamageBonus / 5);
                break;

            case 3:
                damage    = RandomService.D8(2);
                seconds   = 6;
                dotDamage = 1 + (creature.RightHand.DamageBonus / 5);
                break;

            case 4:
                damage    = RandomService.D8(2);
                seconds   = 12;
                dotDamage = 2 + (creature.RightHand.DamageBonus / 4);
                break;

            case 5:
                damage    = RandomService.D8(3);
                seconds   = 12;
                dotDamage = 2 + (creature.RightHand.DamageBonus / 4);
                break;

            case 6:
                damage    = RandomService.D8(4);
                seconds   = 12;
                dotDamage = 2 + (creature.RightHand.DamageBonus / 4);
                break;

            case 7:
                damage    = RandomService.D8(5);
                seconds   = 12;
                dotDamage = 3 + (creature.RightHand.DamageBonus / 3);
                break;

            case 8:
                damage    = RandomService.D8(5);
                seconds   = 18;
                dotDamage = 3 + (creature.RightHand.DamageBonus / 3);
                break;

            case 9:
                damage    = RandomService.D8(6);
                seconds   = 24;
                dotDamage = 3 + (creature.RightHand.DamageBonus / 3);
                break;

            default: return;
            }

            _.ApplyEffectToObject(DurationType.Instant, _.EffectDamage(damage, DamageType.Piercing), target);
            CustomEffectService.ApplyCustomEffect(creature, target.Object, CustomEffectType.Bleeding, seconds, level, Convert.ToString(dotDamage));
        }