示例#1
0
        public void OnImpact(NWPlayer player, NWObject target, int perkLevel, int spellFeatID)
        {
            var spread    = CustomEffectService.GetForceSpreadDetails(player);
            int skillRank = SkillService.GetPCSkillRank(player, SkillType.ForceSupport);

            if (spread.Level <= 0)
            {
                HealTarget(player, target, perkLevel, skillRank, (CustomFeatType)spellFeatID);
            }
            else
            {
                var members = player.PartyMembers.Where(x => _.GetDistanceBetween(x, target) <= spread.Range ||
                                                        Equals(x, target));
                spread.Uses--;

                foreach (var member in members)
                {
                    HealTarget(player, member, perkLevel, skillRank, (CustomFeatType)spellFeatID);
                }

                CustomEffectService.SetForceSpreadUses(player, spread.Uses);
                SkillService.RegisterPCToAllCombatTargetsForSkill(player, SkillType.ForceUtility, null);
            }
            _.PlaySound("v_imp_heal");
            SkillService.RegisterPCToAllCombatTargetsForSkill(player, SkillType.ForceSupport, target.Object);
        }
示例#2
0
        private void ApplyEffect(NWCreature creature, NWObject target, int spellTier)
        {
            Effect effectMindShield;

            // Handle effects for differing spellTier values
            switch (spellTier)
            {
            case 1:
                effectMindShield = _.EffectImmunity(ImmunityType.Dazed);

                creature.AssignCommand(() =>
                {
                    _.ApplyEffectToObject(DurationType.Temporary, effectMindShield, target, 6.1f);
                });
                break;

            case 2:
                effectMindShield = _.EffectImmunity(ImmunityType.Dazed);
                effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Confused));
                effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Dominate));     // Force Pursuade is DOMINATION effect

                creature.AssignCommand(() =>
                {
                    _.ApplyEffectToObject(DurationType.Temporary, effectMindShield, target, 6.1f);
                });
                break;

            case 3:
                effectMindShield = _.EffectImmunity(ImmunityType.Dazed);
                effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Confused));
                effectMindShield = _.EffectLinkEffects(effectMindShield, _.EffectImmunity(ImmunityType.Dominate));     // Force Pursuade is DOMINATION effect

                if (target.GetLocalInt("FORCE_DRAIN_IMMUNITY") == 1)
                {
                    creature.SetLocalInt("FORCE_DRAIN_IMMUNITY", 0);
                }
                creature.DelayAssignCommand(() =>
                {
                    creature.DeleteLocalInt("FORCE_DRAIN_IMMUNITY");
                }, 6.1f);

                creature.AssignCommand(() =>
                {
                    _.ApplyEffectToObject(DurationType.Temporary, effectMindShield, target, 6.1f);
                });
                break;

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

            // Play VFX
            _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Dur_Mind_Affecting_Positive), target);

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceControl, null);
            }
        }
示例#3
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            float duration = 0.0f;

            switch (spellTier)
            {
            case 1:
                duration = 6f;
                break;

            case 2:
                duration = 12f;
                break;

            case 3:
                duration = 18f;
                break;

            case 4:
                duration = 24f;
                break;
            }

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


            // Resisted - Only apply slow for six seconds
            if (result.IsResisted)
            {
                _.ApplyEffectToObject(DurationType.Temporary, _.EffectSlow(), target, 6.0f);
            }

            // Not resisted - Apply knockdown for the specified duration
            else
            {
                // Check lucky chance.
                int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky);
                if (RandomService.D100(1) <= luck)
                {
                    duration *= 2;
                    creature.SendMessage("Lucky Force Push!");
                }

                _.ApplyEffectToObject(DurationType.Temporary, AbilityService.EffectKnockdown(target, 3.0f), target, 3.0f);
                _.ApplyEffectToObject(DurationType.Temporary, _.EffectSlow(), target, duration);
            }

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

            _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Com_Blood_Spark_Small), target);
        }
