Beispiel #1
0
        public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args)
        {
            // Did the player pass in the 'end' argument? If so, we're ending the concentration effect.
            bool doEnd = args.Length > 0 && args[0] == "end";

            if (doEnd)
            {
                AbilityService.EndConcentrationEffect(user);
                user.SendMessage("You have ended your concentration ability.");
            }
            // Otherwise just notify them about what effect is currently active.
            else
            {
                var effect = AbilityService.GetActiveConcentrationEffect(user);
                if (effect.Type == PerkType.Unknown)
                {
                    user.SendMessage("No concentration ability is currently active.");
                }
                else
                {
                    var perk = PerkService.GetPerkByID((int)effect.Type);
                    user.SendMessage("Currently active concentration ability: " + perk.Name);
                }
            }
        }
Beispiel #2
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            AbilityService.EndConcentrationEffect(oCaster);

            NWPlayer player   = oTarget.Object;
            int      restTick = oTarget.GetLocalInt("REST_TICK") + 1;


            // Pull original position from data
            string[] values           = data.Split(',');
            Vector3  originalPosition = _.Vector3
                                        (
                Convert.ToSingle(values[0]),
                Convert.ToSingle(values[1]),
                Convert.ToSingle(values[2])
                                        );

            // Check position
            Vector3 position = player.Position;

            if ((Math.Abs(position.X - originalPosition.X) > 0.01f ||
                 Math.Abs(position.Y - originalPosition.Y) > 0.01f ||
                 Math.Abs(position.Z - originalPosition.Z) > 0.01f) ||
                !CanRest(player) ||
                !player.IsValid)
            {
                player.IsBusy = false;
                CustomEffectService.RemovePCCustomEffect(player, CustomEffectType.Rest);
                return;
            }

            player.IsBusy = true;

            player.AssignCommand(() =>
            {
                _.ActionPlayAnimation(Animation.LoopingSitCross, 1.0f, 6.1f);
            });

            if (restTick >= 6)
            {
                int amount = CalculateAmount(player);

                _.ApplyEffectToObject(DurationType.Instant, _.EffectHeal(amount), player);
                Effect vfx = _.EffectVisualEffect(VisualEffect.Vfx_Imp_Head_Holy);
                _.ApplyEffectToObject(DurationType.Instant, vfx, player);
                restTick = 0;
            }

            oTarget.SetLocalInt("REST_TICK", restTick);
        }
Beispiel #3
0
        public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data)
        {
            AbilityService.EndConcentrationEffect(oCaster);

            NWPlayer player   = oTarget.Object;
            int      restTick = oTarget.GetLocalInt("REST_TICK") + 1;


            // Pull original position from data
            string[] values           = data.Split(',');
            Vector   originalPosition = _.Vector
                                        (
                Convert.ToSingle(values[0]),
                Convert.ToSingle(values[1]),
                Convert.ToSingle(values[2])
                                        );

            // Check position
            Vector position = player.Position;

            if ((Math.Abs(position.m_X - originalPosition.m_X) > 0.01f ||
                 Math.Abs(position.m_Y - originalPosition.m_Y) > 0.01f ||
                 Math.Abs(position.m_Z - originalPosition.m_Z) > 0.01f) ||
                !CanRest(player) ||
                !player.IsValid)
            {
                player.IsBusy = false;
                CustomEffectService.RemovePCCustomEffect(player, CustomEffectType.Rest);
                return;
            }

            player.IsBusy = true;

            player.AssignCommand(() =>
            {
                _.ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS, 1.0f, 6.1f);
            });

            if (restTick >= 6)
            {
                int amount = CalculateAmount(player);

                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(amount), player);
                Effect vfx = _.EffectVisualEffect(VFX_IMP_HEAD_HOLY);
                _.ApplyEffectToObject(DURATION_TYPE_INSTANT, vfx, player);
                restTick = 0;
            }

            oTarget.SetLocalInt("REST_TICK", restTick);
        }
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            int chance = perkLevel * 25;

            // Failed to interrupt.
            if (RandomService.D100(1) > chance)
            {
                creature.SendMessage("You fail to interrupt your target's concentration.");
                return;
            }

            NWCreature targetCreature = target.Object;
            var        effect         = AbilityService.GetActiveConcentrationEffect(targetCreature);

            if (effect.Type != PerkType.Unknown)
            {
                targetCreature.SendMessage("Your concentration effect has been interrupted by " + creature.Name + ".");
                AbilityService.EndConcentrationEffect(target.Object);
            }
        }
Beispiel #5
0
        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 = 0;
                hpPenalty = 2;
                attacks   = 0;
                break;

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

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

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

            case 5:
                strBonus  = 10;
                conBonus  = 10;
                acPenalty = 0;
                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(0);
            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);
            });
        }
Beispiel #6
0
        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 strEffect    = _.EffectAbilityIncrease(_.ABILITY_STRENGTH, strBonus);
            Effect conEffect    = _.EffectAbilityIncrease(_.ABILITY_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);

            // Apply both effects.
            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, damageEffect, target);
            _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, finalEffect, target, 6.1f);
        }