示例#4
0
        public void OnImpact(NWPlayer player, NWObject target, int perkLevel, int spellFeatID)
        {
            NWCreature targetCreature = target.Object;

            int   duration;
            int   uses;
            float range;

            switch (perkLevel)
            {
            case 1:
                duration = 30;
                uses     = 1;
                range    = 10f;
                break;

            case 2:
                duration = 30;
                uses     = 2;
                range    = 10f;
                break;

            case 3:
                duration = 60;
                uses     = 2;
                range    = 20f;
                break;

            case 4:
                duration = 60;
                uses     = 3;
                range    = 20f;
                break;

            case 5:
                duration = 60;
                uses     = 4;
                range    = 20f;
                break;

            case 6:
                duration = 60;
                uses     = 5;
                range    = 20f;
                break;

            default: return;
            }

            _.PlaySound("v_useforce");
            CustomEffectService.ApplyCustomEffect(player, targetCreature, CustomEffectType.ForceSpread, duration, perkLevel, uses + "," + range);
            SkillService.RegisterPCToAllCombatTargetsForSkill(player, SkillType.ForceUtility, null);
        }
示例#5
0
        public void OnConcentrationTick(NWCreature creature, NWObject target, int perkLevel, int tick)
        {
            int abamount;
            int acamount;

            // Handle effects for differing spellTier values
            switch (perkLevel)
            {
            case 1:
                abamount = 3;
                acamount = 0;
                break;

            case 2:
                abamount = 5;
                acamount = 2;
                break;

            case 3:
                abamount = 5;
                acamount = 4;
                break;

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

            var effect = _.EffectACIncrease(acamount);

            effect = _.EffectLinkEffects(effect, _.EffectAttackIncrease(abamount));
            effect = _.TagEffect(effect, "EFFECT_FORCE_INSIGHT");

            // Remove any existing force insight effects.
            foreach (var existing in creature.Effects.Where(x => _.GetEffectTag(effect) == "EFFECT_FORCE_INSIGHT"))
            {
                _.RemoveEffect(creature, existing);
            }

            // Apply the new effect.
            _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, effect, creature, 6.1f);
            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_DUR_MAGIC_RESISTANCE), target);

            // Register players to all combat targets for Force Sense.
            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceSense, null);
            }

            EnmityService.AdjustEnmityOnAllTaggedCreatures(creature, 4);
        }
示例#6
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            float duration = 0.0f;

            switch (spellTier)
            {
                case 1:
                    duration = 6f;
                    break;
                case 2:
                    duration = 12f;
                    break;
                case 3:
                    duration = 18f;
                    break;
                case 4:
                    duration = 24f;
                    break;
            }

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


            // Resisted - Only apply slow for six seconds
            if (result.IsResisted)
            {
                _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectSlow(), target, 6.0f);
            }

            // Not resisted - Apply knockdown for the specified duration
            else
            {
                // Check lucky chance.
                int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky);
                if (RandomService.D100(1) <= luck)
                {
                    duration *= 2;
                    creature.SendMessage("Lucky Force Push!");
                }

                _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectKnockdown(), target, duration);
            }

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceAlter, target.Object);
            }
            
            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_COM_BLOOD_SPARK_SMALL), target);
        }
示例#7
0
        public void OnImpact(NWPlayer player, NWObject target, int level, int spellFeatID)
        {
            int ticks;
            var spread = CustomEffectService.GetForceSpreadDetails(player);

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

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

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

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


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

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

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

            SkillService.RegisterPCToAllCombatTargetsForSkill(player, SkillType.ForceSupport, null);
        }
示例#8
0
        public void OnConcentrationTick(NWCreature creature, NWObject target, int perkLevel, int tick)
        {
            Effect effect;
            float  duration = 24.1f;
            int    concealment;
            int    hitpoints;

            switch (perkLevel)
            {
            case 1:
                hitpoints = 5;
                effect    = _.EffectTemporaryHitpoints(hitpoints);
                break;

            case 2:
                hitpoints   = 10;
                concealment = 5;
                effect      = _.EffectConcealment(concealment);
                effect      = _.EffectLinkEffects(effect, _.EffectTemporaryHitpoints(hitpoints));
                break;

            case 3:
                concealment = 10;
                hitpoints   = 15;
                effect      = _.EffectConcealment(concealment);
                effect      = _.EffectLinkEffects(effect, _.EffectTemporaryHitpoints(hitpoints));
                break;

            default:
                throw new ArgumentException(nameof(perkLevel) + " invalid. Value " + perkLevel + " is unhandled.");
            }

            _.ApplyEffectToObject(DurationType.Temporary, effect, creature, duration);
            _.ApplyEffectToObject(DurationType.Temporary, _.EffectVisualEffect(VisualEffect.Vfx_Dur_Aura_Purple), creature, duration);

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceSense, null);
            }
        }
示例#9
0
        public void OnImpact(NWPlayer player, NWObject target, int perkLevel, int spellFeatID)
        {
            int duration;

            switch (perkLevel)
            {
            case 1:
                duration = 24;
                break;

            case 2:
                duration = 48;
                break;

            case 3:
                duration = 72;
                break;

            default: throw new ArgumentOutOfRangeException();
            }

            CustomEffectService.ApplyCustomEffect(player, player, CustomEffectType.Chainspell, duration, perkLevel, null);
            SkillService.RegisterPCToAllCombatTargetsForSkill(player, SkillType.ForceUtility, null);
        }
示例#10
0
        public void OnImpact(NWPlayer player, NWObject target, int perkLevel, int spellFeatID)
        {
            float       recoveryPercent;
            int         basePotency;
            const float Tier1Modifier = 1;
            const float Tier2Modifier = 2;
            const float Tier3Modifier = 0;
            const float Tier4Modifier = 0;

            switch (perkLevel)
            {
            case 1:
                basePotency     = 10;
                recoveryPercent = 0.2f;
                break;

            case 2:
                basePotency     = 15;
                recoveryPercent = 0.2f;
                break;

            case 3:
                basePotency     = 20;
                recoveryPercent = 0.4f;
                break;

            case 4:
                basePotency     = 25;
                recoveryPercent = 0.4f;
                break;

            case 5:
                basePotency     = 30;
                recoveryPercent = 0.5f;
                break;

            default: return;
            }

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

            if (RandomService.Random(100) + 1 <= luck)
            {
                recoveryPercent = 1.0f;
                player.SendMessage("Lucky drain life!");
            }

            var calc = CombatService.CalculateForceDamage(
                player,
                target.Object,
                ForceAbilityType.Dark,
                basePotency,
                Tier1Modifier,
                Tier2Modifier,
                Tier3Modifier,
                Tier4Modifier);

            _.AssignCommand(player, () =>
            {
                int heal = (int)(calc.Damage * recoveryPercent);
                if (heal > target.CurrentHP)
                {
                    heal = target.CurrentHP;
                }

                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(calc.Damage), target);
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(heal), player);
                _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectVisualEffect(VFX_BEAM_MIND), target, 1.0f);
            });

            _.PlaySound("v_pro_drain");
            SkillService.RegisterPCToAllCombatTargetsForSkill(player, SkillType.ForceCombat, target.Object);
            CombatService.AddTemporaryForceDefense(target.Object, ForceAbilityType.Dark);
        }
示例#11
0
        // Heal Formula:
        // Power = floor(WIS÷2) + floor(CHA÷4) + ((Force Support Skill+Item Potency)÷2)
        // Base = floor((Power - Power Floor) ÷ Rate ) + Base Potency
        // Completely stolen from: https://www.bg-wiki.com/index.php?title=Cure_Formula&oldid=537717 and tweaked.
        private void HealTarget(NWPlayer oPC, NWObject oTarget, int perkLevel, int skillRank, CustomFeatType spellFeat)
        {
            var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(oPC);

            int itemPotency = effectiveStats.ForcePotency + effectiveStats.LightPotency;
            int power       = (oPC.Wisdom / 2) + (oPC.Charisma / 4) + ((skillRank + itemPotency) / 2);
            ForceHealPotency potencyStats = null;

            // The same rules are used for each Force Heal tier.
            // However, using a lower tier ability will cap out regardless of your perk level.
            // I.E: If you are on perk level 8 and you use Force Heal I, the recovery amount will cap as if you were level 3.

            // Ranks 1-3: Force Heal I
            if (spellFeat == CustomFeatType.ForceHeal)
            {
                if (perkLevel > 3)
                {
                    perkLevel = 3;
                }

                switch (perkLevel)
                {
                case 1:
                    // Rank 1, Tier 1:
                    if (power < 20)
                    {
                        potencyStats = _potencyLookup[1];
                    }
                    // Rank 1, Tier 2:
                    else
                    {
                        potencyStats = _potencyLookup[2];
                    }

                    break;

                case 2:
                    // Rank 2, Tier 1:
                    if (power < 125)
                    {
                        potencyStats = _potencyLookup[3];
                    }
                    // Rank 2, Tier 2:
                    else
                    {
                        potencyStats = _potencyLookup[4];
                    }

                    break;

                case 3:
                    // Rank 3, Tier 1:
                    if (power < 600)
                    {
                        potencyStats = _potencyLookup[5];
                    }
                    // Rank 3, Tier 2:
                    else
                    {
                        potencyStats = _potencyLookup[6];
                    }

                    break;
                }
            }
            // Ranks 4-6: Force Heal II
            else if (spellFeat == CustomFeatType.ForceHeal2)
            {
                if (perkLevel > 6)
                {
                    perkLevel = 6;
                }

                switch (perkLevel)
                {
                case 4:
                    // Rank 4, Tier 1:
                    if (power < 70)
                    {
                        potencyStats = _potencyLookup[7];
                    }
                    // Rank 4, Tier 2:
                    else
                    {
                        potencyStats = _potencyLookup[8];
                    }

                    break;

                case 5:
                    // Rank 5, Tier 1:
                    if (power < 200)
                    {
                        potencyStats = _potencyLookup[9];
                    }
                    // Rank 5, Tier 2:
                    else
                    {
                        potencyStats = _potencyLookup[10];
                    }

                    break;

                case 6:
                    // Rank 6, Tier 1:
                    if (power < 700)
                    {
                        potencyStats = _potencyLookup[11];
                    }
                    // Rank 6, Tier 2:
                    else
                    {
                        potencyStats = _potencyLookup[12];
                    }

                    break;
                }
            }
            // Ranks 7-8: Force Heal III
            else if (spellFeat == CustomFeatType.ForceHeal3)
            {
                if (perkLevel > 8)
                {
                    perkLevel = 8;
                }

                switch (perkLevel)
                {
                case 7:
                    // Rank 7, Tier 1:
                    if (power < 125)
                    {
                        potencyStats = _potencyLookup[13];
                    }
                    // Rank 7, Tier 2:
                    else
                    {
                        potencyStats = _potencyLookup[14];
                    }
                    break;

                case 8:
                    // Rank 8, Tier 1:
                    if (power < 300)
                    {
                        potencyStats = _potencyLookup[15];
                    }
                    // Rank 8, Tier 2:
                    else if (power < 700)
                    {
                        potencyStats = _potencyLookup[16];
                    }
                    // Rank 8, Tier 3:
                    else
                    {
                        potencyStats = _potencyLookup[17];
                    }
                    break;
                }
            }
            // Ranks 9-10: Force Heal IV
            else if (spellFeat == CustomFeatType.ForceHeal4)
            {
                if (perkLevel > 10)
                {
                    perkLevel = 10;
                }

                switch (perkLevel)
                {
                case 9:
                    // Rank 9, Tier 1:
                    if (power < 200)
                    {
                        potencyStats = _potencyLookup[18];
                    }
                    // Rank 9, Tier 2:
                    else
                    {
                        potencyStats = _potencyLookup[19];
                    }

                    break;

                case 10:
                    // Rank 10, Tier 1:
                    if (power < 400)
                    {
                        potencyStats = _potencyLookup[20];
                    }
                    // Rank 10, Tier 2:
                    else
                    {
                        potencyStats = _potencyLookup[21];
                    }

                    break;
                }
            }

            if (potencyStats == null)
            {
                throw new Exception("Unable to identify Force Heal rules.");
            }

            // Calculate the amount based on the level and tier values
            int amount = (int)((power - potencyStats.PowerFloor) / potencyStats.Rate) + potencyStats.BasePotency;

            // Don't go over the hard cap, if there is one.
            if (potencyStats.HardCap > 0 && amount > potencyStats.HardCap)
            {
                amount = potencyStats.HardCap;
            }

            // Do a lucky check. Increases damage by 50% if successful.
            int luck = PerkService.GetPCPerkLevel(oPC, PerkType.Lucky) + effectiveStats.Luck;

            if (RandomService.Random(100) + 1 <= luck)
            {
                amount = (int)(amount * 1.5f);
                oPC.SendMessage("Lucky heal!");
            }

            // Apply the heal.
            oPC.AssignCommand(() =>
            {
                Effect heal = _.EffectHeal(amount);
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, heal, oTarget);

                Effect vfx = _.EffectVisualEffect(VFX_IMP_HEALING_M);
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, vfx, oTarget.Object);
            });

            SkillService.RegisterPCToAllCombatTargetsForSkill(oPC, SkillType.ForceSupport, null);
        }
示例#12
0
        public void OnImpact(NWPlayer player, NWObject target, int level, int spellFeatID)
        {
            int length;
            int dotAmount;

            int         basePotency;
            const float Tier1Modifier = 1.0f;
            const float Tier2Modifier = 1.6f;
            const float Tier3Modifier = 2.2f;
            const float Tier4Modifier = 0;

            switch (level)
            {
            case 1:
                basePotency = 15;
                length      = 0;
                dotAmount   = 0;
                break;

            case 2:
                basePotency = 20;
                length      = 6;
                dotAmount   = 4;
                break;

            case 3:
                basePotency = 25;
                length      = 6;
                dotAmount   = 6;
                break;

            case 4:
                basePotency = 40;
                length      = 12;
                dotAmount   = 6;
                break;

            case 5:
                basePotency = 50;
                length      = 12;
                dotAmount   = 6;
                break;

            case 6:
                basePotency = 60;
                length      = 12;
                dotAmount   = 6;
                break;

            case 7:
                basePotency = 70;
                length      = 12;
                dotAmount   = 6;
                break;

            case 8:
                basePotency = 80;
                length      = 12;
                dotAmount   = 8;
                break;

            case 9:
                basePotency = 90;
                length      = 12;
                dotAmount   = 8;
                break;

            case 10:
                basePotency = 100;
                length      = 12;
                dotAmount   = 10;
                break;

            default: 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 lightning!");
            }

            var calc = CombatService.CalculateForceDamage(
                player,
                target.Object,
                ForceAbilityType.Electrical,
                basePotency,
                Tier1Modifier,
                Tier2Modifier,
                Tier3Modifier,
                Tier4Modifier);

            player.AssignCommand(() =>
            {
                Effect damage = _.EffectDamage(calc.Damage, DAMAGE_TYPE_ELECTRICAL);
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, damage, target);
            });

            if (length > 0.0f && dotAmount > 0)
            {
                CustomEffectService.ApplyCustomEffect(player, target.Object, CustomEffectType.ForceShock, length, level, dotAmount.ToString());
            }

            SkillService.RegisterPCToAllCombatTargetsForSkill(player, SkillType.ForceCombat, target.Object);

            player.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectVisualEffect(VFX_BEAM_LIGHTNING), target, 1.0f);
            });
            _.PlaySound("v_pro_lightning");
            CombatService.AddTemporaryForceDefense(target.Object, ForceAbilityType.Electrical);
        }
示例#13
0
        public void OnConcentrationTick(NWCreature creature, NWObject target, int perkLevel, int tick)
        {
            const float MaxDistance = 5.0f;
            int         nth         = 1;
            int         amount;

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

            case 2:
            case 3:
                amount = 10;
                break;

            default: return;
            }

            // Penalize the caster
            Effect effect = _.EffectACDecrease(amount);

            effect = _.EffectLinkEffects(effect, _.EffectAttackDecrease(amount));
            ApplyEffectToObject(DurationType.Temporary, effect, creature, 6.1f);


            NWCreature targetCreature = _.GetNearestCreature(CreatureType.IsAlive, 1, creature, nth);

            while (targetCreature.IsValid && GetDistanceBetween(creature, targetCreature) <= MaxDistance)
            {
                // Skip the caster, if they get picked up.
                if (targetCreature == creature)
                {
                    nth++;
                    targetCreature = _.GetNearestCreature(CreatureType.IsAlive, 1, creature, nth);
                    continue;
                }

                // Handle effects for differing spellTier values
                switch (perkLevel)
                {
                case 1:
                    amount = 5;

                    if (_.GetIsReactionTypeHostile(targetCreature, creature) == true)
                    {
                        nth++;
                        targetCreature = _.GetNearestCreature(CreatureType.IsAlive, 1, creature, nth);
                        continue;
                    }
                    break;

                case 2:
                    amount = 10;

                    if (_.GetIsReactionTypeHostile(targetCreature, creature) == true)
                    {
                        nth++;
                        targetCreature = _.GetNearestCreature(CreatureType.IsAlive, 1, creature, nth);
                        continue;
                    }
                    break;

                case 3:
                    amount = 10;
                    break;

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

                if (_.GetIsReactionTypeHostile(targetCreature, creature) == true)
                {
                    effect = _.EffectACDecrease(amount);
                    effect = _.EffectLinkEffects(effect, _.EffectAttackDecrease(amount));
                }
                else
                {
                    effect = _.EffectACIncrease(amount);
                    effect = _.EffectLinkEffects(effect, _.EffectAttackIncrease(amount));
                }

                _.ApplyEffectToObject(DurationType.Temporary, effect, targetCreature, 6.1f);
                _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Dur_Magic_Resistance), targetCreature);

                if (creature.IsPlayer)
                {
                    SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceSense, null);
                }

                nth++;
                targetCreature = _.GetNearestCreature(CreatureType.IsAlive, 1, creature, nth);
            }
        }
示例#14
0
文件: Rage.cs 项目: zunath/SWLOR_NWN
        private void ApplyEffect(NWCreature creature, NWObject target, int spellTier)
        {
            int strBonus;
            int conBonus;
            int acPenalty;
            int hpPenalty;
            int attacks;

            // Figure out what the bonuses are for this spell tier.
            switch (spellTier)
            {
            case 1:
                strBonus  = 2;
                conBonus  = 2;
                acPenalty = 2;
                hpPenalty = 2;
                attacks   = 0;
                break;

            case 2:
                strBonus  = 4;
                conBonus  = 4;
                acPenalty = 2;
                hpPenalty = 4;
                attacks   = 0;
                break;

            case 3:
                strBonus  = 6;
                conBonus  = 6;
                acPenalty = 4;
                hpPenalty = 6;
                attacks   = 1;
                break;

            case 4:
                strBonus  = 8;
                conBonus  = 8;
                acPenalty = 4;
                hpPenalty = 8;
                attacks   = 1;
                break;

            case 5:
                strBonus  = 10;
                conBonus  = 10;
                acPenalty = 6;
                hpPenalty = 10;
                attacks   = 2;
                break;

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

            // If creature can't afford the HP hit for this tick, bail out early.
            if (target.CurrentHP < hpPenalty)
            {
                AbilityService.EndConcentrationEffect(creature);
                creature.SendMessage("Concentration effect has ended because you do not have enough HP to maintain it.");
                return;
            }

            // Build a linked effect which handles applying these bonuses and penalties.
            Effect visualEffect = _.EffectVisualEffect(VisualEffect.Vfx_Dur_Aura_Red);
            Effect strEffect    = _.EffectAbilityIncrease(AbilityType.Strength, strBonus);
            Effect conEffect    = _.EffectAbilityIncrease(AbilityType.Constitution, conBonus);
            Effect acEffect     = _.EffectACDecrease(acPenalty);
            Effect attackEffect = _.EffectModifyAttacks(attacks);
            Effect finalEffect  = _.EffectLinkEffects(strEffect, conEffect);

            finalEffect = _.EffectLinkEffects(finalEffect, acEffect);

            // Only apply the attack effect if this spell tier increases it.
            if (attacks > 0)
            {
                finalEffect = _.EffectLinkEffects(finalEffect, attackEffect);
            }
            finalEffect = _.TagEffect(finalEffect, "FORCE_ABILITY_RAGE");

            Effect damageEffect = _.EffectDamage(hpPenalty, DamageType.Divine);

            // Apply both effects.
            creature.AssignCommand(() =>
            {
                _.ApplyEffectToObject(DurationType.Instant, damageEffect, creature.Object);
                _.ApplyEffectToObject(DurationType.Temporary, finalEffect, creature.Object, 6.1f);
                _.ApplyEffectToObject(DurationType.Temporary, visualEffect, creature.Object, 6.1f);
            });

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceControl, null);
            }
        }